implemented mastodon

This commit is contained in:
Kevin Veen-Birkenbach 2022-11-15 21:43:05 +01:00
parent c71e441640
commit 2559d03f22
4 changed files with 60 additions and 98 deletions

View File

@ -3,8 +3,27 @@
```bash
docker-compose run --rm web bundle exec rake mastodon:setup
```
## cleanup
```bash
cd /home/administrator/docker-compose/mastodon/
docker-compose down
docker volume rm mastodon_data mastodon_database mastodon_redis
cd /home/administrator/docker-compose/ &&
rm -vR /home/administrator/docker-compose/mastodon
```
## access terminal
```bash
docker exec -it mastodon-streaming-1 /bin/bash
```
## set rights
```bash
docker exec -it mastodon-streaming-1 chown -R 991:991 public
```
## further information
- https://goneuland.de/mastodon-mit-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

@ -12,35 +12,10 @@
state: directory
mode: 0755
- name: register directory
stat:
path: "{{docker_compose_mastodon_path}}}"
register: docker_compose_mastodon_path_register
- name: checkout repository
ansible.builtin.shell: git checkout .
become: true
args:
chdir: "{{docker_compose_mastodon_path}}"
when: docker_compose_mastodon_path_register.stat.exists
become: true
- name: pull docker repository
git:
repo: "https://github.com/tootsuite/mastodon.git"
dest: "{{docker_compose_mastodon_path}}"
update: yes
#notify: recreate mastodon
become: true
- name: copy docker-compose.yml
template: src=docker-compose.yml.j2 dest={{docker_compose_mastodon_path}}docker-compose.yml
#notify: recreate mastodon
notify: recreate mastodon
- name: copy configuration
template: src=.env.production.j2 dest={{docker_compose_mastodon_path}}.env.production
#notify: recreate mastodon
- name: add docker-compose.yml
template: src=docker-compose.yml.j2 dest={{docker_compose_mastodon_path}}docker-compose.yml
#notify: recreate mastodon
notify: recreate mastodon

View File

@ -1,52 +1,22 @@
LOCAL_DOMAIN={{domain}}
# Redis
# -----
REDIS_HOST=localhost
REDIS_PORT=6379
# PostgreSQL
# ----------
SINGLE_USER_MODE=true
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_USER=mastodon
DB_NAME=mastodon
DB_PASS={{mastodon_database_password}}
DB_PORT=3306
# Secrets
# -------
# Make sure to use `rake secret` to generate secrets
# -------
SECRET_KEY_BASE=
OTP_SECRET=
# Web Push
# --------
# Generate with `rake mastodon:webpush:generate_vapid_key`
# --------
VAPID_PRIVATE_KEY=
VAPID_PUBLIC_KEY=
# Sending mail
# ------------
SMTP_SERVER=smtp.mailgun.org
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=587
SMTP_LOGIN=
SMTP_PASSWORD=
SMTP_FROM_ADDRESS=notifications@example.com
# File storage (optional)
# -----------------------
S3_ENABLED=true
S3_BUCKET=files.example.com
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
S3_ALIAS_HOST=files.example.com
# IP and session retention
# -----------------------
# Make sure to modify the scheduling of ip_cleanup_scheduler in config/sidekiq.yml
# to be less than daily if you lower IP_RETENTION_PERIOD below two days (172800).
# -----------------------
IP_RETENTION_PERIOD=31556952
SESSION_RETENTION_PERIOD=31556952
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

@ -1,23 +1,19 @@
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
image: mariadb:10.5
command: "--transaction-isolation=READ-COMMITTED --binlog-format=ROW"
environment:
MYSQL_DATABASE: "mastodon"
MYSQL_USER: "mastodon"
MYSQL_PASSWORD: "{{mastodon_database_password}}"
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
volumes:
- database:/var/lib/mysql
restart: always
healthcheck:
test: "/usr/bin/mysql --user=mastodon --password={{mastodon_database_password}} --execute \"SHOW DATABASES;\""
interval: 3s
timeout: 1s
retries: 5
redis:
restart: always
image: redis:7-alpine
@ -27,9 +23,9 @@ services:
test: ['CMD', 'redis-cli', 'ping']
volumes:
- redis:/data
logging:
driver: journald
web:
build: .
image: tootsuite/mastodon:{{mastodon_version}}
restart: always
env_file: .env.production
@ -47,9 +43,9 @@ services:
- redis
volumes:
- data:/mastodon/public/system
logging:
driver: journald
streaming:
build: .
image: tootsuite/mastodon:{{mastodon_version}}
restart: always
env_file: .env.production
@ -65,9 +61,9 @@ services:
depends_on:
- database
- redis
logging:
driver: journald
sidekiq:
build: .
image: tootsuite/mastodon:{{mastodon_version}}
restart: always
env_file: .env.production
@ -82,6 +78,8 @@ services:
- data:/mastodon/public/system
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
logging:
driver: journald
volumes:
database:
redis: