Initial commit
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=Iceshrimp PostgreSQL container
|
||||
[Container]
|
||||
Image=docker.io/postgres:15-alpine
|
||||
ContainerName=iceshrimp_db
|
||||
HostName=db
|
||||
Network=iceshrimp.network
|
||||
EnvironmentFile=%h/services/iceshrimp/.config/docker.env
|
||||
Volume=%h/services/iceshrimp/db:/var/lib/postgresql/data:Z
|
||||
[Service]
|
||||
Restart=on-failure
|
||||
TimeoutStartSec=900
|
||||
[Install]
|
||||
WantedBy=iceshrimp-web.service
|
||||
@@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=Iceshrimp Redis container
|
||||
[Container]
|
||||
Image=docker.io/redis:7.0-alpine
|
||||
ContainerName=iceshrimp_redis
|
||||
HostName=redis
|
||||
Network=iceshrimp.network
|
||||
Volume=%h/services/iceshrimp/redis:/data:Z
|
||||
[Service]
|
||||
Restart=on-failure
|
||||
TimeoutStartSec=900
|
||||
[Install]
|
||||
WantedBy=iceshrimp-web.service
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=Iceshrimp container
|
||||
[Container]
|
||||
Image=iceshrimp.dev/iceshrimp/iceshrimp:latest
|
||||
ContainerName=iceshrimp_web
|
||||
HostName=web
|
||||
PublishPort=3000:3000
|
||||
Network=iceshrimp.network
|
||||
Environment=NODE_ENV=production
|
||||
Volume=%h/services/iceshrimp/files:/iceshrimp/files:z
|
||||
Volume=%h/services/iceshrimp/.config:/iceshrimp/.config:ro,z
|
||||
[Service]
|
||||
Restart=on-failure
|
||||
TimeoutStartSec=900
|
||||
[Install]
|
||||
WantedBy=multi-user.target default.target
|
||||
@@ -0,0 +1 @@
|
||||
[Network]
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
if [ -d $HOME/.config/containers/systemd ]; then
|
||||
mkdir -pv $(grep -F "Volume=" $HOME/.config/containers/systemd/iceshrimp-*.container | sed "s|%h|$HOME|g" | cut -d= -f2 | cut -d: -f1);
|
||||
|
||||
db_env=$(grep -F "EnvironmentFile=" $HOME/.config/containers/systemd/iceshrimp-db.container | sed "s|%h|$HOME|g" | cut -d= -f2)
|
||||
config_dir=$(grep -F ":/iceshrimp/.config" $HOME/.config/containers/systemd/iceshrimp-web.container | sed "s|%h|$HOME|g" | cut -d= -f2 | cut -d: -f1)
|
||||
|
||||
if [ ! -f $config_dir/docker_example.env ]; then
|
||||
wget -O $db_env \
|
||||
https://iceshrimp.dev/iceshrimp/iceshrimp/raw/branch/dev/.config/docker_example.env;
|
||||
else
|
||||
cp -v $config_dir/docker_example.env $db_env;
|
||||
fi
|
||||
|
||||
if [ ! -f $config_dir/example-docker.yml ]; then
|
||||
wget -O $config_dir/default.yml \
|
||||
https://iceshrimp.dev/iceshrimp/iceshrimp/raw/branch/dev/.config/example-docker.yml;
|
||||
else
|
||||
cp $config_dir/example-docker.yml $config_dir/default.yml
|
||||
fi
|
||||
else
|
||||
echo "No $HOME/.config/containers/systemd found"
|
||||
exit 1
|
||||
fi
|
||||
@@ -0,0 +1,53 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
web:
|
||||
image: iceshrimp.dev/iceshrimp/iceshrimp:dev
|
||||
### If you want to build the image locally
|
||||
# build: .
|
||||
### If you want to build the image locally AND use Docker 20.10
|
||||
# build:
|
||||
# context: .
|
||||
# args:
|
||||
# DOCKER_BUILDKIT: 1
|
||||
container_name: iceshrimp_web
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
ports:
|
||||
- "3000:3000"
|
||||
networks:
|
||||
- ishnet
|
||||
# - web
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
volumes:
|
||||
- ./files:/iceshrimp/files
|
||||
- ./.config:/iceshrimp/.config:ro
|
||||
|
||||
redis:
|
||||
restart: unless-stopped
|
||||
image: docker.io/valkey/valkey:7-alpine
|
||||
container_name: iceshrimp_redis
|
||||
networks:
|
||||
- ishnet
|
||||
volumes:
|
||||
- ./redis:/data
|
||||
|
||||
db:
|
||||
restart: unless-stopped
|
||||
image: docker.io/postgres:16-alpine
|
||||
container_name: iceshrimp_db
|
||||
networks:
|
||||
- ishnet
|
||||
env_file:
|
||||
- .config/docker.env
|
||||
volumes:
|
||||
- ./db:/var/lib/postgresql/data
|
||||
|
||||
networks:
|
||||
ishnet:
|
||||
# web:
|
||||
# external:
|
||||
# name: web
|
||||
@@ -0,0 +1,13 @@
|
||||
# Replace example.com with your domain
|
||||
|
||||
<VirtualHost *:80>
|
||||
ServerName example.com
|
||||
# For WebSocket
|
||||
ProxyPass "/streaming" "ws://127.0.0.1:3000/streaming/"
|
||||
# Proxy to Node
|
||||
ProxyPass "/" "http://127.0.0.1:3000/"
|
||||
ProxyPassReverse "/" "http://127.0.0.1:3000/"
|
||||
ProxyPreserveHost On
|
||||
# For files proxy
|
||||
AllowEncodedSlashes On
|
||||
</VirtualHost>
|
||||
@@ -0,0 +1,78 @@
|
||||
# Replace example.com with your domain
|
||||
|
||||
# For WebSocket
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
proxy_cache_path /tmp/nginx_cache levels=1:2 keys_zone=cache1:16m max_size=1g inactive=720m use_temp_path=off;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name example.com;
|
||||
|
||||
# For SSL domain validation
|
||||
root /var/www/html;
|
||||
location /.well-known/acme-challenge/ { allow all; }
|
||||
location /.well-known/pki-validation/ { allow all; }
|
||||
location / { return 301 https://$server_name$request_uri; }
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
server_name example.com;
|
||||
|
||||
ssl_session_timeout 1d;
|
||||
ssl_session_cache shared:ssl_session_cache:10m;
|
||||
ssl_session_tickets off;
|
||||
|
||||
# To use Let's Encrypt certificate
|
||||
ssl_certificate /etc/letsencrypt/live/example.tld/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/example.tld/privkey.pem;
|
||||
|
||||
# To use Debian/Ubuntu's self-signed certificate (For testing or before issuing a certificate)
|
||||
#ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
|
||||
#ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
|
||||
|
||||
# SSL protocol settings
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
|
||||
ssl_prefer_server_ciphers off;
|
||||
ssl_stapling on;
|
||||
ssl_stapling_verify on;
|
||||
|
||||
# Change to your upload limit
|
||||
client_max_body_size 80m;
|
||||
|
||||
# Gzip compression
|
||||
gzip on;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/activity+json application/atom+xml;
|
||||
|
||||
# Proxy to Node
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:3000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_http_version 1.1;
|
||||
proxy_redirect off;
|
||||
|
||||
# If it's behind another reverse proxy or CDN, remove the following.
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
|
||||
# For WebSocket
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
|
||||
# Cache settings
|
||||
proxy_cache cache1;
|
||||
proxy_cache_lock on;
|
||||
proxy_cache_use_stale updating;
|
||||
add_header X-Cache $upstream_cache_status;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=Iceshrimp daemon
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=iceshrimp
|
||||
ExecStart=/usr/bin/yarn start
|
||||
WorkingDirectory=/home/iceshrimp/iceshrimp
|
||||
Environment="NODE_ENV=production"
|
||||
TimeoutSec=60
|
||||
SyslogIdentifier=iceshrimp
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user