From 4d51ffe2d72e9326e645f95179c827ccf109dad2 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 2 Jan 2020 22:52:32 +0100 Subject: [PATCH 01/10] Update backup --- scripts/backup | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/backup b/scripts/backup index 1a7912d..578a8b0 100644 --- a/scripts/backup +++ b/scripts/backup @@ -13,6 +13,7 @@ source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= +ynh_print_info --message="Managing script failure..." ynh_clean_setup () { ynh_clean_check_starting From 7ad16abcc3957b5be61b2d317648054ad22cdd71 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 8 Jan 2020 23:33:20 +0100 Subject: [PATCH 02/10] Moving log to error level --- conf/.env | 2 +- conf/prod.exs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/.env b/conf/.env index 592e830..3c79767 100644 --- a/conf/.env +++ b/conf/.env @@ -11,7 +11,7 @@ GRAPHQL_API_FULL_PATH="" # APP MIX_ENV=prod -MOBILIZON_LOGLEVEL="info" +MOBILIZON_LOGLEVEL="error" MOBILIZON_SECRET="__SECRET__" # Database diff --git a/conf/prod.exs b/conf/prod.exs index 59a2308..cdf0632 100644 --- a/conf/prod.exs +++ b/conf/prod.exs @@ -45,7 +45,7 @@ config :mobilizon, MobilizonWeb.Email.Mailer, no_mx_lookups: false # Do not print debug messages in production -#config :logger, level: System.get_env("MOBILIZON_LOGLEVEL") |> String.to_atom() || :info +config :logger, level: System.get_env("MOBILIZON_LOGLEVEL") |> String.to_atom() || :info config :mobilizon, Mobilizon.Service.Geospatial, service: Mobilizon.Service.Geospatial.Nominatim From a9eadfcf80a6c39458c5c8b1738afa45ec445876 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 10 Jan 2020 21:07:59 +0100 Subject: [PATCH 03/10] Apply example_ynh --- README.md | 1 - scripts/backup | 4 ++-- scripts/change_url | 24 ++++++++++++++++++++++-- scripts/install | 13 ++++++++++--- scripts/remove | 24 +++++++++++++----------- scripts/restore | 6 +++++- scripts/upgrade | 12 ++++++++---- 7 files changed, 60 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 683df7c..01ac270 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,6 @@ exit * x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/mobilizon%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/mobilizon/) * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/mobilizon%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/mobilizon/) -* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/mobilizon%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/mobilizon/) ## Links diff --git a/scripts/backup b/scripts/backup index 578a8b0..b42b5fe 100644 --- a/scripts/backup +++ b/scripts/backup @@ -39,7 +39,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd #================================================= # BACKUP THE APP MAIN DIR @@ -76,7 +76,7 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access MobilizonWeb.Endpoint at" #================================================= # END OF SCRIPT diff --git a/scripts/change_url b/scripts/change_url index 9f6c8df..7453e00 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -34,6 +34,23 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #db_user=$db_name #db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_print_info --message="Backing up the app before changing its url (may take a while)..." + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. + ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + + # restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= @@ -57,7 +74,7 @@ fi #================================================= ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --action=stop --service_name=$app +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped" #================================================= # MODIFY URL IN NGINX CONF @@ -93,6 +110,7 @@ fi #================================================= # MODIFY A CONFIG FILE #================================================= +ynh_print_info --message="Modifying a config file..." ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="$final_path/$app/.env" ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="$final_path/$app/config/prod.secret.exs" @@ -100,6 +118,7 @@ ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" - #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= +ynh_print_info --message="Storing the config file checksum..." ynh_backup_if_checksum_is_different --file="$final_path/$app/.env" # Recalculate and store the checksum of the file for the next upgrade. @@ -110,8 +129,9 @@ ynh_store_file_checksum --file="$final_path/$app/.env" #================================================= # START SYSTEMD SERVICE #================================================= +ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Access MobilizonWeb.Endpoint at" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access MobilizonWeb.Endpoint at" #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index bdaa61a..092f7cc 100644 --- a/scripts/install +++ b/scripts/install @@ -13,6 +13,7 @@ source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= +ynh_print_info --message="Managing script failure..." ynh_clean_setup () { ynh_clean_check_starting @@ -23,6 +24,7 @@ ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= +ynh_print_info --message="Retrieving arguments from the manifest..." domain=$YNH_APP_ARG_DOMAIN path_url="/" @@ -69,7 +71,7 @@ ynh_app_setting_set --app=$app --key=admin_email --value=$admin_email #================================================= ynh_print_info --message="Configuring firewall..." -# Find a free port +# Find an available port port=$(ynh_find_port --port=8095) ynh_app_setting_set --app=$app --key=port --value=$port @@ -141,6 +143,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # MODIFY A CONFIG FILE #================================================= +ynh_print_info --message="Modifying a config file..." config="$final_path/$app/.env" cp ../conf/.env "$config" @@ -157,6 +160,7 @@ ynh_replace_string --match_string="__ADMIN_EMAIL__" --replace_string="$admin_ema #================================================= # MAKE SETUP #================================================= +ynh_print_info --message="Making setup..." # Temporarly bypass error : WARNING ** (ArgumentError) argument error and System.get_env doesn't load environment variables @@ -211,21 +215,24 @@ ynh_store_file_checksum --file="$config" #================================================= # SECURE FILES AND DIRECTORIES #================================================= +ynh_print_info --message="Securing files and directories..." # Set permissions to app files chown -R "$app":"$app" "$final_path" #================================================= -# ADVERTISE SERVICE IN ADMIN PANEL +# INTEGRATE SERVICE IN YUNOHOST #================================================= +ynh_print_info --message="Integrating service in YunoHost..." -# if using yunohost version 3.2 or more in the 'manifest.json', a description can be added yunohost service add $app --description "$app daemon for Mobilizon" #================================================= # START SYSTEMD SERVICE #================================================= +ynh_print_info --message="Starting a systemd service..." +# Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access MobilizonWeb.Endpoint at" #================================================= diff --git a/scripts/remove b/scripts/remove index 03552d5..6f8698a 100644 --- a/scripts/remove +++ b/scripts/remove @@ -25,11 +25,12 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # STANDARD REMOVE #================================================= -# REMOVE SERVICE FROM ADMIN PANEL +# REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= +ynh_print_info --message="Removing service integration in YunoHost..." -# Remove a service from the admin panel, added by `yunohost service add` -if yunohost service status $app >/dev/null 2>&1 +# Remove the service from the list of services known by Yunohost (added from `yunohost service add`) +if ynh_exec_warn_less yunohost service status $app >/dev/null then ynh_print_info --message="Removing $app service..." yunohost service remove $app @@ -38,7 +39,7 @@ fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_print_info --message="Stopping and removing the systemd service" +ynh_print_info --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config @@ -46,7 +47,7 @@ ynh_remove_systemd_config #================================================= # REMOVE THE POSTGRESQL DATABASE #================================================= -ynh_print_info --message="Removing the PostgreSQL database" +ynh_print_info --message="Removing the PostgreSQL database..." # Remove a database if it exists, along with the associated user ynh_psql_remove_db --db_user=$db_user --db_name=$db_name @@ -54,7 +55,7 @@ ynh_psql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_print_info --message="Removing dependencies" +ynh_print_info --message="Removing dependencies..." # Remove metapackage and its dependencies ynh_remove_app_dependencies @@ -64,7 +65,7 @@ ynh_remove_nodejs #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_print_info --message="Removing app main directory" +ynh_print_info --message="Removing app main directory..." # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -72,7 +73,7 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_print_info --message="Removing nginx web server configuration" +ynh_print_info --message="Removing nginx web server configuration..." # Remove the dedicated nginx config ynh_remove_nginx_config @@ -84,15 +85,16 @@ ynh_print_info --message="Closing a port..." if yunohost firewall list | grep -q "\- $port$" then - ynh_script_progression --message="Closing port $port..." + ynh_print_info --message="Closing port $port..." ynh_exec_warn_less yunohost firewall disallow TCP $port fi #================================================= # SPECIFIC REMOVE #================================================= -# REMOVE THE CRON FILE +# REMOVE THE LOG FILE #================================================= +ynh_print_info --message="Removing the log files..." # Remove the log files ynh_secure_remove --file="/var/log/$app/" @@ -102,7 +104,7 @@ ynh_secure_remove --file="/var/log/$app/" #================================================= # REMOVE DEDICATED USER #================================================= -ynh_print_info --message="Removing the dedicated system user" +ynh_print_info --message="Removing the dedicated system user..." # Delete a system user ynh_system_user_delete --username=$app diff --git a/scripts/restore b/scripts/restore index 62ab575..f5710fe 100644 --- a/scripts/restore +++ b/scripts/restore @@ -14,6 +14,7 @@ source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= +ynh_print_info --message="Managing script failure..." ynh_clean_setup () { ynh_clean_check_starting @@ -72,6 +73,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # RESTORE USER RIGHTS #================================================= +ynh_print_info --message="Restoring user rights..." # Restore permissions on app files chown -R "$app":"$app" "$final_path" @@ -114,14 +116,16 @@ ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service #================================================= -# ADVERTISE SERVICE IN ADMIN PANEL +# INTEGRATE SERVICE IN YUNOHOST #================================================= +ynh_print_info --message="Integrating service in YunoHost..." yunohost service add $app --description "$app daemon for Mobilizon" #================================================= # START SYSTEMD SERVICE #================================================= +ynh_print_info --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access MobilizonWeb.Endpoint at" diff --git a/scripts/upgrade b/scripts/upgrade index 14e2222..34d591a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -85,7 +85,7 @@ ynh_abort_if_errors #================================================= ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -93,7 +93,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." --time --weight=1 + ynh_print_info --message="Upgrading source files..." # Create a temporary directory tmpdir="$(mktemp -d)" @@ -149,6 +149,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # MODIFY A CONFIG FILE #================================================= +ynh_print_info --message="Modifying a config file..." config="$final_path/$app/.env" ynh_backup_if_checksum_is_different --file="$config" @@ -166,6 +167,7 @@ ynh_replace_string --match_string="__ADMIN_EMAIL__" --replace_string="$admin_ema #================================================= # MAKE SETUP #================================================= +ynh_print_info --message="Making setup..." # Temporarly bypass error : WARNING ** (ArgumentError) argument error and System.get_env doesn't load environment variables @@ -199,7 +201,8 @@ popd #================================================= # STORE THE CONFIG FILE CHECKSUM -#================================================= +#=ynh_print_info --message="Storing the config file checksum..." +================================================ # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="$config" @@ -217,6 +220,7 @@ ynh_add_systemd_config #================================================= # SECURE FILES AND DIRECTORIES #================================================= +ynh_print_info --message="Securing files and directories..." # Set permissions on app files chown -R "$app":"$app" "$final_path" @@ -234,7 +238,7 @@ then fi #================================================= -# START SERVICE +# START SYSTEMD SERVICE #================================================= ynh_print_info --message="Starting a systemd service..." From efe0bf03564528855a854326881b37890ba6c118 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 10 Jan 2020 21:14:13 +0100 Subject: [PATCH 04/10] removing warning --- check_process | 1 - manifest.json | 9 --------- 2 files changed, 10 deletions(-) diff --git a/check_process b/check_process index a195ceb..1f9a30a 100644 --- a/check_process +++ b/check_process @@ -1,6 +1,5 @@ ;; Test complet ; Manifest - warning="Understood" domain="domain.tld" (DOMAIN) admin="john" (USER) language="fr" diff --git a/manifest.json b/manifest.json index bb2052f..551b574 100644 --- a/manifest.json +++ b/manifest.json @@ -21,15 +21,6 @@ ], "arguments": { "install" : [ - { - "name": "warning", - "type": "string", - "ask": { - "text": "\nMobilizon is in early development, a lot of features are not implemented.\n\nFor advanced testing use only.\n\n" - }, - "choices": ["Understood"], - "default": "Understood" - }, { "name": "domain", "type": "domain", From 4773c4b81b39ec1356c9db3984fe89583b61ff7f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 10 Jan 2020 21:31:05 +0100 Subject: [PATCH 05/10] remove GeoLite2-City --- scripts/install | 2 -- scripts/remove | 5 ++++- scripts/upgrade | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index bdaa61a..2122a4f 100644 --- a/scripts/install +++ b/scripts/install @@ -188,8 +188,6 @@ pushd $final_path/$app sudo -u "$app" MIX_ENV=prod mix phx.digest popd -curl http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz --output GeoLite2-City.tar.gz -s && tar zxf GeoLite2-City.tar.gz && mkdir -p /usr/share/GeoIP && mv GeoLite2-City_*/GeoLite2-City.mmdb $final_path/$app/priv/data/GeoLite2-City.mmdb - #================================================= # SETUP SYSTEMD #================================================= diff --git a/scripts/remove b/scripts/remove index 03552d5..f169aa2 100644 --- a/scripts/remove +++ b/scripts/remove @@ -95,7 +95,10 @@ fi #================================================= # Remove the log files -ynh_secure_remove --file="/var/log/$app/" +ynh_secure_remove --file="/var/log/$app" + +# Remove the GeoIP folder +ynh_secure_remove --file="/usr/share/GeoIP" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 14e2222..8b3efa9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -63,6 +63,10 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi +ynh_secure_remove --file="$final_path/$app/priv/data/GeoLite2-City.mmdb" + +ynh_secure_remove --file="/usr/share/GeoIP" + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= From f939bc10602c94cc58d6a74456bcbb26ce35fcc2 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 10 Jan 2020 21:58:21 +0100 Subject: [PATCH 06/10] typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 683df7c..93df62a 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Mobilizon is a tool designed to create platforms for managing communities and ev 1. Even if requested during installation: admin, language and password variables are not used 1. Admin Dashboard is still not implemented 1. When your mobilizon instance is installed, you need to register. -1. When registered to be admin you have to manually goes in PostgreSQL, database $app, table users, and change the role value to `administrator` instead of `user` (other role available: `moderator`) +1. When registered, to be admin you have to manually goes in PostgreSQL, database $app, table users, and change the role value to `administrator` instead of `user` (other role available: `moderator`) Example to manually put user with id=1 as administrator: ```bash From 811b26797b73676f651043f73f438ce047a44960 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 11 Jan 2020 18:11:00 +0100 Subject: [PATCH 07/10] fix error during compilation ** (ArgumentError) argument error :erlang.binary_to_atom(nil, :utf8) :erlang.binary_to_atom(nil, :utf8) (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6 (stdlib) erl_eval.erl:273: :erl_eval.expr/5 (stdlib) erl_eval.erl:888: :erl_eval.expr_list/6 (stdlib) erl_eval.erl:240: :erl_eval.expr/5 (stdlib) erl_eval.erl:232: :erl_eval.expr/5 (stdlib) erl_eval.erl:888: :erl_eval.expr_list/6 (stdlib) erl_eval.erl:411: :erl_eval.expr/5 --- conf/prod.exs | 2 +- scripts/install | 3 +++ scripts/upgrade | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/conf/prod.exs b/conf/prod.exs index cdf0632..59a2308 100644 --- a/conf/prod.exs +++ b/conf/prod.exs @@ -45,7 +45,7 @@ config :mobilizon, MobilizonWeb.Email.Mailer, no_mx_lookups: false # Do not print debug messages in production -config :logger, level: System.get_env("MOBILIZON_LOGLEVEL") |> String.to_atom() || :info +#config :logger, level: System.get_env("MOBILIZON_LOGLEVEL") |> String.to_atom() || :info config :mobilizon, Mobilizon.Service.Geospatial, service: Mobilizon.Service.Geospatial.Nominatim diff --git a/scripts/install b/scripts/install index bdaa61a..da578c1 100644 --- a/scripts/install +++ b/scripts/install @@ -188,6 +188,9 @@ pushd $final_path/$app sudo -u "$app" MIX_ENV=prod mix phx.digest popd +# Modify log level +ynh_replace_string --match_string="#config :logger" --replace_string="config :logger" --target_file="$final_path/$app/config/prod.exs" + curl http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz --output GeoLite2-City.tar.gz -s && tar zxf GeoLite2-City.tar.gz && mkdir -p /usr/share/GeoIP && mv GeoLite2-City_*/GeoLite2-City.mmdb $final_path/$app/priv/data/GeoLite2-City.mmdb #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 14e2222..3819524 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -189,12 +189,14 @@ pushd $final_path/$app/js popd pushd $final_path/$app + ynh_replace_string --match_string="config :logger" --replace_string="#config :logger" --target_file="$final_path/$app/config/prod.exs" source .env sudo -u "$app" MIX_ENV=prod mix local.hex --force sudo -u "$app" MIX_ENV=prod mix local.rebar --force sudo -u "$app" MIX_ENV=prod mix deps.get sudo -u "$app" MIX_ENV=prod mix ecto.migrate sudo -u "$app" MIX_ENV=prod mix phx.digest + ynh_replace_string --match_string="#config :logger" --replace_string="config :logger" --target_file="$final_path/$app/config/prod.exs" popd #================================================= From 19cbd3a2e7d6d72acf54e063559c0163995dfac7 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 11 Jan 2020 18:15:48 +0100 Subject: [PATCH 08/10] fix error --- scripts/upgrade | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 34d591a..80c5b22 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -201,9 +201,8 @@ popd #================================================= # STORE THE CONFIG FILE CHECKSUM -#=ynh_print_info --message="Storing the config file checksum..." -================================================ - +#================================================= +ynh_print_info --message="Storing the config file checksum..." # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="$config" From 56fa91363eac1e7fa37538608a9b51f5c5b36444 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 11 Jan 2020 20:32:10 +0100 Subject: [PATCH 09/10] Update install --- scripts/install | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index da578c1..b0ed3d8 100644 --- a/scripts/install +++ b/scripts/install @@ -180,17 +180,16 @@ pushd $final_path/$app/js popd pushd $final_path/$app + ynh_replace_string --match_string="config :logger" --replace_string="#config :logger" --target_file="$final_path/$app/config/prod.exs" source .env sudo -u "$app" MIX_ENV=prod mix local.hex --force sudo -u "$app" MIX_ENV=prod mix local.rebar --force sudo -u "$app" MIX_ENV=prod mix deps.get sudo -u "$app" MIX_ENV=prod mix ecto.migrate sudo -u "$app" MIX_ENV=prod mix phx.digest + ynh_replace_string --match_string="#config :logger" --replace_string="config :logger" --target_file="$final_path/$app/config/prod.exs" popd -# Modify log level -ynh_replace_string --match_string="#config :logger" --replace_string="config :logger" --target_file="$final_path/$app/config/prod.exs" - curl http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz --output GeoLite2-City.tar.gz -s && tar zxf GeoLite2-City.tar.gz && mkdir -p /usr/share/GeoIP && mv GeoLite2-City_*/GeoLite2-City.mmdb $final_path/$app/priv/data/GeoLite2-City.mmdb #================================================= From 8f55fb04a037d1221d1f36989c08b684a37c483a Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 19 Jan 2020 18:45:09 +0100 Subject: [PATCH 10/10] fix service --- conf/systemd.service | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index 221a982..ea95f14 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,7 +6,8 @@ After=network.target postgresql.service ExecReload=/bin/kill $MAINPID KillMode=process Restart=on-failure -User=mobilizon +User=__APP__ +Group=__APP__ Environment="MIX_ENV=prod" EnvironmentFile=__FINALPATH__/__APP__/.env