From 8711b925306be63d7b2b7669fe2ef3cf8ebdc476 Mon Sep 17 00:00:00 2001 From: nemsia Date: Thu, 13 Jul 2017 00:12:42 +0200 Subject: add __FINALPATH__ on Nginx conf (#46) * [enh] Final_path on nginx * [enh] final_path on nginx.conf * Merge remote-tracking branch 'refs/remotes/YunoHost-Apps/master' into nginx-conf # Conflicts: # scripts/restore * [fix] nginx path on backup * [fix] Error on final_path nginx * Version num in badge --- scripts/backup | 6 ++++++ scripts/install | 4 +++- scripts/restore | 4 +++- scripts/upgrade | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/backup b/scripts/backup index d3bf424..e4a5bba 100644 --- a/scripts/backup +++ b/scripts/backup @@ -23,6 +23,9 @@ domain=$(ynh_app_setting_get "$app" domain) final_path="/opt/${app}" ynh_backup "$final_path" "sources" 1 +# final_path on nginx +sudo sed -i "s@$final_path@__FINALPATH__@g" /etc/nginx/conf.d/${domain}.d/${app}.conf + # Copy the nginx conf files ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf" ynh_backup "/etc/cron.d/${app}" "cron.conf" @@ -32,6 +35,9 @@ ynh_backup "/etc/systemd/system/mastodon-streaming.service" "systemd_streaming.s ynh_backup "/etc/apt/sources.list.d/backports.list" "apt_backports.list" ynh_backup "/etc/apt/sources.list.d/yarn.list" "apt_yarn.list" +# final_path on nginx +sudo sed -i "s@__FINALPATH__@$final_path@g" /etc/nginx/conf.d/${domain}.d/${app}.conf + # Backup db sudo su - postgres < mastodon_db.sql diff --git a/scripts/install b/scripts/install index 17a4573..f769a8b 100644 --- a/scripts/install +++ b/scripts/install @@ -214,7 +214,9 @@ RAILS_ENV=production bin/bundle exec rails mastodon:make_admin USERNAME=$admin_m RAILS_ENV=production bin/bundle exec rails mastodon:confirm_email USER_EMAIL=$admin_mastodon_mail ACOMMANDS -# Copy nginx config +# Modify Nginx configuration file and copy it to Nginx conf directory +sudo sed -i "s@__PATH__@$app@g" ../conf/nginx.conf* +sudo sed -i "s@__FINALPATH__@$final_path@g" ../conf/nginx.conf* sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf # Install crontab diff --git a/scripts/restore b/scripts/restore index 5860e2c..30666df 100644 --- a/scripts/restore +++ b/scripts/restore @@ -162,7 +162,9 @@ yarn install --pure-lockfile #RAILS_ENV=production bin/bundle exec rails assets:precompile RCOMMANDS -# Restore nginx configuration files +# Modify Nginx configuration file and copy it to Nginx conf directory +sudo sed -i "s@__PATH__@$app@g" ./nginx.conf +sudo sed -i "s@__FINALPATH__@$final_path@g" ./nginx.conf sudo cp -a ./nginx.conf "$nginx_conf" # Restore crontab sudo cp -a ./cron.conf "$crontab_conf" diff --git a/scripts/upgrade b/scripts/upgrade index 4308838..dae1d8d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -31,7 +31,7 @@ db_name=$app # Modify Nginx configuration file and copy it to Nginx conf directory sudo sed -i "s@__PATH__@$app@g" ../conf/nginx.conf* -sudo sed -i "s@__FINALPATH__@$final_path/@g" ../conf/nginx.conf* +sudo sed -i "s@__FINALPATH__@$final_path@g" ../conf/nginx.conf* sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf # Stop Mastodon Services -- cgit v1.2.3-70-g09d2