diff --git a/config/sidekiq.yml b/config/sidekiq.yml index 59dfeaf975..6a09bb6e9a 100644 --- a/config/sidekiq.yml +++ b/config/sidekiq.yml @@ -1,10 +1,10 @@ --- :concurrency: 5 :queues: - - default - - push - - mailers - - pull + - [default, 6] + - [push, 4] + - [mailers, 2] + - [pull] :schedule: subscriptions_scheduler: cron: '<%= Random.rand(0..59) %> <%= Random.rand(4..6) %> * * *' diff --git a/dist/mastodon-sidekiq.service b/dist/mastodon-sidekiq.service new file mode 100644 index 0000000000..721a866090 --- /dev/null +++ b/dist/mastodon-sidekiq.service @@ -0,0 +1,17 @@ +[Unit] +Description=mastodon-sidekiq +After=network.target + +[Service] +Type=simple +User=mastodon +WorkingDirectory=/home/mastodon/live +Environment="RAILS_ENV=production" +Environment="DB_POOL=25" +Environment="MALLOC_ARENA_MAX=2" +ExecStart=/home/mastodon/.rbenv/shims/bundle exec sidekiq -c 25 +TimeoutSec=15 +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/dist/mastodon-streaming.service b/dist/mastodon-streaming.service new file mode 100644 index 0000000000..5d7c129dfb --- /dev/null +++ b/dist/mastodon-streaming.service @@ -0,0 +1,17 @@ +[Unit] +Description=mastodon-streaming +After=network.target + +[Service] +Type=simple +User=mastodon +WorkingDirectory=/home/mastodon/live +Environment="NODE_ENV=production" +Environment="PORT=4000" +Environment="STREAMING_CLUSTER_NUM=1" +ExecStart=/usr/bin/npm run start +TimeoutSec=15 +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/dist/mastodon-web.service b/dist/mastodon-web.service new file mode 100644 index 0000000000..30fcbec1e0 --- /dev/null +++ b/dist/mastodon-web.service @@ -0,0 +1,17 @@ +[Unit] +Description=mastodon-web +After=network.target + +[Service] +Type=simple +User=mastodon +WorkingDirectory=/home/mastodon/live +Environment="RAILS_ENV=production" +Environment="PORT=3000" +ExecStart=/home/mastodon/.rbenv/shims/bundle exec puma -C config/puma.rb +ExecReload=/bin/kill -SIGUSR1 $MAINPID +TimeoutSec=15 +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/dist/nginx.conf b/dist/nginx.conf new file mode 100644 index 0000000000..3d57417657 --- /dev/null +++ b/dist/nginx.conf @@ -0,0 +1,106 @@ +map $http_upgrade $connection_upgrade { + default upgrade; + '' close; +} + +proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=CACHE:10m inactive=7d max_size=1g; + +server { + listen 80; + listen [::]:80; + server_name example.com; + root /home/mastodon/live/public; + location /.well-known/acme-challenge/ { allow all; } + location / { return 301 https://$host$request_uri; } +} + +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + server_name example.com; + + ssl_protocols TLSv1.2; + ssl_ciphers HIGH:!MEDIUM:!LOW:!aNULL:!NULL:!SHA; + ssl_prefer_server_ciphers on; + ssl_session_cache shared:SSL:10m; + + # Uncomment these lines once you acquire a certificate: + # ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; + # ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; + + keepalive_timeout 70; + sendfile on; + client_max_body_size 80m; + + root /home/mastodon/live/public; + + gzip on; + gzip_disable "msie6"; + gzip_vary on; + gzip_proxied any; + gzip_comp_level 6; + gzip_buffers 16 8k; + gzip_http_version 1.1; + gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; + + add_header Strict-Transport-Security "max-age=31536000"; + + location / { + try_files $uri @proxy; + } + + location ~ ^/(emoji|packs|system/accounts/avatars|system/media_attachments/files) { + add_header Cache-Control "public, max-age=31536000, immutable"; + add_header Strict-Transport-Security "max-age=31536000"; + try_files $uri @proxy; + } + + location /sw.js { + add_header Cache-Control "public, max-age=0"; + add_header Strict-Transport-Security "max-age=31536000"; + try_files $uri @proxy; + } + + location @proxy { + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; + proxy_set_header Proxy ""; + proxy_pass_header Server; + + proxy_pass http://127.0.0.1:3000; + proxy_buffering on; + proxy_redirect off; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + + proxy_cache CACHE; + proxy_cache_valid 200 7d; + proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504; + add_header X-Cached $upstream_cache_status; + add_header Strict-Transport-Security "max-age=31536000"; + + tcp_nodelay on; + } + + location /api/v1/streaming { + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; + proxy_set_header Proxy ""; + + proxy_pass http://127.0.0.1:4000; + proxy_buffering off; + proxy_redirect off; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + + tcp_nodelay on; + } + + error_page 500 501 502 503 504 /500.html; +} diff --git a/docs/Contributing-to-Mastodon/Sponsors.md b/docs/Contributing-to-Mastodon/Sponsors.md deleted file mode 100644 index 8fc22b6bbd..0000000000 --- a/docs/Contributing-to-Mastodon/Sponsors.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Contributing-to-Mastodon/Sponsors.md) diff --git a/docs/Contributing-to-Mastodon/Translating.md b/docs/Contributing-to-Mastodon/Translating.md deleted file mode 100644 index 1671645eea..0000000000 --- a/docs/Contributing-to-Mastodon/Translating.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Contributing-to-Mastodon/Translating.md) diff --git a/docs/Extensions.md b/docs/Extensions.md deleted file mode 100644 index be4c6eabd7..0000000000 --- a/docs/Extensions.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Extensions.md) diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index 63bcf5a248..0000000000 --- a/docs/README.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/README.md) diff --git a/docs/Running-Mastodon/Administration-guide.md b/docs/Running-Mastodon/Administration-guide.md deleted file mode 100644 index e7571be3a2..0000000000 --- a/docs/Running-Mastodon/Administration-guide.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Administration-guide.md) diff --git a/docs/Running-Mastodon/Development-guide.md b/docs/Running-Mastodon/Development-guide.md deleted file mode 100644 index 10ed640875..0000000000 --- a/docs/Running-Mastodon/Development-guide.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Development-guide.md) diff --git a/docs/Running-Mastodon/Heroku-guide.md b/docs/Running-Mastodon/Heroku-guide.md deleted file mode 100644 index aa5abc1f55..0000000000 --- a/docs/Running-Mastodon/Heroku-guide.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Heroku-guide.md) diff --git a/docs/Running-Mastodon/Production-guide.md b/docs/Running-Mastodon/Production-guide.md deleted file mode 100644 index 08649e9ce5..0000000000 --- a/docs/Running-Mastodon/Production-guide.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md) diff --git a/docs/Running-Mastodon/Scalingo-guide.md b/docs/Running-Mastodon/Scalingo-guide.md deleted file mode 100644 index 8c986f7509..0000000000 --- a/docs/Running-Mastodon/Scalingo-guide.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Scalingo-guide.md) diff --git a/docs/Running-Mastodon/Tuning.md b/docs/Running-Mastodon/Tuning.md deleted file mode 100644 index 5e5474194a..0000000000 --- a/docs/Running-Mastodon/Tuning.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md) diff --git a/docs/Running-Mastodon/Vagrant-guide.md b/docs/Running-Mastodon/Vagrant-guide.md deleted file mode 100644 index c5823b09b2..0000000000 --- a/docs/Running-Mastodon/Vagrant-guide.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Vagrant-guide.md) diff --git a/docs/Specs-and-RFCs-used.md b/docs/Specs-and-RFCs-used.md deleted file mode 100644 index 89a4dd313e..0000000000 --- a/docs/Specs-and-RFCs-used.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Specs-and-RFCs-used.md) diff --git a/docs/Using-Mastodon/2FA.md b/docs/Using-Mastodon/2FA.md deleted file mode 100644 index d5c6985b70..0000000000 --- a/docs/Using-Mastodon/2FA.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/2FA.md) diff --git a/docs/Using-Mastodon/Apps.md b/docs/Using-Mastodon/Apps.md deleted file mode 100644 index c2ced44576..0000000000 --- a/docs/Using-Mastodon/Apps.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/Apps.md) diff --git a/docs/Using-Mastodon/FAQ.md b/docs/Using-Mastodon/FAQ.md deleted file mode 100644 index d50e63b93d..0000000000 --- a/docs/Using-Mastodon/FAQ.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/FAQ.md) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md deleted file mode 100644 index 0e2d08643e..0000000000 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/List-of-Mastodon-instances.md) diff --git a/docs/Using-Mastodon/User-guide.md b/docs/Using-Mastodon/User-guide.md deleted file mode 100644 index 7ef5a117b0..0000000000 --- a/docs/Using-Mastodon/User-guide.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/User-guide.md) diff --git a/docs/Using-the-API/API.md b/docs/Using-the-API/API.md deleted file mode 100644 index 6de61e1961..0000000000 --- a/docs/Using-the-API/API.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md) diff --git a/docs/Using-the-API/OAuth-details.md b/docs/Using-the-API/OAuth-details.md deleted file mode 100644 index 6a6926bb9c..0000000000 --- a/docs/Using-the-API/OAuth-details.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-the-API/OAuth-details.md) diff --git a/docs/Using-the-API/Push-notifications.md b/docs/Using-the-API/Push-notifications.md deleted file mode 100644 index 3292c0a6e4..0000000000 --- a/docs/Using-the-API/Push-notifications.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-the-API/Push-notifications.md) diff --git a/docs/Using-the-API/Streaming-API.md b/docs/Using-the-API/Streaming-API.md deleted file mode 100644 index 482f901c0f..0000000000 --- a/docs/Using-the-API/Streaming-API.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-the-API/Streaming-API.md) diff --git a/docs/Using-the-API/Testing-with-cURL.md b/docs/Using-the-API/Testing-with-cURL.md deleted file mode 100644 index 04c7c87b2d..0000000000 --- a/docs/Using-the-API/Testing-with-cURL.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-the-API/Testing-with-cURL.md) diff --git a/docs/Using-the-API/Tips-for-app-developers.md b/docs/Using-the-API/Tips-for-app-developers.md deleted file mode 100644 index 36a28da2ea..0000000000 --- a/docs/Using-the-API/Tips-for-app-developers.md +++ /dev/null @@ -1 +0,0 @@ -[The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-the-API/Tips-for-app-developers.md)