18 # to prep the .env file:
21 # for node-gyp, used in the asset compilation process:
41 - cp .env.nanobox .env
49 - NODE_ENV=production bundle exec rake assets:precompile
51 - "envsubst < /app/.env.nanobox > /app/.env.production"
53 if [ -z "$LOCAL_DOMAIN" ]
55 . /app/.env.production
58 erb /app/nanobox/nginx-web.conf.erb > /app/nanobox/nginx-web.conf
59 erb /app/nanobox/nginx-stream.conf.erb > /app/nanobox/nginx-stream.conf
60 - touch /app/log/production.log
63 - bundle exec rake db:migrate:setup
65 if [[ "${ES_ENABLED}" != "false" ]]
67 bundle exec rake chewy:deploy
73 nginx: nginx -c /app/nanobox/nginx-web.conf
74 rails: bundle exec puma -C /app/config/puma.rb
83 rails: 'log/production.log'
92 nginx: nginx -c /app/nanobox/nginx-stream.conf
96 - '/api/v1/streaming*'
97 # Somehow we're getting requests for scheme://domain//api/v1/streaming* - match those, too
98 - '//api/v1/streaming*'
106 default: bundle exec sidekiq -c 5 -q default -L /app/log/sidekiq.log
107 mailers: bundle exec sidekiq -c 5 -q mailers -L /app/log/sidekiq.log
108 pull: bundle exec sidekiq -c 5 -q pull -L /app/log/sidekiq.log
109 push: bundle exec sidekiq -c 5 -q push -L /app/log/sidekiq.log
115 rails: 'log/production.log'
116 sidekiq: 'log/sidekiq.log'
130 rake: 'log/production.log'
137 # 20:00 (8 pm), server time: send out the daily digest emails to everyone
138 # who opted to receive one
139 - id: send_digest_emails
140 schedule: '00 20 * * *'
141 command: 'bundle exec rake mastodon:emails:digest'
143 # 00:10 (ten past midnight), server time: remove local copies of remote
144 # users' media once they are older than a certain age (use NUM_DAYS evar to
145 # change this from the default of 7 days)
146 - id: clear_remote_media
147 schedule: '10 00 * * *'
148 command: 'bundle exec rake mastodon:media:remove_remote'
150 # 00:20 (twenty past midnight), server time: remove subscriptions to remote
151 # users that nobody follows locally (anymore)
152 - id: clear_unfollowed_subs
153 schedule: '20 00 * * *'
154 command: 'bundle exec rake mastodon:push:clear'
156 # 00:30 (half past midnight), server time: update local copies of remote
157 # users' avatars to match whatever they currently have set on their profile
158 - id: update_remote_avatars
159 schedule: '30 00 * * *'
160 command: 'bundle exec rake mastodon:media:redownload_avatars'
162 ############################################################################
163 # This task is one you might want to enable, or might not. It keeps disk
164 # usage low, but makes "shadow bans" (scenarios where the user is silenced,
165 # but not intended to be made aware that the silencing has occurred) much
166 # more difficult to put in place, as users would then notice their media is
167 # vanishing on a regular basis. Enable it if you aren't worried about users
168 # knowing they've been silenced (on the instance level), and want to save
169 # disk space. Leave it disabled otherwise.
170 ############################################################################
171 # # 00:00 (midnight), server time: remove media posted by silenced users
172 # - id: clear_silenced_media
173 # schedule: '00 00 * * *'
174 # command: 'bundle exec rake mastodon:media:remove_silenced'
176 ############################################################################
177 # The following two tasks can be uncommented to automatically open and close
178 # registrations on a schedule. The format of 'schedule' is a standard cron
179 # time expression: minute hour day month day-of-week; search for "cron
180 # time expressions" for more info on how to set these up. The examples here
181 # open registration only from 8 am to 4 pm, server time.
182 ############################################################################
183 # # 08:00 (8 am), server time: open registrations so new users can join
184 # - id: open_registrations
185 # schedule: '00 08 * * *'
186 # command: 'bundle exec rake mastodon:settings:open_registrations'
188 # # 16:00 (4 pm), server time: close registrations so new users *can't* join
189 # - id: close_registrations
190 # schedule: '00 16 * * *'
191 # command: 'bundle exec rake mastodon:settings:close_registrations'
195 image: nanobox/postgresql:9.6
199 schedule: '0 3 * * *'
201 PGPASSWORD=${DATA_DB_PASS} pg_dump -U ${DATA_DB_USER} -w -Fc -O gonano |
203 curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/backup-${HOSTNAME}-$(date -u +%Y-%m-%d.%H-%M-%S).sql.gz -X POST -T - >&2
204 curl -k -s -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/ |
208 head -n-${BACKUP_COUNT:-1} |
209 sed 's/.*: \?"\(.*\)".*/\1/' |
212 curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/${file} -X DELETE
217 image: nanobox/elasticsearch:5
221 schedule: '0 3 * * *'
223 id=$(cat /proc/sys/kernel/random/uuid)
224 curl -X PUT -H "Content-Type: application/json" "127.0.0.1:9200/_snapshot/${id}" -d "{\"type\": \"fs\",\"settings\": {\"location\": \"/var/tmp/${id}\",\"compress\": true}}"
225 curl -X PUT -H "Content-Type: application/json" "127.0.0.1:9200/_snapshot/${id}/backup?wait_for_completion=true&pretty"
226 tar -cz -C "/var/tmp/${id}" . |
227 curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/backup-${HOSTNAME}-$(date -u +%Y-%m-%d.%H-%M-%S).tgz -X POST -T - >&2
228 curl -X DELETE -H "Content-Type: application/json" "127.0.0.1:9200/_snapshot/${id}"
229 rm -rf "/var/tmp/${id}"
230 curl -k -s -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/ |
234 head -n-${BACKUP_COUNT:-1} |
235 sed 's/.*: \?"\(.*\)".*/\1/' |
238 curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/${file} -X DELETE
243 image: nanobox/redis:4.0
247 schedule: '0 3 * * *'
249 curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/backup-${HOSTNAME}-$(date -u +%Y-%m-%d.%H-%M-%S).rdb -X POST -T /data/var/db/redis/dump.rdb >&2
250 curl -k -s -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/ |
254 head -n-${BACKUP_COUNT:-1} |
255 sed 's/.*: \?"\(.*\)".*/\1/' |
258 curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/${file} -X DELETE
263 image: nanobox/unfs:0.9
267 schedule: '0 3 * * *'
269 tar cz -C /data/var/db/unfs/ . |
270 curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/backup-${HOSTNAME}-$(date -u +%Y-%m-%d.%H-%M-%S).tgz -X POST -T - >&2
271 curl -k -s -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/ |
275 head -n-${BACKUP_COUNT:-1} |
276 sed 's/.*: \?"\(.*\)".*/\1/' |
279 curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/${file} -X DELETE