1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/snserver_ynh.git synced 2024-09-03 20:26:22 +02:00
This commit is contained in:
Fabian Wilkens 2021-07-08 22:27:05 +02:00
parent dd33af7a3d
commit df16fa56da
No known key found for this signature in database
GPG key ID: 23DFA025BB4E9FAB
3 changed files with 46 additions and 76 deletions

View file

@ -40,11 +40,6 @@ access_domain=$(ynh_app_setting_get --app=$app --key=access_domain)
access_domain=$(echo $access_domain | sed "s@;@ @g") access_domain=$(echo $access_domain | sed "s@;@ @g")
mail=$(ynh_app_setting_get --app=$app --key=mail) mail=$(ynh_app_setting_get --app=$app --key=mail)
# Add settings here as needed by your application
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#db_user=$db_name
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
@ -81,12 +76,6 @@ fi
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
# STOP SYSTEMD SERVICE
#=================================================
#ynh_script_progression --message="Stopping a systemd service..." --weight=1
#
#ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
@ -132,16 +121,16 @@ else
fi fi
ynh_replace_string \ ynh_replace_string \
--match_string='url": "https://.*/extensions/src/' \ --match_string='url": "https://.*/extensions/src/' \
--replace_string='url": "https://'$domain$path'/extensions/src/' \ --replace_string='url": "https://'$domain$path'/extensions/src/' \
--target_file="$final_path_extensions/repo.json" --target_file="$final_path_extensions/repo.json"
find "$final_path_extensions/src/" -name "*.json" -print0 | while read -d $'\0' file find "$final_path_extensions/src/" -name "*.json" -print0 | while read -d $'\0' file
do do
ynh_replace_string \ ynh_replace_string \
--match_string='url": "https://.*/extensions/src/' \ --match_string='url": "https://.*/extensions/src/' \
--replace_string='url": "https://'$domain$path'extensions/src/' \ --replace_string='url": "https://'$domain$path'extensions/src/' \
--target_file="$file" --target_file="$file"
done done
#================================================= #=================================================
@ -158,12 +147,6 @@ ynh_add_fail2ban_config --use_template
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION
#================================================= #=================================================
# START SYSTEMD SERVICE
#=================================================
#ynh_script_progression --message="Starting a systemd service..." --weight=2
#
#ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================

View file

@ -188,21 +188,12 @@ ynh_app_setting_set --app=$app --key=auth_jwt_secret --value=$auth_jwt_secret
ynh_app_setting_set --app=$app --key=pseudo_key_params_key --value=$pseudo_key_params_key ynh_app_setting_set --app=$app --key=pseudo_key_params_key --value=$pseudo_key_params_key
ynh_app_setting_set --app=$app --key=encryption_server_key --value=$encryption_server_key ynh_app_setting_set --app=$app --key=encryption_server_key --value=$encryption_server_key
#ynh_replace_string --match_string="SMTP_HOST=.*$" --replace_string="SMTP_HOST=localhost" --target_file="$config_file"
#ynh_replace_string --match_string="SMTP_PORT=.*$" --replace_string="SMTP_PORT=25" --target_file="$config_file"
#ynh_replace_string --match_string="SMTP_DOMAIN=.*$" --replace_string="SMTP_DOMAIN=localhost" --target_file="$config_file"
#ynh_replace_string --match_string="SMTP_STARTTLS=.*$" --replace_string="SMTP_STARTTLS=" --target_file="$config_file"
ynh_add_config --template="env_syncing-server-js.env.sample" --destination="$config_syncing_server_js" ynh_add_config --template="env_syncing-server-js.env.sample" --destination="$config_syncing_server_js"
ynh_add_config --template="env_syncing-server-js-worker.env.sample" --destination="$config_syncing_server_js_worker" ynh_add_config --template="env_syncing-server-js-worker.env.sample" --destination="$config_syncing_server_js_worker"
ynh_add_config --template="env_auth.env.sample" --destination="$config_auth" ynh_add_config --template="env_auth.env.sample" --destination="$config_auth"
ynh_add_config --template="env_auth-worker.env.sample" --destination="$config_auth_worker" ynh_add_config --template="env_auth-worker.env.sample" --destination="$config_auth_worker"
ynh_add_config --template="env_api-gateway.env.sample" --destination="$config_api_gateway" ynh_add_config --template="env_api-gateway.env.sample" --destination="$config_api_gateway"
#ynh_replace_string --match_string="__MAIL__" --replace_string="$mail" --target_file="$final_path/live/app/mailers/application_mailer.rb"
#ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/live/app/views/user_mailer/welcome.html.erb"
#ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$final_path/live/app/views/user_mailer/welcome.html.erb"
#================================================= #=================================================
# INSTALLING Standard Notes - Syncing Server # INSTALLING Standard Notes - Syncing Server
#================================================= #=================================================
@ -210,9 +201,6 @@ ynh_script_progression --message="Installing Standard Notes - Syncing Server..."
ynh_use_nodejs ynh_use_nodejs
#ynh_exec_as $app $ynh_ruby_load_path bin/bundle config set --local path 'vendor/bundle'
#ynh_exec_as $app $ynh_ruby_load_path bin/bundle config set with 'development'
#ynh_exec_as $app $ynh_ruby_load_path bin/bundle install -j$(getconf _NPROCESSORS_ONLN)
pushd "$final_path/live/syncing-server-js" pushd "$final_path/live/syncing-server-js"
ynh_print_info "Installing ... [1/5]" ynh_print_info "Installing ... [1/5]"
ynh_exec_as $app env PATH=$ynh_node_load_PATH yarn install --pure-lockfile ynh_exec_as $app env PATH=$ynh_node_load_PATH yarn install --pure-lockfile
@ -296,7 +284,6 @@ mkdir -p "/var/log/$app"
chown -R "$app": "/var/log/$app" chown -R "$app": "/var/log/$app"
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
#ynh_use_logrotate --logfile="$final_path/live/log/production.log"
ynh_use_logrotate --logfile="/var/log/$app/syncing-server.log" ynh_use_logrotate --logfile="/var/log/$app/syncing-server.log"
ynh_use_logrotate --logfile="/var/log/$app/syncing-server-worker.log" ynh_use_logrotate --logfile="/var/log/$app/syncing-server-worker.log"
ynh_use_logrotate --logfile="/var/log/$app/auth.log" ynh_use_logrotate --logfile="/var/log/$app/auth.log"
@ -342,30 +329,30 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service # Start a systemd service
ynh_systemd_action \ ynh_systemd_action \
--service_name="$app-syncing-server-js" \ --service_name="$app-syncing-server-js" \
--action="start" \ --action="start" \
--log_path="/var/log/$app/syncing-server-js.log" \ --log_path="/var/log/$app/syncing-server-js.log" \
--line_match='{"message":"Server started on port '$port_syncing_server_js'","level":"info"}' --line_match='{"message":"Server started on port '$port_syncing_server_js'","level":"info"}'
ynh_systemd_action \ ynh_systemd_action \
--service_name="$app-syncing-server-js-worker" \ --service_name="$app-syncing-server-js-worker" \
--action="start" \ --action="start" \
--log_path="/var/log/$app/syncing-server-js-worker.log" \ --log_path="/var/log/$app/syncing-server-js-worker.log" \
--line_match='{"message":"Starting worker...","level":"info"}' --line_match='{"message":"Starting worker...","level":"info"}'
ynh_systemd_action \ ynh_systemd_action \
--service_name="$app-auth" \ --service_name="$app-auth" \
--action="start" \ --action="start" \
--log_path="/var/log/$app/auth.log" \ --log_path="/var/log/$app/auth.log" \
--line_match='{"message":"Server started on port '$port_auth'","level":"info"}' --line_match='{"message":"Server started on port '$port_auth'","level":"info"}'
ynh_systemd_action \ ynh_systemd_action \
--service_name="$app-auth-worker" \ --service_name="$app-auth-worker" \
--action="start" \ --action="start" \
--log_path="/var/log/$app/auth-worker.log" \ --log_path="/var/log/$app/auth-worker.log" \
--line_match='{"message":"Starting worker...","level":"info"}' --line_match='{"message":"Starting worker...","level":"info"}'
ynh_systemd_action \ ynh_systemd_action \
--service_name="$app-api-gateway" \ --service_name="$app-api-gateway" \
--action="start" \ --action="start" \
--log_path="/var/log/$app/api-gateway.log" \ --log_path="/var/log/$app/api-gateway.log" \
--line_match='{"message":"Server started on port '$port_api_gateway'","level":"info"}' --line_match='{"message":"Server started on port '$port_api_gateway'","level":"info"}'
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX

View file

@ -195,30 +195,30 @@ yunohost service add "$app-api-gateway" --description="Standard Notes - API Gate
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action \ ynh_systemd_action \
--service_name="$app-syncing-server-js" \ --service_name="$app-syncing-server-js" \
--action="start" \ --action="start" \
--log_path="/var/log/$app/syncing-server-js.log" \ --log_path="/var/log/$app/syncing-server-js.log" \
--line_match='{"message":"Server started on port '$port_syncing_server_js'","level":"info"}' --line_match='{"message":"Server started on port '$port_syncing_server_js'","level":"info"}'
ynh_systemd_action \ ynh_systemd_action \
--service_name="$app-syncing-server-js-worker" \ --service_name="$app-syncing-server-js-worker" \
--action="start" \ --action="start" \
--log_path="/var/log/$app/syncing-server-js-worker.log" \ --log_path="/var/log/$app/syncing-server-js-worker.log" \
--line_match='{"message":"Starting worker...","level":"info"}' --line_match='{"message":"Starting worker...","level":"info"}'
ynh_systemd_action \ ynh_systemd_action \
--service_name="$app-auth" \ --service_name="$app-auth" \
--action="start" \ --action="start" \
--log_path="/var/log/$app/auth.log" \ --log_path="/var/log/$app/auth.log" \
--line_match='{"message":"Server started on port '$port_auth'","level":"info"}' --line_match='{"message":"Server started on port '$port_auth'","level":"info"}'
ynh_systemd_action \ ynh_systemd_action \
--service_name="$app-auth-worker" \ --service_name="$app-auth-worker" \
--action="start" \ --action="start" \
--log_path="/var/log/$app/auth-worker.log" \ --log_path="/var/log/$app/auth-worker.log" \
--line_match='{"message":"Starting worker...","level":"info"}' --line_match='{"message":"Starting worker...","level":"info"}'
ynh_systemd_action \ ynh_systemd_action \
--service_name="$app-api-gateway" \ --service_name="$app-api-gateway" \
--action="start" \ --action="start" \
--log_path="/var/log/$app/api-gateway.log" \ --log_path="/var/log/$app/api-gateway.log" \
--line_match='{"message":"Server started on port '$port_api_gateway'","level":"info"}' --line_match='{"message":"Server started on port '$port_api_gateway'","level":"info"}'
#================================================= #=================================================
# RESTORE THE LOGROTATE CONFIGURATION # RESTORE THE LOGROTATE CONFIGURATION