1
0
This commit is contained in:
syui 2024-05-21 11:00:20 +09:00
parent 7a785b6264
commit 654e31e138
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56
4 changed files with 104 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.env*

9
Dockerfile Normal file
View File

@ -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 ghcr.io/mastodon/mastodon:edge
ENV PORT 8080
ENV BIND 0.0.0.0
ENTRYPOINT []

View File

@ -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
```

68
compose.yml Normal file
View File

@ -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: ghcr.io/mastodon/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: ghcr.io/mastodon/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