chore: merge hometown cleanups

This commit is contained in:
decentral1se 2022-01-28 19:08:49 +01:00
parent 9dd57c9184
commit 4af65b89f9
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
2 changed files with 2 additions and 104 deletions

61
abra.sh
View File

@ -1,62 +1 @@
# shellcheck disable=SC2148
export ENTRYPOINT_CONF_VERSION=v1
#MASTO_APP_DIR="mastodon/public"
sub_rake() {
export OTP_SECRET=$(cat /run/secrets/otp_secret)
export SECRET_KEY_BASE=$(cat /run/secrets/secret_key_base)
export DB_PASS=$(cat /run/secrets/db_password)
# shellcheck disable=SC2034
abra__service_="streaming"
# Using streaming for rake since it is the least likely to flap
sub_app_run rake "$@"
}
sub_tootctl() {
export OTP_SECRET=$(cat /run/secrets/otp_secret)
export SECRET_KEY_BASE=$(cat /run/secrets/secret_key_base)
export DB_PASS=$(cat /run/secrets/db_password)
# shellcheck disable=SC2034
abra__service_="web"
# Using streaming for rake since it is the least likely to flap
sub_app_run bin/tootctl "$@"
}
sub_setup() {
info "Setting up mastodon database"
silence
sub_rake "db:setup"
unsilence
success "Mastodon's database is now up! 'web' and 'sidekiq' services should now stop failing."
echo "Do you want to create an admin user? (Extremely recommended!)"
prompt_confirm
read -rp "Username: " USERNAME
read -rp "Email: " EMAIL
warning "Password will be show on screen. Copy this down somewhere! Abra cannot show you this again!"
sub_tootctl accounts create $USERNAME --email $EMAIL --confirmed --role admin
success "Admin account created!"
success "Mastodon should be setup and ready to go!"
}
# Not working atm
# abra_backup_app() {
# _abra_backup_dir $MASTO_APP_DIR
# }
# abra_restore_app() {
# # shellcheck disable=SC2034
# {
# abra__src_="-"
# abra__dst_=$MASTO_APP_DIR
# }
# zcat "$@" | sub_app_cp
# success "Restored 'app'"
# }

View File

@ -6,9 +6,6 @@ services:
image: postgres:9.6-alpine
networks: &internalNetwork
- internal_network
# Note(decentral1se): get this working, failing somehow so far
# healthcheck:
# test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
volumes:
- postgres:/var/lib/postgresql/data
secrets:
@ -35,13 +32,6 @@ services:
- "bootstrap.memory_lock=true"
networks:
- internal_network
# Note(decentral1se): get this working, failing somehow so far
# healthcheck:
# test:
# [
# "CMD-SHELL",
# "curl --silent --fail localhost:9200/_cluster/health || exit 1",
# ]
volumes:
- es:/usr/share/elasticsearch/data
ulimits:
@ -49,19 +39,12 @@ services:
soft: -1
hard: -1
web:
app:
image: tootsuite/mastodon:v3.4.1
command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
networks: &bothNetworks
- proxy
- internal_network
# Note(decentral1se): get this working, failing somehow so far
# healthcheck:
# test:
# [
# "CMD-SHELL",
# "wget -q --spider --proxy=off localhost:3000/health || exit 1",
# ]
deploy:
update_config:
failure_action: rollback
@ -73,19 +56,7 @@ services:
- "traefik.http.routers.${STACK_NAME}_web.rule=Host(`${DOMAIN}`)"
- "traefik.http.routers.${STACK_NAME}_web.entrypoints=web-secure"
- "traefik.http.routers.${STACK_NAME}_web.tls.certresolver=${LETS_ENCRYPT_ENV}"
# WEB_DOMAIN redirect
#- "traefik.http.routers.${STACK_NAME}_web.rule=(Host(`${DOMAIN}`) || (Host(`${LOCAL_DOMAIN}`) && Path(`/.well-known/webfinger`)))"
# - "traefik.http.middlewares.mastodon-webfinger.redirectregex.regex=^https?://${LOCAL_DOMAIN}/.*" #^(http|https)://${LOCAL_DOMAIN}/.well-known/webfinger"
# # - "traefik.http.middlewares.mastodon-webfinger.redirectregex.permanent=true"
# - "traefik.http.middlewares.mastodon-webfinger.redirectregex.replacement=https://${WEB_DOMAIN}/.well-known/webfinger"
# - "traefik.http.routers.${STACK_NAME}_hack.rule=(Host(`${LOCAL_DOMAIN}`) && Path(`/.well-known/`))"
# - "traefik.http.routers.${STACK_NAME}_hack.entrypoints=websecure"
# - "traefik.http.routers.${STACK_NAME}_hack.middlewares=mastodon-webfinger@docker"
## Redirect from EXTRA_DOMAINS to DOMAIN
#- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect"
#- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true"
#- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
- "coop-cloud.${STACK_NAME}.version=0.1.0+3.4.1"
configs: &configs
- source: entrypoint_sh
target: /usr/local/bin/entrypoint.sh
@ -192,13 +163,6 @@ services:
entrypoint: *entrypoint
secrets: *secrets
networks: *bothNetworks
# Note(decentral1se): get this working, failing somehow so far
# healthcheck:
# test:
# [
# "CMD-SHELL",
# "wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1",
# ]
deploy:
update_config:
failure_action: rollback
@ -210,11 +174,6 @@ services:
- "traefik.http.routers.${STACK_NAME}_streaming.rule=(Host(`${DOMAIN}`) && PathPrefix(`/api/v1/streaming`))"
- "traefik.http.routers.${STACK_NAME}_streaming.entrypoints=web-secure"
- "traefik.http.routers.${STACK_NAME}_streaming.tls.certresolver=${LETS_ENCRYPT_ENV}"
## Redirect from EXTRA_DOMAINS to DOMAIN
#- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect"
#- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true"
#- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
environment: *env
volumes: *appVolume # used to make sure this volume is created