This commit is contained in:
A 2025-01-15 10:46:50 -08:00
parent 3beb597593
commit 6d4ff5a030
7 changed files with 42 additions and 61 deletions

View File

@ -15,4 +15,3 @@ services:
- "28729:28729" - "28729:28729"
volumes: volumes:
- bridge_storage:/var/opt/ouinet - bridge_storage:/var/opt/ouinet
restart: always

View File

@ -23,7 +23,6 @@ services:
- back - back
depends_on: depends_on:
- caddy - caddy
restart: always
# dovecot is running as a part of the delta chat service # dovecot is running as a part of the delta chat service
dovecot: dovecot:
@ -39,7 +38,6 @@ services:
- back - back
depends_on: depends_on:
- caddy - caddy
restart: always
# mailadm is running as a part of the delta chat service # mailadm is running as a part of the delta chat service
mailadm: mailadm:
@ -59,4 +57,4 @@ services:
- back - back
depends_on: depends_on:
- caddy - caddy
restart: always

View File

@ -36,10 +36,8 @@ services:
configs: configs:
- source: caddy-caddyfile-config - source: caddy-caddyfile-config
target: /etc/caddy/Caddyfile target: /etc/caddy/Caddyfile
restart: always
configs: configs:
caddy-caddyfile-config: caddy-caddyfile-config:
template_driver: golang
file: ../caddy/Caddyfile.tmpl file: ../caddy/Caddyfile.tmpl
external: false external: false

View File

@ -42,10 +42,8 @@ services:
uid: '991' uid: '991'
gid: '991' gid: '991'
mode: 0644 mode: 0644
restart: always
synapse-pg: synapse-pg:
restart: always
image: postgres:14-alpine image: postgres:14-alpine
healthcheck: healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres'] test: ['CMD', 'pg_isready', '-U', 'postgres']
@ -84,7 +82,6 @@ services:
target: /app/config.json target: /app/config.json
- source: element-nginx-config - source: element-nginx-config
target: /etc/nginx/conf.d/default.conf target: /etc/nginx/conf.d/default.conf
restart: always
configs: configs:
synapse-homeserver-config: synapse-homeserver-config:
@ -97,11 +94,9 @@ configs:
file: ../synapse/matrix.${DWEB_DOMAIN}.log.config file: ../synapse/matrix.${DWEB_DOMAIN}.log.config
external: false external: false
element-json-config: element-json-config:
template_driver: golang
file: ../element/config.json file: ../element/config.json
external: false external: false
element-nginx-config: element-nginx-config:
template_driver: golang
file: ../element/nginx.conf file: ../element/nginx.conf
external: false external: false

View File

@ -12,7 +12,6 @@ services:
### MASTODON ### MASTODON
mastodon-redis: mastodon-redis:
restart: always
image: redis:7.0-alpine image: redis:7.0-alpine
healthcheck: healthcheck:
test: ['CMD', 'redis-cli', 'ping'] test: ['CMD', 'redis-cli', 'ping']
@ -21,10 +20,8 @@ services:
- mastodon_redis:/data - mastodon_redis:/data
networks: networks:
- mast-int - mast-int
restart: always
mastodon-web: mastodon-web:
restart: always
image: tootsuite/mastodon:v4.3.0 image: tootsuite/mastodon:v4.3.0
#healthcheck: #healthcheck:
#test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1'] #test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1']
@ -52,10 +49,8 @@ services:
networks: networks:
- mast-int - mast-int
- back - back
restart: always
mastodon-streaming: mastodon-streaming:
restart: always
image: tootsuite/mastodon-streaming:v4.3.2 image: tootsuite/mastodon-streaming:v4.3.2
healthcheck: healthcheck:
test: wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1 test: wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1
@ -65,7 +60,6 @@ services:
- "127.0.0.1:4000:4000" - "127.0.0.1:4000:4000"
environment: environment:
LOCAL_DOMAIN: "mastodon.${DWEB_DOMAIN}" LOCAL_DOMAIN: "mastodon.${DWEB_DOMAIN}"
SMTP_FROM_ADDRESS: "notifications@${DWEB_DOMAIN}"
command: node ./streaming command: node ./streaming
depends_on: depends_on:
- mastodon-db - mastodon-db
@ -73,22 +67,19 @@ services:
networks: networks:
- mast-int - mast-int
- back - back
restart: always
mastodon-sidekiq: mastodon-sidekiq:
restart: always
image: tootsuite/mastodon:v4.3.2 image: tootsuite/mastodon:v4.3.2
entrypoint: entrypoint:
- sh - sh
- -c - -c
- "service sendmail start && /usr/bin/tini -- bundle exec sidekiq" - "/usr/bin/tini -- bundle exec sidekiq"
healthcheck: healthcheck:
test: ps aux | grep '[s]idekiq\ 6' || false test: ps aux | grep '[s]idekiq\ 6' || false
env_file: ../mastodon/env.production env_file: ../mastodon/env.production
environment: environment:
LOCAL_DOMAIN: "mastodon.${DWEB_DOMAIN}" LOCAL_DOMAIN: "mastodon.${DWEB_DOMAIN}"
SMTP_FROM_ADDRESS: "notifications@${DWEB_DOMAIN}" SMTP_FROM_ADDRESS: "notifications@${DWEB_DOMAIN}"
command: bundle exec sidekiq
depends_on: depends_on:
- mastodon-db - mastodon-db
- mastodon-redis - mastodon-redis
@ -100,18 +91,16 @@ services:
subpath: system subpath: system
networks: networks:
- mast-int - mast-int
restart: always
mastodon-db: mastodon-db:
restart: always
image: postgres:14.13-alpine image: postgres:14.13-alpine
healthcheck: healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres'] test: ['CMD', 'pg_isready', '-U', 'postgres']
environment: environment:
- 'POSTGRES_HOST_AUTH_METHOD=trust' - 'POSTGRES_HOST_AUTH_METHOD=trust'
- 'POSTGRES_DB=mastodon'
volumes: volumes:
- mastodon_db:/var/lib/postgresql/data - mastodon_db:/var/lib/postgresql/data
networks: networks:
- mast-int - mast-int
restart: always

View File

@ -7,6 +7,7 @@ SINGLE_USER_MODE=false
SECRET_KEY_BASE= SECRET_KEY_BASE=
OTP_SECRET= OTP_SECRET=
VAPID_KEYS= VAPID_KEYS=
ACTIVE_RECORD=
DB_HOST=mastodon-db DB_HOST=mastodon-db
DB_PORT=5432 DB_PORT=5432
DB_NAME=mastodon DB_NAME=mastodon

View File

@ -13,22 +13,22 @@ COMPOSE_FILES="-f ./conf/compose/docker-compose.yml "
# Docker saved file names # Docker saved file names
FILES=( FILES=(
"dcomms_conf_v2.tar" # If we can grab the install script we can likely grab the configs. # "dcomms_conf_v2.tar" # If we can grab the install script we can likely grab the configs.
"caddy_2.6.4.tar" # "caddy_2.6.4.tar"
) )
D_IMAGES=("caddy:2.6.4") D_IMAGES=("caddy:2.6.4")
DCOMMS_INSTANCES=( DCOMMS_INSTANCES=(
"kyiv.dcomm.net.ua" # "kyiv.dcomm.net.ua"
"odessa.dcomm.net.ua" # "odessa.dcomm.net.ua"
"kharkiv.dcomm.net.ua" # "kharkiv.dcomm.net.ua"
"lviv.dcomm.net.ua" # "lviv.dcomm.net.ua"
"lviv2.dcomm.net.ua" # "lviv2.dcomm.net.ua"
"rivne.dcomm.net.ua" # "rivne.dcomm.net.ua"
"kherson.dcomm.net.ua" # "kherson.dcomm.net.ua"
"mykolayiv.dcomm.net.ua" # "mykolayiv.dcomm.net.ua"
) )
IPFS_GATEWAYS=( IPFS_GATEWAYS=(
@ -109,8 +109,8 @@ check_requirements () {
detect_connectivity () { detect_connectivity () {
# This function tests all available means to retrieve the dComms repository. # This function tests all available means to retrieve the dComms repository.
if sudo docker pull hello-world >/dev/null 2>&1; then if docker pull hello-world >/dev/null 2>&1; then
sudo docker rmi hello-world >/dev/null 2>&1 docker rmi hello-world >/dev/null 2>&1
printf "${GREEN}## Successfully connected to Docker Hub${NC}\n" printf "${GREEN}## Successfully connected to Docker Hub${NC}\n"
HUB_REACHABLE=true HUB_REACHABLE=true
else else
@ -174,7 +174,7 @@ detect_connectivity () {
#Spins up a temporary docker container to generate synapse config files and keys #Spins up a temporary docker container to generate synapse config files and keys
matrix_config () { matrix_config () {
printf "${YELLOW}## Generating synapse config${NC}\n" printf "${YELLOW}## Generating synapse config${NC}\n"
sudo docker run -it --rm \ docker run --rm \
--mount type=bind,src=$(readlink -f $DCOMMS_DIR/conf/synapse),dst=/data \ --mount type=bind,src=$(readlink -f $DCOMMS_DIR/conf/synapse),dst=/data \
-e SYNAPSE_SERVER_NAME=matrix.$DWEB_DOMAIN \ -e SYNAPSE_SERVER_NAME=matrix.$DWEB_DOMAIN \
-e SYNAPSE_REPORT_STATS=no \ -e SYNAPSE_REPORT_STATS=no \
@ -182,17 +182,17 @@ matrix_config () {
matrixdotorg/synapse:v1.121.1 generate 2>/dev/null matrixdotorg/synapse:v1.121.1 generate 2>/dev/null
sudo chown -R $USER:$USER $DCOMMS_DIR/conf/synapse/ sudo chown -R $USER:$USER $DCOMMS_DIR/conf/synapse/
sed -i -z "s/database.*homeserver.db//" $DCOMMS_DIR/conf/element/config.json sed -i -z "s/database.*homeserver.db//" $DCOMMS_DIR/conf/synapse/config.json
sed -i "s/# vim:ft=yaml//" $DCOMMS_DIR/conf/element/config.json sed -i "s/# vim:ft=yaml//" $DCOMMS_DIR/conf/synapse/config.json
printf "enable_registration: true\n" >> $DCOMMS_DIR/conf/element/config.json printf "enable_registration: true\n" >> $DCOMMS_DIR/conf/synapse/config.json
printf "registration_requires_token: true\n" >> $DCOMMS_DIR/conf/element/config.json printf "registration_requires_token: true\n" >> $DCOMMS_DIR/conf/synapse/config.json
printf "encryption_enabled_by_default_for_room_type: all\n" >> $DCOMMS_DIR/conf/element/config.json printf "encryption_enabled_by_default_for_room_type: all\n" >> $DCOMMS_DIR/conf/synapse/config.json
printf "rc_registration:\n per_second: 0.1 \n burst_count: 2\n" >> $DCOMMS_DIR/conf/element/config.json printf "rc_registration:\n per_second: 0.1 \n burst_count: 2\n" >> $DCOMMS_DIR/conf/synapse/config.json
printf "presence:\n enabled: false\n" >> $DCOMMS_DIR/conf/element/config.json printf "presence:\n enabled: false\n" >> $DCOMMS_DIR/conf/synapse/config.json
printf "database:\n name: psycopg2\n txn_limit: 10000\n args:\n" >> $DCOMMS_DIR/conf/element/config.json printf "database:\n name: psycopg2\n txn_limit: 10000\n args:\n" >> $DCOMMS_DIR/conf/synapse/config.json
printf " user: synapse\n password: null\n database: synapse\n host: localhost\n" >> $DCOMMS_DIR/conf/element/config.json printf " user: synapse\n password: null\n database: synapse\n host: localhost\n" >> $DCOMMS_DIR/conf/synapse/config.json
printf " port: 5432\n cp_min: 5\n cp_max: 10\n" >> $DCOMMS_DIR/conf/element/config.json printf " port: 5432\n cp_min: 5\n cp_max: 10\n" >> $DCOMMS_DIR/conf/synapse/config.json
sed -i "s/TEMPLATE/$DWEB_DOMAIN/" $DCOMMS_DIR/conf/element/config.json sed -i "s/TEMPLATE/$DWEB_DOMAIN/" $DCOMMS_DIR/conf/element/config.json
} }
@ -200,26 +200,26 @@ matrix_config () {
#Mastodon's config file requires a number of keys to be generated. We spin up a temporary container to do this. #Mastodon's config file requires a number of keys to be generated. We spin up a temporary container to do this.
#Volume must be removed before running #Volume must be removed before running
mastodon_config () { mastodon_config () {
sudo docker volume rm masto_data_tmp 2> /dev/null || true docker volume rm masto_data_tmp 2> /dev/null || true
printf "${YELLOW}## Generating mastodon config${NC}\n" printf "${YELLOW}## Generating mastodon config${NC}\n"
sudo cp -a $DCOMMS_DIR/conf/mastodon/example.env.production $DCOMMS_DIR/conf/mastodon/env.production sudo cp -a $DCOMMS_DIR/conf/mastodon/example.env.production $DCOMMS_DIR/conf/mastodon/env.production
SECRET_KEY_BASE=`sudo docker run -it --rm \ SECRET_KEY_BASE=$(docker run --rm \
--mount type=volume,src=masto_data_tmp,dst=/opt/mastodon \ --mount type=volume,src=masto_data_tmp,dst=/opt/mastodon \
-e RUBYOPT=-W0 tootsuite/mastodon:v4.3.2 \ -e RUBYOPT=-W0 tootsuite/mastodon:v4.3.2 \
bundle exec rake secret` >/dev/null bundle exec rails secret) >/dev/null
OTP_SECRET=$(sudo docker run -it --rm \ OTP_SECRET=$(docker run --rm \
--mount type=volume,src=masto_data_tmp,dst=/opt/mastodon \ --mount type=volume,src=masto_data_tmp,dst=/opt/mastodon \
-e RUBYOPT=-W0 tootsuite/mastodon:v4.3.2 \ -e RUBYOPT=-W0 tootsuite/mastodon:v4.3.2 \
bundle exec rake secret) >/dev/null bundle exec rails secret) >/dev/null
VAPID_KEYS=$(sudo docker run -it --rm \ VAPID_KEYS=$(docker run --rm \
--mount type=volume,src=masto_data_tmp,dst=/opt/mastodon \ --mount type=volume,src=masto_data_tmp,dst=/opt/mastodon \
-e RUBYOPT=-W0 tootsuite/mastodon:v4.3.2 \ -e RUBYOPT=-W0 tootsuite/mastodon:v4.3.2 \
bundle exec rake mastodon:webpush:generate_vapid_key)>/dev/null bundle exec rails mastodon:webpush:generate_vapid_key)>/dev/null
VAPID_FRIENDLY_KEYS=${VAPID_KEYS//$'\n'/\\$'\n'} VAPID_FRIENDLY_KEYS=${VAPID_KEYS//$'\n'/\\$'\n'}
ACTIVE_RECORD_ENCRYPTION=$(sudo docker run -it --rm \ ACTIVE_RECORD_ENCRYPTION=$(docker run --rm \
--mount type=volume,src=masto_data_tmp,dst=/opt/mastodon \ --mount type=volume,src=masto_data_tmp,dst=/opt/mastodon \
-e RUBYOPT=-W0 tootsuite/mastodon:v4.3.2 \ -e RUBYOPT=-W0 tootsuite/mastodon:v4.3.2 \
bundle exec rake db:encryption:init)>/dev/null bundle exec rake db:encryption:init)>/dev/null
@ -239,15 +239,16 @@ mastodon_config () {
printf "${YELLOW}## Initializing mastodon database${NC}\n" printf "${YELLOW}## Initializing mastodon database${NC}\n"
docker compose -f ./conf/compose/mastodon.docker-compose.yml run --rm mastodon-web bundle exec rake db:prepare docker compose -f ./conf/compose/mastodon.docker-compose.yml run --entrypoint="bundle exec rails db:create" --rm mastodon-web
docker compose -f ./conf/compose/mastodon.docker-compose.yml run --rm mastodon-web bundle exec rake db:migrate docker compose -f ./conf/compose/mastodon.docker-compose.yml run --entrypoint="bundle exec rake db:prepare" --rm mastodon-web
docker compose -f ./conf/compose/mastodon.docker-compose.yml run --entrypoint="bundle exec rake db:migrate" --rm mastodon-web
docker volume rm -f masto_data_tmp docker volume rm -f masto_data_tmp
} }
mau_config () { mau_config () {
printf "${YELLOW}## Generating mau bot config${NC}\n" printf "${YELLOW}## Generating mau bot config${NC}\n"
sudo docker run --rm --mount type=bind,src=$(readlink -f $DCOMMS_DIR/conf/mau),dst=/data dock.mau.dev/maubot/maubot:v0.3.1 1>&2 >/dev/null docker run --rm --mount type=bind,src=$(readlink -f $DCOMMS_DIR/conf/mau),dst=/data dock.mau.dev/maubot/maubot:v0.3.1 1>&2 >/dev/null
sudo chown -R $USER:$USER $DCOMMS_DIR/conf/mau sudo chown -R $USER:$USER $DCOMMS_DIR/conf/mau
MAU_PW=$(tr -dc 'A-Za-z0-9' < /dev/urandom | head -c 18) MAU_PW=$(tr -dc 'A-Za-z0-9' < /dev/urandom | head -c 18)
printf "${RED}## Mau credentials = admin:$MAU_PW${NC}\n" printf "${RED}## Mau credentials = admin:$MAU_PW${NC}\n"
@ -397,7 +398,7 @@ main() {
printf "${GREEN}### Grabbing images from Docker Hub.${NC}\n" printf "${GREEN}### Grabbing images from Docker Hub.${NC}\n"
for img in ${D_IMAGES[@]}; do for img in ${D_IMAGES[@]}; do
echo "dimg = $img" echo "dimg = $img"
if sudo docker pull $img; then if docker pull $img; then
unset 'FILES[$di]' unset 'FILES[$di]'
((di=di+=1)) ((di=di+=1))
fi fi
@ -409,7 +410,7 @@ main() {
#Might be wise to bring this out of this function so that we can validate before loading #Might be wise to bring this out of this function so that we can validate before loading
# for f in $DCOMMS_DIR/images/*.tar; do # for f in $DCOMMS_DIR/images/*.tar; do
# echo "" # echo ""
# cat $f | sudo docker load # cat $f | docker load
# done # done
echo "#!/bin/bash" > $DCOMMS_DIR/run.sh echo "#!/bin/bash" > $DCOMMS_DIR/run.sh