1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/fab-manager_ynh.git synced 2024-09-03 18:36:16 +02:00

Update install

This commit is contained in:
Gredin67 2024-02-28 18:34:07 +01:00 committed by GitHub
parent 2437ae7a8d
commit 2fab55c2e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -51,6 +51,9 @@ ynh_add_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1 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" ynh_add_config --template="secrets.yml" --destination="$install_dir/config/secrets.yml"
chmod 400 "$install_dir/config/secrets.yml" chmod 400 "$install_dir/config/secrets.yml"
chown $app:$app "$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" chmod 400 "$install_dir/config/database.yml"
chown $app:$app "$install_dir/config/database.yml" chown $app:$app "$install_dir/config/database.yml"
ynh_add_config --template="env.example" --destination="$install_dir/config/env" ynh_add_config --template=".env.production.sample" --destination="$install_dir/.env.production"
chmod 400 "$install_dir/config/env" chmod 400 "$install_dir/.env.production"
chown $app:$app "$install_dir/config/env" chown $app:$app "$install_dir/.env.production"
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"
#================================================= #=================================================
# BUILD APP # BUILD APP
@ -99,6 +73,8 @@ ynh_script_progression --message="Building app..." --weight=1
pushd $install_dir pushd $install_dir
ynh_use_ruby 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 $ynh_gem install bundler
ynh_exec_warn_less bin/bundle config --global frozen 1 ynh_exec_warn_less bin/bundle config --global frozen 1
ynh_exec_warn_less bin/bundle config set --local without 'development test doc' ynh_exec_warn_less bin/bundle config set --local without 'development test doc'
@ -107,12 +83,11 @@ pushd $install_dir
ynh_use_nodejs ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install 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_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_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_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 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/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 ) ( ynh_exec_warn_less ynh_exec_as $app env RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/bundle exec rake assets:precompile )