scripts/fogcutter/docker/mastodon.sh

111 lines
3.0 KiB
Bash
Raw Normal View History

2022-12-21 14:54:16 -05:00
#!/bin/bash
set -e
2022-12-23 19:40:18 -05:00
TRUSTED_PROXY_IP=172.25.0.0/16
2022-12-21 14:54:16 -05:00
LOCAL_DOMAIN=social.bigcavemaps.com
REDIS_HOST=mastodon-redis
REDIS_PORT=6379
DB_HOST=mastodon-pg
DB_USER=mastodon
DB_NAME=mastodon_production
DB_PASS=mastodon
DB_PORT=5432
up () {
2022-12-28 15:39:26 -05:00
docker network create pew-net || true
2022-12-21 14:54:16 -05:00
docker run \
--detach \
--name mastodon-web \
--restart unless-stopped \
--env-file mastodon.env \
2022-12-23 19:40:18 -05:00
--env TRUSTED_PROXY_IP=$TRUSTED_PROXY_IP \
2022-12-21 14:54:16 -05:00
--env LOCAL_DOMAIN=$LOCAL_DOMAIN \
--env REDIS_HOST=$REDIS_HOST \
--env REDIS_PORT=$PORT \
--env DB_HOST=$DB_HOST \
--env DB_USER=$DB_USER \
--env DB_NAME=$DB_NAME \
--env DB_PASS=$DB_PASS \
--env DB_PORT=$DB_PORT \
--volume /bigdata/k8s-config/mastodon/public/system:/mastodon/public/system:rw \
--network pew-net \
docker.io/tootsuite/mastodon:v4.0.2 bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
docker run \
--detach \
--name mastodon-streaming \
--restart unless-stopped \
--env-file mastodon.env \
2022-12-23 19:40:18 -05:00
--env TRUSTED_PROXY_IP=$TRUSTED_PROXY_IP \
2022-12-21 14:54:16 -05:00
--env LOCAL_DOMAIN=$LOCAL_DOMAIN \
--env REDIS_HOST=$REDIS_HOST \
--env REDIS_PORT=$PORT \
--env DB_HOST=$DB_HOST \
--env DB_USER=$DB_USER \
--env DB_NAME=$DB_NAME \
--env DB_PASS=$DB_PASS \
--env DB_PORT=$DB_PORT \
--network pew-net \
docker.io/tootsuite/mastodon:v4.0.2 node ./streaming
docker run \
--detach \
--name mastodon-sidekiq \
--restart unless-stopped \
--env-file mastodon.env \
2022-12-23 19:40:18 -05:00
--env TRUSTED_PROXY_IP=$TRUSTED_PROXY_IP \
2022-12-21 14:54:16 -05:00
--env LOCAL_DOMAIN=$LOCAL_DOMAIN \
--env REDIS_HOST=$REDIS_HOST \
--env REDIS_PORT=$PORT \
--env DB_HOST=$DB_HOST \
--env DB_USER=$DB_USER \
--env DB_NAME=$DB_NAME \
--env DB_PASS=$DB_PASS \
--env DB_PORT=$DB_PORT \
--volume /bigdata/k8s-config/mastodon/public/system:/mastodon/public/system:rw \
--network pew-net \
docker.io/tootsuite/mastodon:v4.0.2 bundle exec sidekiq
# may have to run db:migrate if things don't work right away
docker run \
--detach \
--name mastodon-pg \
--restart unless-stopped \
--env POSTGRES_HOST_AUTH_METHOD=trust \
--env POSTGRES_USER=$DB_USER \
--env POSTGRES_DB=$DB_NAME \
--env POSTGRES_PASSWORD=$DB_PASS \
--volume /bigdata/k8s-config/mastodon/postgres/data:/var/lib/postgresql/data:rw \
--network pew-net \
docker.io/postgres:14-alpine
docker run \
--detach \
--name mastodon-redis \
--restart unless-stopped \
--volume /bigdata/k8s-config/mastodon/redis/data:/data:rw \
--network pew-net \
docker.io/redis:7-alpine
}
down () {
docker stop mastodon-web || true
docker rm mastodon-web || true
docker stop mastodon-streaming || true
docker rm mastodon-streaming || true
docker stop mastodon-sidekiq || true
docker rm mastodon-sidekiq || true
docker stop mastodon-pg || true
docker rm mastodon-pg || true
docker stop mastodon-redis || true
docker rm mastodon-redis || true
}
logs () {
docker logs --follow mastodon
}
$@