Improve the abra.sh even more, with comments and remove commands that have no use.

This commit is contained in:
Cassowary 2023-10-10 14:37:28 -07:00
parent cf051ec0a9
commit 40d3864e15

22
abra.sh
View File

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
# set -x
export ENTRYPOINT_CONF_VERSION=v12 export ENTRYPOINT_CONF_VERSION=v12
file_env() { file_env() {
local var="$1" local var="$1"
local fileVar="${var}_FILE" local fileVar="${var}_FILE"
@ -35,40 +35,32 @@ environment() {
declare -x RAILS_ENV=production declare -x RAILS_ENV=production
} }
setup_assets() {
environment
bundle exec rails assets:precompile
}
setup_db() {
environment
bundle exec rake db:setup
}
setup_admin() { setup_admin() {
## Create an admin user
environment environment
accounts create "$1" --email "$2" --confirmed --role admin accounts create "$1" --email "$2" --confirmed --role admin
} }
shell() { shell() {
## Run a shell with proper environment
environment environment
bash $@ bash $@
} }
generate_secrets() { 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 docker context use default > /dev/null 2>&1
echo "Generating secrets for new Hometown deployment..." echo "Generating secrets for new Hometown deployment..."
echo "" 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" abra app secret insert "$APP_NAME" secret_key_base v1 "$SECRET_KEY_BASE"
echo "SECRET_KEY_BASE = $SECRET_KEY_BASE" echo "SECRET_KEY_BASE = $SECRET_KEY_BASE"
echo "" 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" abra app secret insert "$APP_NAME" otp_secret v1 "$OTP_SECRET"
echo "OTP_SECRET = $OTP_SECRET" echo "OTP_SECRET = $OTP_SECRET"
echo "" echo ""