-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
148 lines (140 loc) · 3.67 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
services:
caddy:
container_name: mastodon-caddy
build:
context: ./src/caddy
restart: unless-stopped
security_opt:
- no-new-privileges:true
network_mode: "host"
volumes:
- ../persistent-data/caddy/data:/data
- ../persistent-data/caddy/config:/config
cdn:
container_name: mastodon-cdn
build:
context: ./src/picocache
restart: unless-stopped
security_opt:
- no-new-privileges:true
env_file: env.production
ports:
- '127.0.0.1:6000:8080'
networks:
- external_network
volumes:
- ../persistent-data/mastodon/cdn:/var/cache/cdncache
redis:
container_name: mastodon-redis
restart: unless-stopped
image: redis:7-alpine
security_opt:
- no-new-privileges:true
networks:
- internal_network
volumes:
- ../persistent-data/mastodon/redis:/data
web:
container_name: mastodon-web
restart: unless-stopped
build:
context: ./src/mastodon-r3
dockerfile: ./Dockerfile
security_opt:
- no-new-privileges:true
env_file: env.production
command: bundle exec puma -C config/puma.rb
networks:
- external_network
- internal_network
ports:
- '127.0.0.1:3000:3000'
depends_on:
- db
- redis
volumes:
- ../persistent-data/mastodon/emojis:/emojis
sidekiq:
container_name: mastodon-sidekiq
restart: unless-stopped
build:
context: ./src/mastodon-r3
dockerfile: ./Dockerfile
security_opt:
- no-new-privileges:true
env_file: env.production
command: bundle exec sidekiq -c 20
networks:
- external_network
- internal_network
depends_on:
- db
- redis
streaming:
container_name: mastodon-streaming
restart: unless-stopped
build:
context: ./src/mastodon-r3
dockerfile: ./streaming/Dockerfile
security_opt:
- no-new-privileges:true
env_file: env.production
command: node ./streaming/index.js
networks:
- external_network
- internal_network
ports:
- '127.0.0.1:4000:4000'
depends_on:
- db
- redis
db:
container_name: mastodon-db
restart: unless-stopped
image: postgres:16-alpine
security_opt:
- no-new-privileges:true
environment:
- 'PGDATA=/var/lib/postgresql/data/pgdata'
env_file: env.production
shm_size: 256mb
networks:
- internal_network
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
volumes:
- ../persistent-data/mastodon/postgres:/var/lib/postgresql/data/pgdata
- ../persistent-data/mastodon/postgres-srv:/srv
networks:
external_network:
internal_network:
internal: true
## Some useful commands
## First setup
# docker compose run --rm -e RAILS_ENV=production web rails db:setup
#
# docker compose run --rm web tootctl accounts modify Miaourt --role admin
#
## Backup Database
# docker compose exec postgres pg_dump -Fc -U mastodon mastodon -f /srv/dump.sql
#
## Restore Database
# pg_restore -v -U mastodon -d mastodon -Fc /srv/dump.sql
#
## Migrate Database
# docker compose run --rm web rails db:migrate
#
## Grab all users emails if u need to send an important message
# docker compose run web rails r "puts *User.confirmed.pluck(:email)"
#
## Emojis
# tootctl emoji import /emojis/Meowmoji.tar.gz --category Meowmojis
#
## Prune cached media
# docker compose exec -e RAILS_ENV=production web tootctl media remove -c 10
#
## Prune cached thumbnails
# docker compose exec -e RAILS_ENV=production web tootctl preview_cards remove --days 15 --verbose
#
## Remove orphaned media
# docker compose exec -e RAILS_ENV=production web tootctl media remove-orphans --verbose