From 65b51b460627be035940564ee672f8a5b2231129 Mon Sep 17 00:00:00 2001 From: ale Date: Sat, 6 Jul 2024 09:09:52 +0200 Subject: [PATCH] initial commit --- .env.production | 90 ++++++++++++++++++++++++++++++++++++++++++++++ README.md | 7 ++++ docker-compose.yml | 86 ++++++++++++++++++++++++++++++++++++++++++++ mastodon/.gitkeep | 0 4 files changed, 183 insertions(+) create mode 100644 .env.production create mode 100644 README.md create mode 100644 docker-compose.yml create mode 100644 mastodon/.gitkeep diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..f352900 --- /dev/null +++ b/.env.production @@ -0,0 +1,90 @@ +# This is a sample configuration file. You can generate your configuration +# with the `rake mastodon:setup` interactive setup wizard, but to customize +# your setup even further, you'll need to edit it manually. This sample does +# not demonstrate all available configuration options. Please look at +# https://docs.joinmastodon.org/admin/config/ for the full documentation. + +# Note that this file accepts slightly different syntax depending on whether +# you are using `docker-compose` or not. In particular, if you use +# `docker-compose`, the value of each declared variable will be taken verbatim, +# including surrounding quotes. +# See: https://github.com/mastodon/mastodon/issues/16895 + +# Federation +# ---------- +# This identifies your server and cannot be changed safely later +# ---------- +LOCAL_DOMAIN=mastodon.XXX.com +SINGLE_USER_MODE=true +RAILS_ENV=production +NODE_ENV=production +TRUSTED_PROXY_IP=172.17.0.0/24 +RAILS_LOG_LEVEL=error +LOG_LEVEL=silly + +# Redis +# ----- +REDIS_HOST=mastodon-redis +REDIS_PORT=6379 + +# PostgreSQL +# ---------- +DB_HOST=mastodon-db +DB_USER=mastodon +DB_NAME=mastodondb +DB_PASS=s3cr3t +DB_PORT=5432 + +# Elasticsearch (optional) +# ------------------------ +ES_ENABLED=false +ES_HOST= +ES_PORT=9200 +# Authentication for ES (optional) +#ES_USER=elastic +#ES_PASS=password + +# 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.XXX.com +SMTP_PORT=465 +SMTP_LOGIN=webmaster@XXX.com +SMTP_PASSWORD= +SMTP_FROM_ADDRESS=webmaster@XXX.com +SMTP_SSL=true +SMTP_ENABLE_STARTTLS=never + +# File storage (optional) +# ----------------------- +S3_ENABLED=false +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 +SIDEKIQ_CONCURRENCY=4 +DEFAULT_LOCALE=es + +LIBRE_TRANSLATE_ENDPOINT=http://libretranslate:5000 +LIBRE_TRANSLATE_API_KEY= diff --git a/README.md b/README.md new file mode 100644 index 0000000..624ae51 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# mastodon-libretranslate + +### small docker-compose to start `mastodon` with LibreTranslate in `docker` containers. + +### License + +MIT \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c7b3663 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,86 @@ +services: + mastodon: + image: tootsuite/mastodon + restart: always + hostname: mastodon + container_name: mastodon + env_file: .env.production + command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000" + ports: + - "3000:3000" + depends_on: + - mastodon-db + - mastodon-redis + volumes: + - ./mastodon/public/assets:/mastodon/public/assets + - ./mastodon/public/system:/mastodon/public/system + networks: + mastonet: + + streaming: + image: tootsuite/mastodon + restart: always + hostname: streaming + container_name: streaming + env_file: .env.production + command: node ./streaming + ports: + - "4000:4000" + depends_on: + - mastodon-db + - mastodon-redis + networks: + mastonet: + + sidekiq: + image: tootsuite/mastodon + restart: always + hostname: sidekiq + container_name: sidekiq + env_file: .env.production + command: bundle exec sidekiq + depends_on: + - mastodon-db + - mastodon-redis + volumes: + - ./mastodon/public/system:/mastodon/public/system + networks: + mastonet: + + mastodon-db: + image: postgres:14 + restart: always + hostname: mastodon-db + container_name: mastodon-db + shm_size: 256mb + environment: + - POSTGRES_DB=mastodondb + - POSTGRES_USER=mastodon + - POSTGRES_PASSWORD=s3cr3t + volumes: + - ./postgres14:/var/lib/postgresql/data + networks: + mastonet: + + mastodon-redis: + image: redis:7-alpine + restart: always + hostname: mastodon-redis + container_name: mastodon-redis + volumes: + - ./redis:/data + networks: + mastonet: + + libretranslate: + image: registry.gitlab.com/manalejandro/libretranslate-api/libretranslate-api + restart: always + hostname: libretranslate + container_name: libretranslate + expose: + - "5000" + networks: + mastonet: + +networks: + mastonet: diff --git a/mastodon/.gitkeep b/mastodon/.gitkeep new file mode 100644 index 0000000..e69de29