More improvements to abra.sh

This commit is contained in:
Cassowary 2023-10-10 14:37:02 -07:00
parent d52a8ad910
commit 8921575d11
1 changed files with 6 additions and 14 deletions

20
abra.sh
View File

@ -35,40 +35,32 @@ environment() {
declare -x RAILS_ENV=production
}
setup_assets() {
environment
bundle exec rails assets:precompile
}
setup_db() {
environment
bundle exec rake db:setup
}
setup_admin() {
## Create an admin user
environment
accounts create "$1" --email "$2" --confirmed --role admin
}
shell() {
## Run a shell with proper environment
environment
bash $@
}
generate_secrets() {
## Run this 'local' to generate secrets
## Run `abra app cmd -l <yourdomain> generate_secrets` to use Docker to generate secrets you'll need to deploy
## your new instance (and create the secrets on target app).
docker context use default > /dev/null 2>&1
echo "Generating secrets for new Hometown deployment..."
echo ""
SECRET_KEY_BASE=$(docker run --rm tootsuite/mastodon:v3.4.0 bundle exec rake secret)
SECRET_KEY_BASE=$(docker run --rm tootsuite/mastodon:v4.2.0 bundle exec rake secret)
abra app secret insert "$APP_NAME" secret_key_base v1 "$SECRET_KEY_BASE"
echo "SECRET_KEY_BASE = $SECRET_KEY_BASE"
echo ""
OTP_SECRET=$(docker run --rm tootsuite/mastodon:v3.4.0 bundle exec rake secret)
OTP_SECRET=$(docker run --rm tootsuite/mastodon:v4.2.0 bundle exec rake secret)
abra app secret insert "$APP_NAME" otp_secret v1 "$OTP_SECRET"
echo "OTP_SECRET = $OTP_SECRET"
echo ""