Removed server_ for better overview

This commit is contained in:
2023-08-22 22:53:44 +02:00
parent 571bed27a3
commit 4254642313
246 changed files with 45 additions and 45 deletions

View File

@@ -0,0 +1,32 @@
# docker mastodon
## create configuration
```bash
docker-compose run --rm web bundle exec rake mastodon:setup
```
## cleanup
```bash
cd {{path_docker_compose_files}}mastodon/
docker-compose down
docker volume rm mastodon_data mastodon_database mastodon_redis
cd {{path_docker_compose_files}} &&
rm -vR {{path_docker_compose_files}}mastodon
```
## access terminal
```bash
docker exec -it mastodon-web-1 /bin/bash
```
## set rights
After setting up mastodon you need to give the rights
```bash
docker exec -it -u root mastodon-web-1 chown -R 991:991 public
```
## further information
- https://goneuland.de/mastodon-mit-server_docker-und-traefik-installieren/
- https://gist.github.com/TrillCyborg/84939cd4013ace9960031b803a0590c4
- https://www.2daygeek.com/linux-command-check-website-is-up-down-alive/
- https://vitobotta.com/2022/11/07/setting-up-a-personal-mastodon-instance/

View File

@@ -0,0 +1,8 @@
---
- name: recreate mastodon
command:
cmd: docker-compose -p mastodon up -d --force-recreate
chdir: "{{docker_compose_mastodon_path}}"
environment:
COMPOSE_HTTP_TIMEOUT: 600
DOCKER_CLIENT_TIMEOUT: 600

View File

@@ -0,0 +1,2 @@
dependencies:
- server_native-docker-reverse-proxy

View File

@@ -0,0 +1,24 @@
---
- name: recieve {{domain}} certificate
command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}}
- name: configure {{domain}}.conf
template: src=templates/mastodon.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf
notify: restart nginx
- name: "create {{docker_compose_mastodon_path}}"
file:
path: "{{docker_compose_mastodon_path}}"
state: directory
mode: 0755
- name: copy docker-compose.yml
template: src=docker-compose.yml.j2 dest={{docker_compose_mastodon_path}}docker-compose.yml
notify: recreate mastodon
- name: copy configuration
template:
src: .env.production.j2
dest: "{{docker_compose_mastodon_path}}.env.production"
force: no
notify: recreate mastodon

View File

@@ -0,0 +1,22 @@
LOCAL_DOMAIN={{domain}}
SINGLE_USER_MODE={{mastodon_single_user_mode}}
SECRET_KEY_BASE={{mastodon_secret_key_base}}
OTP_SECRET={{mastodon_otp_secret}}
VAPID_PRIVATE_KEY={{mastodon_vapid_private_key}}
VAPID_PUBLIC_KEY={{mastodon_vapid_public_key}}
DB_HOST=database
DB_PORT=5432
DB_NAME=postgres
DB_USER=postgres
DB_PASS=
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_PASSWORD=
SMTP_SERVER={{system_email_host}}
SMTP_PORT={{system_email_port}}
SMTP_LOGIN={{system_email_username}}
SMTP_PASSWORD={{system_email_password}}
SMTP_AUTH_METHOD=plain
SMTP_OPENSSL_VERIFY_MODE=none
SMTP_ENABLE_STARTTLS=auto
SMTP_FROM_ADDRESS=Mastodon <{{system_email_username}}>

View File

@@ -0,0 +1,90 @@
version: '3'
services:
database:
restart: always
image: postgres:14-alpine
shm_size: 256mb
networks:
- internal_network
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
volumes:
- database:/var/lib/postgresql/data
environment:
- 'POSTGRES_HOST_AUTH_METHOD=trust'
logging:
driver: journald
redis:
restart: always
image: redis:7-alpine
networks:
- internal_network
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
volumes:
- redis:/data
logging:
driver: journald
web:
image: tootsuite/mastodon:{{mastodon_version}}
restart: always
env_file: .env.production
command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
networks:
- external_network
- internal_network
healthcheck:
# prettier-ignore
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1']
ports:
- "127.0.0.1:{{http_port}}:3000"
depends_on:
- database
- redis
volumes:
- data:/mastodon/public/system
logging:
driver: journald
streaming:
image: tootsuite/mastodon:{{mastodon_version}}
restart: always
env_file: .env.production
command: node ./streaming
networks:
- external_network
- internal_network
healthcheck:
# prettier-ignore
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1']
ports:
- "127.0.0.1:{{stream_port}}:4000"
depends_on:
- database
- redis
logging:
driver: journald
sidekiq:
image: tootsuite/mastodon:{{mastodon_version}}
restart: always
env_file: .env.production
command: bundle exec sidekiq
depends_on:
- database
- redis
networks:
- external_network
- internal_network
volumes:
- data:/mastodon/public/system
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
logging:
driver: journald
volumes:
database:
redis:
data:
networks:
external_network:
internal_network:
internal: true

View File

@@ -0,0 +1,46 @@
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
server_name {{domain}};
{% include 'roles/server_native-letsencrypt/templates/ssl_header.j2' %}
keepalive_timeout 70;
sendfile on;
client_max_body_size 80m;
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";
{% include 'roles/server_native-docker-reverse-proxy/templates/proxy_pass.conf.j2' %}
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:{{stream_port}};
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;
}

View File

@@ -0,0 +1 @@
docker_compose_mastodon_path: "{{path_docker_compose_files}}mastodon/"