Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit 3e4b01b

Browse files
danhunsakerGargron
authored andcommitted
[Nanobox] Apply Release Notes Changes (mastodon#5670)
Apparently I missed some things in earlier commits/releases that needed to be applied to the Nanobox setup. All minor things, nothing that breaks anything, but still best to get them in place. - Move cron jobs to their own component, so the Sidekiq component can be scaled up to multiple instances without causing issues with running the same cron job multiple times at once. - Update cron jobs to the latest requirements, removing extraneous ones - Add new variables to `.env.nanobox` - Update Nginx to use correct cache header directives
1 parent 19e8b86 commit 3e4b01b

File tree

3 files changed

+95
-24
lines changed

3 files changed

+95
-24
lines changed

.env.nanobox

+29-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ PAPERCLIP_SECRET=$PAPERCLIP_SECRET
3535
SECRET_KEY_BASE=$SECRET_KEY_BASE
3636
OTP_SECRET=$OTP_SECRET
3737

38+
# VAPID keys (used for push notifications)
39+
# You can generate the keys using the following command (first is the private key, second is the public one)
40+
# You should only generate this once per instance. If you later decide to change it, all push subscription will
41+
# be invalidated, requiring the users to access the website again to resubscribe.
42+
#
43+
# Generate with `rake mastodon:webpush:generate_vapid_key` task (`nanobox run bundle exec rake mastodon:webpush:generate_vapid_key`)
44+
#
45+
# For more information visit https://rossta.net/blog/using-the-web-push-api-with-vapid.html
46+
VAPID_PRIVATE_KEY=$VAPID_PRIVATE_KEY
47+
VAPID_PUBLIC_KEY=$VAPID_PUBLIC_KEY
48+
3849
# Registrations
3950
# Single user mode will disable registrations and redirect frontpage to the first profile
4051
# SINGLE_USER_MODE=true
@@ -62,7 +73,7 @@ SMTP_FROM_ADDRESS=notifications@${APP_NAME}.nanoapp.io
6273
#SMTP_CA_FILE=/etc/ssl/certs/ca-certificates.crt
6374
#SMTP_OPENSSL_VERIFY_MODE=peer
6475
#SMTP_ENABLE_STARTTLS_AUTO=true
65-
76+
#SMTP_TLS=true
6677

6778
# Optional user upload path and URL (images, avatars). Default is :rails_root/public/system. If you set this variable, you are responsible for making your HTTP server (eg. nginx) serve these files.
6879
# PAPERCLIP_ROOT_PATH=/var/lib/mastodon/public-system
@@ -91,6 +102,23 @@ SMTP_FROM_ADDRESS=notifications@${APP_NAME}.nanoapp.io
91102
# S3_ENDPOINT=
92103
# S3_SIGNATURE_VERSION=
93104

105+
# Swift (optional)
106+
# SWIFT_ENABLED=true
107+
# SWIFT_USERNAME=
108+
# For Keystone V3, the value for SWIFT_TENANT should be the project name
109+
# SWIFT_TENANT=
110+
# SWIFT_PASSWORD=
111+
# Keystone V2 and V3 URLs are supported. Use a V3 URL if possible to avoid
112+
# issues with token rate-limiting during high load.
113+
# SWIFT_AUTH_URL=
114+
# SWIFT_CONTAINER=
115+
# SWIFT_OBJECT_URL=
116+
# SWIFT_REGION=
117+
# Defaults to 'default'
118+
# SWIFT_DOMAIN_NAME=
119+
# Defaults to 60 seconds. Set to 0 to disable
120+
# SWIFT_CACHE_TTL=
121+
94122
# Optional alias for S3 if you want to use Cloudfront or Cloudflare in front
95123
# S3_CLOUDFRONT_HOST=
96124

boxfile.yml

+60-22
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ run.config:
4242

4343
fs_watch: true
4444

45+
4546
deploy.config:
4647
extra_steps:
4748
- NODE_ENV=production bundle exec rake assets:precompile
@@ -60,6 +61,7 @@ deploy.config:
6061
web.web:
6162
- bundle exec rake db:migrate:setup
6263

64+
6365
web.web:
6466
start:
6567
nginx: nginx -c /app/nanobox/nginx-web.conf
@@ -78,6 +80,7 @@ web.web:
7880
data.storage:
7981
- public/system
8082

83+
8184
web.stream:
8285
start:
8386
nginx: nginx -c /app/nanobox/nginx-stream.conf
@@ -91,8 +94,13 @@ web.stream:
9194
writable_dirs:
9295
- tmp
9396

97+
9498
worker.sidekiq:
95-
start: bundle exec sidekiq -c 5 -q default -q mailers -q pull -q push -L /app/log/sidekiq.log
99+
start:
100+
default: bundle exec sidekiq -c 5 -q default -L /app/log/sidekiq.log
101+
mailers: bundle exec sidekiq -c 5 -q mailers -L /app/log/sidekiq.log
102+
pull: bundle exec sidekiq -c 5 -q pull -L /app/log/sidekiq.log
103+
push: bundle exec sidekiq -c 5 -q push -L /app/log/sidekiq.log
96104

97105
writable_dirs:
98106
- tmp
@@ -105,50 +113,78 @@ worker.sidekiq:
105113
data.storage:
106114
- public/system
107115

108-
cron:
109-
- id: generate_static_gifs
110-
schedule: '*/15 * * * *'
111-
command: 'bundle exec rake mastodon:maintenance:add_static_avatars'
112116

113-
- id: update_counter_caches
114-
schedule: '50 * * * *'
115-
command: 'bundle exec rake mastodon:maintenance:update_counter_caches'
117+
worker.cron_only:
118+
start: sleep 365d
119+
120+
writable_dirs:
121+
- tmp
122+
123+
log_watch:
124+
rake: 'log/production.log'
116125

117-
# runs feeds:clear, media:clear, users:clear, and push:refresh
118-
- id: do_daily_tasks
119-
schedule: '00 00 * * *'
120-
command: 'bundle exec rake mastodon:daily'
126+
network_dirs:
127+
data.storage:
128+
- public/system
121129

122-
- id: clear_silenced_media
123-
schedule: '10 00 * * *'
124-
command: 'bundle exec rake mastodon:media:remove_silenced'
130+
cron:
131+
# 20:00 (8 pm), server time: send out the daily digest emails to everyone
132+
# who opted to receive one
133+
- id: send_digest_emails
134+
schedule: '00 20 * * *'
135+
command: 'bundle exec rake mastodon:emails:digest'
125136

137+
# 00:10 (ten past midnight), server time: remove local copies of remote
138+
# users' media once they are older than a certain age (use NUM_DAYS evar to
139+
# change this from the default of 7 days)
126140
- id: clear_remote_media
127-
schedule: '20 00 * * *'
141+
schedule: '10 00 * * *'
128142
command: 'bundle exec rake mastodon:media:remove_remote'
129143

144+
# 00:20 (twenty past midnight), server time: remove subscriptions to remote
145+
# users that nobody follows locally (anymore)
130146
- id: clear_unfollowed_subs
131-
schedule: '30 00 * * *'
147+
schedule: '20 00 * * *'
132148
command: 'bundle exec rake mastodon:push:clear'
133149

134-
- id: send_digest_emails
135-
schedule: '00 20 * * *'
136-
command: 'bundle exec rake mastodon:emails:digest'
137-
150+
# 00:30 (half past midnight), server time: update local copies of remote
151+
# users' avatars to match whatever they currently have set on their profile
152+
- id: update_remote_avatars
153+
schedule: '30 00 * * *'
154+
command: 'bundle exec rake mastodon:media:redownload_avatars'
155+
156+
############################################################################
157+
# This task is one you might want to enable, or might not. It keeps disk
158+
# usage low, but makes "shadow bans" (scenarios where the user is silenced,
159+
# but not intended to be made aware that the silencing has occurred) much
160+
# more difficult to put in place, as users would then notice their media is
161+
# vanishing on a regular basis. Enable it if you aren't worried about users
162+
# knowing they've been silenced (on the instance level), and want to save
163+
# disk space. Leave it disabled otherwise.
164+
############################################################################
165+
# # 00:00 (midnight), server time: remove media posted by silenced users
166+
# - id: clear_silenced_media
167+
# schedule: '00 00 * * *'
168+
# command: 'bundle exec rake mastodon:media:remove_silenced'
169+
170+
############################################################################
138171
# The following two tasks can be uncommented to automatically open and close
139172
# registrations on a schedule. The format of 'schedule' is a standard cron
140173
# time expression: minute hour day month day-of-week; search for "cron
141174
# time expressions" for more info on how to set these up. The examples here
142175
# open registration only from 8 am to 4 pm, server time.
143-
#
176+
############################################################################
177+
# # 08:00 (8 am), server time: open registrations so new users can join
144178
# - id: open_registrations
145179
# schedule: '00 08 * * *'
146180
# command: 'bundle exec rake mastodon:settings:open_registrations'
147181
#
182+
# # 16:00 (4 pm), server time: close registrations so new users *can't* join
148183
# - id: close_registrations
149184
# schedule: '00 16 * * *'
150185
# command: 'bundle exec rake mastodon:settings:close_registrations'
151186

187+
152188
data.db:
153189
image: nanobox/postgresql:9.5
154190

@@ -170,6 +206,7 @@ data.db:
170206
curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/${file} -X DELETE
171207
done
172208
209+
173210
data.redis:
174211
image: nanobox/redis:3.0
175212

@@ -189,6 +226,7 @@ data.redis:
189226
curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/${file} -X DELETE
190227
done
191228
229+
192230
data.storage:
193231
image: nanobox/unfs:0.9
194232

nanobox/nginx-web.conf.erb

+6-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ http {
4242
try_files $uri @rails;
4343
}
4444

45-
location ~ ^/(assets|system/media_attachments/files|system/accounts/avatars) {
45+
location /sw.js {
46+
add_header Cache-Control "public, max-age=0";
47+
try_files $uri @rails;
48+
}
49+
50+
location ~ ^/(emoji|packs|system/media_attachments/files|system/accounts/avatars) {
4651
add_header Cache-Control "public, max-age=31536000, immutable";
4752
try_files $uri @rails;
4853
}

0 commit comments

Comments
 (0)