Skip to content

Commit

Permalink
Preparing to change the platform
Browse files Browse the repository at this point in the history
  • Loading branch information
orlea committed May 25, 2020
1 parent 4145d5b commit 9fa70be
Show file tree
Hide file tree
Showing 11 changed files with 101 additions and 191 deletions.
12 changes: 9 additions & 3 deletions README.md
@@ -1,17 +1,23 @@
# mstdn.asterism.xyz

on docker swarm
on docker and native postgresql/redis.

## usage

stack deploy
deploy

```
sudo docker stack deploy mastodon -c mastodon/mstdn-asterism-xyz.yml
cd caddy
sudo docker-compose up -d
cd ../mastodon
sudo docker-compose up -d
```

update

```
sudo docker-compose -f mastodon/mstdn-asterism-xyz.manage.yml run --rm web rails db:migrate
cd mastodon
sudo docker-compose down
sudo docker-compose up -d
```
62 changes: 62 additions & 0 deletions caddy/Caddyfile
@@ -0,0 +1,62 @@

{
email admin@asterism.xyz
}

https://mstdn.asterism.xyz {
@local {
file
}
@local_media {
path_regexp /system/(.*)
}
@streaming {
path /api/v1/streaming/*
}
@cache_control {
path_regexp ^/(emoji|packs|/system/accounts/avatars|/system/media_attachments/files)
}

root * /home/mastodon/live/public
log {
output file /var/log/caddy/mastodon.log
}

encode zstd gzip

handle_errors {
rewrite 500.html
file_server
}

header {
Strict-Transport-Security "max-age=31536000"
}
header /sw.js Cache-Control "public, max-age=0"
header @cache_control Cache-Control "public, max-age=31536000, immutable"

handle @local {
file_server
}

reverse_proxy @streaming {
to http://streaming:4000

transport http {
keepalive 5s
keepalive_idle_conns 10
}
}

reverse_proxy {
to http://web:3000

header_up X-Forwarded-Port 443
header_up X-Forwarded-Proto https

transport http {
keepalive 5s
keepalive_idle_conns 10
}
}
}
21 changes: 21 additions & 0 deletions caddy/docker-compose.yml
@@ -0,0 +1,21 @@
version: "3"
services:
caddy:
image: caddy:2-alpine
environment:
- ACME_AGREE=true
ports:
- 443:443
- 80:80
networks:
- private
- public
volumes:
- /caddy_data:/data
- ./Caddyfile:/etc/caddy/Caddyfile
- /var/log/caddy:/var/log/caddy

networks:
private:
public:
external: true
File renamed without changes.
File renamed without changes.
File renamed without changes
14 changes: 0 additions & 14 deletions elasticsearch/Dockerfile

This file was deleted.

25 changes: 0 additions & 25 deletions elasticsearch/elasticsearch.yml

This file was deleted.

25 changes: 9 additions & 16 deletions mastodon/mstdn-asterism-xyz.yml → mastodon/docker-compose.yml
Expand Up @@ -3,10 +3,6 @@ services:
web:
image: tootsuite/mastodon:v3.1.4
deploy:
replicas: 2
placement:
constraints:
- node.role == worker
resources:
limits:
memory: 1G
Expand All @@ -16,15 +12,11 @@ services:
command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
healthcheck:
test: ["CMD-SHELL", "wget -q --spider --proxy=off localhost:3000/health || exit 1"]
ports:
- "127.0.0.1:3000:3000"
networks:
- private
streaming:
image: tootsuite/mastodon:v3.1.4
deploy:
replicas: 1
placement:
constraints:
- node.role == worker
resources:
limits:
memory: 128M
Expand All @@ -34,19 +26,20 @@ services:
command: node ./streaming
healthcheck:
test: ["CMD-SHELL", "wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1"]
ports:
- "127.0.0.1:4000:4000"
networks:
- private
sidekiq:
image: tootsuite/mastodon:v3.1.4
deploy:
replicas: 1
placement:
constraints:
- node.role == worker
resources:
limits:
memory: 512M
reservations:
memory: 512M
env_file: .env.production
command: bundle exec sidekiq -c 10
networks:
- private

networks:
private:
9 changes: 0 additions & 9 deletions mastodon/script/mstdn-backup.sh

This file was deleted.

124 changes: 0 additions & 124 deletions nginx/mastodon.conf

This file was deleted.

0 comments on commit 9fa70be

Please sign in to comment.