parent
57e912f5c1
commit
0e8f26cae1
4 changed files with 22 additions and 4 deletions
|
|
@ -20,7 +20,6 @@ LOCAL_DOMAIN=__DOMAIN__
|
|||
# -----
|
||||
REDIS_HOST=localhost
|
||||
REDIS_PORT=6379
|
||||
REDIS_NAMESPACE=__REDIS_NAMESPACE__
|
||||
|
||||
# PostgreSQL
|
||||
# ----------
|
||||
|
|
|
|||
|
|
@ -56,6 +56,13 @@ ram.runtime = "500M"
|
|||
sha256 = "ede116b80a525462f5ea68d046a4cdd787930fc6d2f9327c140756311ee07848"
|
||||
autoupdate.strategy = "latest_github_release"
|
||||
|
||||
[resources.sources.redis_migration]
|
||||
url = "https://raw.githubusercontent.com/mastodon/redis_namespace_migration/47c6bd9757e7a40f7091b5692d78aef992ea8bf2/rename.rb"
|
||||
sha256 = "3134a5c7e0157ee752f5cb49b942c89480951e94236b03dd1cb3cb1d3afdcdd2"
|
||||
in_subdir = false
|
||||
extract = false
|
||||
rename = "rename.rb"
|
||||
|
||||
[resources.system_user]
|
||||
allow_email = true
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ ynh_script_progression --message="Setting up source files..." --weight=1
|
|||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$install_dir/live"
|
||||
# Download redis migration script
|
||||
ynh_setup_source --source_id=redis_migration --dest_dir="$install_dir/live"
|
||||
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
|
|
@ -60,9 +62,6 @@ config="$install_dir/live/.env.production"
|
|||
|
||||
language="$(echo $language | head -c 2)"
|
||||
|
||||
redis_namespace=${app}_production
|
||||
ynh_app_setting_set --app="$app" --key=redis_namespace --value="$redis_namespace"
|
||||
|
||||
secret_key_base=$(ynh_string_random --length=128)
|
||||
ynh_app_setting_set --app="$app" --key=secret_key_base --value="$secret_key_base"
|
||||
|
||||
|
|
|
|||
|
|
@ -104,6 +104,8 @@ then
|
|||
|
||||
# Download, check integrity, uncompress and patch the source from manifest.toml
|
||||
ynh_setup_source --dest_dir="$install_dir/live" --full_replace=1 --keep="public/system .env.production"
|
||||
# Download redis migration script
|
||||
ynh_setup_source --source_id=redis_migration --dest_dir="$install_dir/live"
|
||||
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
|
|
@ -194,6 +196,17 @@ pushd "$install_dir/live"
|
|||
ynh_use_ruby
|
||||
ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/bundle exec rails db:migrate --quiet
|
||||
ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/bundle exec rails assets:precompile --quiet
|
||||
|
||||
# Apply redis namespace migration (https://github.com/mastodon/redis_namespace_migration)
|
||||
ynh_exec_warn_less ynh_exec_as "$app" RAILS_ENV=production COREPACK_ENABLE_DOWNLOAD_PROMPT=0 "$ynh_ruby_load_path" $ld_preload bin/rails runner rename.rb
|
||||
redis_namespace="$(ynh_app_setting_get --app=$app --key=redis_namespace)"
|
||||
if [ $redis_namespace ]; then
|
||||
if [ ynh_app_setting_get --app=$app --key=es_enabled == "true" ] && [ ynh_app_setting_get --app=$app --key=es_prefix == "" ]; then
|
||||
ynh_app_setting_set --app=$app --key=es_prefix --value=$redis_namespace
|
||||
else
|
||||
ynh_app_setting_delete --app=$app --key=redis_namespace
|
||||
fi
|
||||
fi
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
|
|
|||
Loading…
Reference in a new issue