Rip tabs, use setup command and expose vars

This commit is contained in:
decentral1se 2021-05-28 15:27:55 +02:00
parent 615f06005b
commit d3ada7142c
Signed by untrusted user who does not match committer: decentral1se
GPG Key ID: 92DAD76BD9567B8A
2 changed files with 17 additions and 23 deletions

View File

@ -25,7 +25,7 @@ This repository is a copy of [coop-cloud/mastodon](https://git.autonomic.zone/co
1. `abra app YOURAPPDOMAIN config` - be sure to change `DOMAIN` to something that resolves to 1. `abra app YOURAPPDOMAIN config` - be sure to change `DOMAIN` to something that resolves to
your Docker swarm box. your Docker swarm box.
1. Follow the [secrets setup documentation below](#secrets-setup) 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. `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"` 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"`
@ -67,17 +67,3 @@ And finally, to end your whirlwind secrets loading adventure, get the `DB_PASS`
$ abra app YOURAPPDOMAIN secret generate db_password v1 $ abra app YOURAPPDOMAIN secret generate db_password v1
$ abra app YOURDOMAIN secret insert smtp_password v1 YOURSMTPPASSWORD $ 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.

24
abra.sh
View File

@ -3,17 +3,25 @@ export ENTRYPOINT_CONF_VERSION=v1
#MASTO_APP_DIR="mastodon/public" #MASTO_APP_DIR="mastodon/public"
sub_rake() { sub_rake() {
# shellcheck disable=SC2034 export OTP_SECRET=$(cat /run/secrets/otp_secret)
abra__service_="streaming" 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 # Using streaming for rake since it is the least likely to flap
sub_app_run rake "$@" sub_app_run bundle exec rake "$@"
} }
sub_tootctl() { 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 # shellcheck disable=SC2034
abra__service_="web" abra__service_="web"
# Using streaming for rake since it is the least likely to flap # Using streaming for rake since it is the least likely to flap
sub_app_run bin/tootctl "$@" sub_app_run bin/tootctl "$@"
} }
sub_setup() { sub_setup() {
@ -34,14 +42,14 @@ sub_setup() {
# Not working atm # Not working atm
# abra_backup_app() { # abra_backup_app() {
# _abra_backup_dir $MASTO_APP_DIR # _abra_backup_dir $MASTO_APP_DIR
# } # }
# abra_restore_app() { # abra_restore_app() {
# # shellcheck disable=SC2034 # # shellcheck disable=SC2034
# { # {
# abra__src_="-" # abra__src_="-"
# abra__dst_=$MASTO_APP_DIR # abra__dst_=$MASTO_APP_DIR
# } # }
# zcat "$@" | sub_app_cp # zcat "$@" | sub_app_cp