From 2fab55c2e75ec5b02326aae86e429cf57f53b8e0 Mon Sep 17 00:00:00 2001 From: Gredin67 Date: Wed, 28 Feb 2024 18:34:07 +0100 Subject: [PATCH] Update install --- scripts/install | 45 ++++++++++----------------------------------- 1 file changed, 10 insertions(+), 35 deletions(-) diff --git a/scripts/install b/scripts/install index 2cdf07e..9a8d871 100755 --- a/scripts/install +++ b/scripts/install @@ -51,6 +51,9 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 +secret_key_base=$(ynh_string_random --length=128) +ynh_app_setting_set --app="$app" --key=secret_key_base --value="$secret_key_base" + ynh_add_config --template="secrets.yml" --destination="$install_dir/config/secrets.yml" chmod 400 "$install_dir/config/secrets.yml" chown $app:$app "$install_dir/config/secrets.yml" @@ -59,38 +62,9 @@ ynh_add_config --template="database.yml" --destination="$install_dir/config/data chmod 400 "$install_dir/config/database.yml" chown $app:$app "$install_dir/config/database.yml" -ynh_add_config --template="env.example" --destination="$install_dir/config/env" -chmod 400 "$install_dir/config/env" -chown $app:$app "$install_dir/config/env" - -ynh_add_config --template="env.example" --destination="$install_dir/config/.env" -chmod 400 "$install_dir/config/.env" -chown $app:$app "$install_dir/config/.env" - -ynh_add_config --template="env.example" --destination="$install_dir/.env" -chmod 400 "$install_dir/.env" -chown $app:$app "$install_dir/.env" - -ynh_add_config --template="secrets.yml" --destination="$ynh_ruby_load_path/config/secrets.yml" -chmod 400 "$ynh_ruby_load_path/config/secrets.yml" -chown $app:$app "$ynh_ruby_load_path/config/secrets.yml" - -ynh_add_config --template="database.yml" --destination="$ynh_ruby_load_path/config/database.yml" -chmod 400 "$ynh_ruby_load_path/config/database.yml" -chown $app:$app "$ynh_ruby_load_path/config/database.yml" - -ynh_add_config --template="env.example" --destination="$ynh_ruby_load_path/config/env" -chmod 400 "$ynh_ruby_load_path/config/env" -chown $app:$app "$ynh_ruby_load_path/config/env" - -ynh_add_config --template="env.example" --destination="$ynh_ruby_load_path/config/.env" -chmod 400 "$ynh_ruby_load_path/config/.env" -chown $app:$app "$ynh_ruby_load_path/config/.env" - -ynh_add_config --template="env.example" --destination="$ynh_ruby_load_path/.env" -chmod 400 "$ynh_ruby_load_path/.env" -chown $app:$app "$ynh_ruby_load_path/.env" - +ynh_add_config --template=".env.production.sample" --destination="$install_dir/.env.production" +chmod 400 "$install_dir/.env.production" +chown $app:$app "$install_dir/.env.production" #================================================= # BUILD APP @@ -99,6 +73,8 @@ ynh_script_progression --message="Building app..." --weight=1 pushd $install_dir ynh_use_ruby + ynh_gem update --system + #ynh_gem install bundler --no-document ynh_exec_warn_less $ynh_gem install bundler ynh_exec_warn_less bin/bundle config --global frozen 1 ynh_exec_warn_less bin/bundle config set --local without 'development test doc' @@ -107,12 +83,11 @@ pushd $install_dir ynh_use_nodejs ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install - export DEFAULT_HOST=$domain ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH SUPERUSER;" --database="$db_name" - ynh_exec_warn_less ynh_exec_as $app env RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/bundle exec rake --trace db:migrate + ynh_exec_warn_less ynh_exec_as $app env RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/bundle exec rake db:migrate ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH NOSUPERUSER;" --database="$db_name" ynh_replace_string --match_string="DateTime.current" --replace_string="DateTime.current - 1.days" --target_file="$install_dir/db/seeds.rb" - ynh_exec_warn_less ynh_exec_as $app env RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/bundle exec rake --trace db:seed ADMIN_EMAIL="$admin_mail" ADMIN_PASSWORD="$password" + ynh_exec_warn_less ynh_exec_as $app env RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/bundle exec rake db:seed ADMIN_EMAIL="$admin_mail" ADMIN_PASSWORD="$password" #ynh_exec_warn_less ynh_exec_as $app env RAILS_ENV=production $ynh_ruby_load_path $ld_preload yarn install #ynh_exec_warn_less ynh_exec_as $app env RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/webpack ( ynh_exec_warn_less ynh_exec_as $app env RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/bundle exec rake assets:precompile )