From 615a2c7f3ebc2e801b5ab91693fbe49f91f3e6bc Mon Sep 17 00:00:00 2001 From: decentral1se Date: Fri, 28 May 2021 15:29:46 +0200 Subject: [PATCH] Rip tabs, use env vars and drop old docs --- README.md | 16 +--------------- abra.sh | 34 +++++++++++++++++++++++----------- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 187cbed..a34e698 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Your self-hosted, globally interconnected microblogging community 1. `abra app YOURAPPDOMAIN config` - be sure to change `DOMAIN` to something that resolves to your Docker swarm box. 1. Follow the [secrets setup documentation below](#secrets-setup) -1. Follow the [datbase setup documentation below](#database-setup) +1. `abra app YOURAPPDOMAIN setup` to setup the database and create the admin account 1. `abra app YOURAPPDOMAIN deploy --no-domain-poll`. App will fail for now. 1. Open the configured domain in your browser to finish set-up. To make an admin account `abra app mastodon run web "bin/tootctl accounts create coolusername --email helo@autonomic.zone --confirmed --role admin"` @@ -65,17 +65,3 @@ And finally, to end your whirlwind secrets loading adventure, get the `DB_PASS` $ abra app YOURAPPDOMAIN secret generate db_password v1 $ abra app YOURDOMAIN secret insert smtp_password v1 YOURSMTPPASSWORD ``` - -## Database setup - -You need to run `rake db:setup` against the database before the installation will be succesful. To do this, you need to shell into the `streaming` service and run the command while making some environment variables available. - -``` -$ abra app social.lumbung.space run streaming bash -$ 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) -$ bundle exec rake db:setup -``` - -The rest of the services will then stabilise when they have a connection to the database. diff --git a/abra.sh b/abra.sh index 9af2fa4..547d519 100644 --- a/abra.sh +++ b/abra.sh @@ -3,25 +3,37 @@ export ENTRYPOINT_CONF_VERSION=v1 #MASTO_APP_DIR="mastodon/public" sub_rake() { - # shellcheck disable=SC2034 - abra__service_="streaming" - # Using streaming for rake since it is the least likely to flap - sub_app_run 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() { - # shellcheck disable=SC2034 - abra__service_="web" - # Using streaming for rake since it is the least likely to flap - sub_app_run bin/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 @@ -34,14 +46,14 @@ sub_setup() { # Not working atm # abra_backup_app() { -# _abra_backup_dir $MASTO_APP_DIR +# _abra_backup_dir $MASTO_APP_DIR # } # abra_restore_app() { # # shellcheck disable=SC2034 # { -# abra__src_="-" -# abra__dst_=$MASTO_APP_DIR +# abra__src_="-" +# abra__dst_=$MASTO_APP_DIR # } # zcat "$@" | sub_app_cp