Migrate to quadlets

This commit is contained in:
2026-07-09 11:46:56 +03:00
parent 1384f4375a
commit 6078cc2f35
15 changed files with 300 additions and 207 deletions

View File

@@ -0,0 +1,18 @@
[Unit]
Description=Mastodon PostgreSQL database
[Container]
ContainerName=database
Image=docker.io/library/postgres:17
Network=mastodon_internal.network
Environment=POSTGRES_DB=mastodon
Environment=POSTGRES_USER={{ mastodon_database.username }}
Environment=POSTGRES_PASSWORD={{ mastodon_database.password }}
Volume=/home/apps/mastodon/postgresql:/var/lib/postgresql/data:Z
HealthCmd=pg_isready -U postgres
[Service]
Restart=always
[Install]
WantedBy=default.target

View File

@@ -0,0 +1,28 @@
[Unit]
Description=Mastodon Elasticsearch
[Container]
ContainerName=elasticsearch
Image=docker.elastic.co/elasticsearch/elasticsearch:7.17.29
Network=mastodon_internal.network
Network=mastodon_external.network
Environment=ES_JAVA_OPTS=-Xms512m -Xmx512m -Des.enforce.bootstrap.checks=true
Environment=xpack.license.self_generated.type=basic
Environment=xpack.security.enabled=false
Environment=xpack.watcher.enabled=false
Environment=xpack.graph.enabled=false
Environment=xpack.ml.enabled=false
Environment=bootstrap.memory_lock=true
Environment=cluster.name=es-mastodon
Environment=discovery.type=single-node
Environment=thread_pool.write.queue_size=1000
Volume=/home/apps/mastodon/elasticsearch:/usr/share/elasticsearch/data:Z
HealthCmd=curl --silent --fail localhost:9200/_cluster/health
Ulimit=nofile=65536:65536
Ulimit=memlock=-1:-1
[Service]
Restart=always
[Install]
WantedBy=default.target

View File

@@ -0,0 +1,54 @@
[Unit]
Description=Mastodon web
After=database.service redis.service elasticsearch.service
Requires=database.service redis.service elasticsearch.service
[Container]
ContainerName=mastodon
Image=ghcr.io/mastodon/mastodon:v4.5.5
Exec=bundle exec puma -C config/puma.rb
Network=mastodon_internal.network
Network=mastodon_external.network
Network=podman
Environment=LOCAL_DOMAIN=wtf.lt
Environment=REDIS_HOST=redis
Environment=REDIS_PORT=6379
Environment=DB_HOST=database
Environment=DB_NAME=mastodon
Environment=DB_USER={{ mastodon_database.username }}
Environment=DB_PASS={{ mastodon_database.password }}
Environment=DB_PORT=5432
Environment=ES_ENABLED=true
Environment=ES_HOST=elasticsearch
Environment=ES_PORT=9200
Environment=ES_PRESET=single_node_cluster
Environment=ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY={{ active_record_encryption.DETERMINISTIC_KEY }}
Environment=ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT={{ active_record_encryption.KEY_DERIVATION_SALT }}
Environment=ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY={{ active_record_encryption.PRIMARY_KEY }}
Environment=VAPID_PRIVATE_KEY={{ vapid.PRIVATE_KEY }}
Environment=VAPID_PUBLIC_KEY={{ vapid.PUBLIC_KEY }}
Environment=SECRET_KEY_BASE={{ secret_key_base }}
Environment=SMTP_SERVER={{ smtp.SERVER }}
Environment=SMTP_PORT={{ smtp.PORT }}
Environment=SMTP_LOGIN={{ smtp.LOGIN }}
Environment=SMTP_PASSWORD={{ smtp.PASSWORD }}
Environment=SMTP_FROM_ADDRESS={{ smtp.FROM_ADDRESS }}
Environment=TRUSTED_PROXY_IP=127.0.0.1/8,::1/128,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7
Label=traefik.enable=true
Label=traefik.http.routers.mastodon.entrypoints=http
Label=traefik.http.routers.mastodon.rule=Host(`wtf.lt`)
Label=traefik.http.middlewares.mastodon-https-redirect.redirectscheme.scheme=https
Label=traefik.http.routers.mastodon.middlewares=mastodon-https-redirect
Label=traefik.http.routers.mastodon-secure.entrypoints=https
Label=traefik.http.routers.mastodon-secure.rule=Host(`wtf.lt`)
Label=traefik.http.routers.mastodon-secure.tls=true
Label=traefik.http.routers.mastodon-secure.tls.certresolver=lets-encrypt
Label=traefik.http.services.mastodon.loadbalancer.server.port=3000
Volume=/home/apps/mastodon/system:/mastodon/public/system:z
HealthCmd=/bin/sh -c "curl -s --noproxy localhost localhost:3000/health | grep -q OK"
[Service]
Restart=always
[Install]
WantedBy=default.target

View File

@@ -0,0 +1,15 @@
[Unit]
Description=Mastodon Redis
[Container]
ContainerName=redis
Image=docker.io/library/redis:7
Network=mastodon_internal.network
Volume=/home/apps/mastodon/redis:/data:Z
HealthCmd=redis-cli ping
[Service]
Restart=always
[Install]
WantedBy=default.target

View File

@@ -0,0 +1,41 @@
[Unit]
Description=Mastodon Sidekiq
After=database.service redis.service elasticsearch.service
Requires=database.service redis.service elasticsearch.service
[Container]
ContainerName=sidekiq
Image=ghcr.io/mastodon/mastodon:v4.5.5
Exec=bundle exec sidekiq
Network=mastodon_internal.network
Network=mastodon_external.network
Environment=LOCAL_DOMAIN=wtf.lt
Environment=REDIS_HOST=redis
Environment=REDIS_PORT=6379
Environment=DB_HOST=database
Environment=DB_NAME=mastodon
Environment=DB_USER={{ mastodon_database.username }}
Environment=DB_PASS={{ mastodon_database.password }}
Environment=DB_PORT=5432
Environment=ES_ENABLED=true
Environment=ES_HOST=elasticsearch
Environment=ES_PORT=9200
Environment=ES_PRESET=single_node_cluster
Environment=ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY={{ active_record_encryption.DETERMINISTIC_KEY }}
Environment=ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT={{ active_record_encryption.KEY_DERIVATION_SALT }}
Environment=ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY={{ active_record_encryption.PRIMARY_KEY }}
Environment=SECRET_KEY_BASE={{ secret_key_base }}
Environment=SMTP_SERVER={{ smtp.SERVER }}
Environment=SMTP_PORT={{ smtp.PORT }}
Environment=SMTP_LOGIN={{ smtp.LOGIN }}
Environment=SMTP_PASSWORD={{ smtp.PASSWORD }}
Environment=SMTP_FROM_ADDRESS={{ smtp.FROM_ADDRESS }}
Environment=TRUSTED_PROXY_IP=127.0.0.1/8,::1/128,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7
Volume=/home/apps/mastodon/system:/mastodon/public/system:z
HealthCmd=/bin/sh -c "ps aux | grep '[s]idekiq 8'"
[Service]
Restart=always
[Install]
WantedBy=default.target