From 4f28d87293c6c2b7597ba1df673693eee14fca4a Mon Sep 17 00:00:00 2001 From: syui Date: Tue, 21 May 2024 11:00:20 +0900 Subject: [PATCH] fix --- Dockerfile | 9 +++++++ README.md | 26 ++++++++++++++++++++ compose.yml | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 Dockerfile create mode 100644 compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..877544d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM redis:alpine AS redis-server +ADD start-redis-server.sh /usr/bin/ +RUN chmod +x /usr/bin/start-redis-server.sh +CMD ["start-redis-server.sh"] + +FROM tootsuite/mastodon:edge +ENV PORT 8080 +ENV BIND 0.0.0.0 +ENTRYPOINT [] diff --git a/README.md b/README.md index e69de29..ae46663 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,26 @@ +# mastodon + +- https://github.com/mastodon/mastodon +- https://github.com/mastodon/mastodon/pkgs/container/mastodon +- https://hub.docker.com/r/tootsuite/mastodon + +## update + +```sh +$ docker compose pull +$ docker compose build +$ docker compose run --rm mastodon rails db:migrate +$ docker compose up -d +``` + +## db:encryption + +```sh +$ docker compose run --rm mastodon rails db:encryption:init + +$ vim .env.production +ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=xxx +ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=xxx +ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY=xxx +``` + diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..8b65904 --- /dev/null +++ b/compose.yml @@ -0,0 +1,68 @@ +services: + ms_db: + restart: always + image: postgres:14-alpine + shm_size: 256mb + networks: + - internal_network + healthcheck: + test: ['CMD', 'pg_isready', '-U', 'postgres'] + volumes: + - ./postgres14:/var/lib/postgresql/data + environment: + - POSTGRES_HOST_AUTH_METHOD=trust + - POSTGRES_PASSWORD=xxx + - PGPORT=5432 + + ms_redis: + restart: always + image: redis:7-alpine + networks: + - internal_network + healthcheck: + test: ['CMD', 'redis-cli', 'ping'] + volumes: + - ./redis:/data + + mastodon: + build: . + image: tootsuite/mastodon:edge + restart: always + env_file: .env.production + command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000" + networks: + - external_network + - internal_network + healthcheck: + # prettier-ignore + test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1'] + ports: + - '0.0.0.0:3000:3000' + depends_on: + - ms_db + - ms_redis + # - es + volumes: + - ./public/system:/mastodon/public/system + + sidekiq: + build: . + image: tootsuite/mastodon:edge + restart: always + env_file: .env.production + command: bundle exec sidekiq + depends_on: + - ms_db + - ms_redis + networks: + - external_network + - internal_network + volumes: + - ./public/system:/mastodon/public/system + healthcheck: + test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"] + +networks: + external_network: + internal_network: + internal: true