mirror of
https://github.com/YunoHost-Apps/snserver_ynh.git
synced 2024-09-03 20:26:22 +02:00
Update scripts install, remove
This commit is contained in:
parent
5e9fd46284
commit
9137826c9a
3 changed files with 141 additions and 104 deletions
|
@ -3,16 +3,20 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
RUBY_VERSION="2.7.3"
|
#RUBY_VERSION="2.7.3"
|
||||||
|
NODEJS_VERSION="15.11.0"
|
||||||
|
|
||||||
# dependencies used by the app
|
# dependencies used by the app
|
||||||
pkg_dependencies="\
|
pkg_dependencies=""
|
||||||
zlib1g-dev \
|
|
||||||
libsqlite3-dev \
|
#pkg_dependencies="\
|
||||||
default-libmysqlclient-dev \
|
# zlib1g-dev \
|
||||||
libssl-dev \
|
# libsqlite3-dev \
|
||||||
libreadline-dev \
|
# default-libmysqlclient-dev \
|
||||||
libjemalloc-dev"
|
# libssl-dev \
|
||||||
|
# libreadline-dev \
|
||||||
|
# libjemalloc-dev \
|
||||||
|
# "
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
|
|
202
scripts/install
202
scripts/install
|
@ -67,9 +67,17 @@ ynh_app_setting_set --app=$app --key=redis_db --value="$redis_db"
|
||||||
ynh_script_progression --message="Finding an available port..." --weight=1
|
ynh_script_progression --message="Finding an available port..." --weight=1
|
||||||
|
|
||||||
# Find an available port
|
# Find an available port
|
||||||
port=$(ynh_find_port --port=3000)
|
port_syncing_server_js=$(ynh_find_port --port=3000)
|
||||||
|
port_syncing_server_js_worker=$(ynh_find_port --port=$((port_syncing_server_js+1)))
|
||||||
|
port_auth=$(ynh_find_port --port=$((port_syncing_server_js_worker+1)))
|
||||||
|
port_auth_worker=$(ynh_find_port --port=$((port_auth+1)))
|
||||||
|
port_api_gateway=$(ynh_find_port --port=$((port_autho_worker+1)))
|
||||||
# Open the port
|
# Open the port
|
||||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
ynh_app_setting_set --app=$app --key=port --value=$port_syncing_server_js
|
||||||
|
ynh_app_setting_set --app=$app --key=port --value=$port_syncing_server_js_worker
|
||||||
|
ynh_app_setting_set --app=$app --key=port --value=$port_auth
|
||||||
|
ynh_app_setting_set --app=$app --key=port --value=$port_auth_worker
|
||||||
|
ynh_app_setting_set --app=$app --key=port --value=$port_api_gateway
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
|
@ -77,7 +85,8 @@ ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
ynh_script_progression --message="Installing dependencies..." --weight=17
|
ynh_script_progression --message="Installing dependencies..." --weight=17
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
ynh_install_ruby --ruby_version=$RUBY_VERSION
|
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||||
|
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A MYSQL DATABASE
|
# CREATE A MYSQL DATABASE
|
||||||
|
@ -96,8 +105,12 @@ ynh_script_progression --message="Setting up source files..." --weight=2
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
mkdir -p $final_path
|
mkdir -p "$final_path/live"
|
||||||
ynh_setup_source --dest_dir="$final_path/live"
|
ynh_setup_source --source_id=app_syncing-server-js --dest_dir="$final_path/live/syncing-server-js"
|
||||||
|
ynh_setup_source --source_id=app_syncing-server-js --dest_dir="$final_path/live/syncing-server-js-worker"
|
||||||
|
ynh_setup_source --source_id=app_auth --dest_dir="$final_path/live/auth"
|
||||||
|
ynh_setup_source --source_id=app_auth --dest_dir="$final_path/live/auth-worker"
|
||||||
|
ynh_setup_source --source_id=app_api-gateway --dest_dir="$final_path/live/api-gateway"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -118,96 +131,106 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALLING RUBY
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Installing Ruby...( This may take a while... )" --weight=100 #331
|
|
||||||
|
|
||||||
pushd "$final_path/live"
|
|
||||||
ynh_use_ruby
|
|
||||||
ynh_gem update --system --no-document
|
|
||||||
ynh_gem install bundler --no-document
|
|
||||||
popd
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# Setup
|
|
||||||
#=================================================
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Modifying a config file..." --weight=2
|
ynh_script_progression --message="Modifying a config file..." --weight=2
|
||||||
|
|
||||||
config_file="$final_path/live/.env"
|
config_syncing_server_js="$final_path/live/syncing-server-js.env"
|
||||||
cp -f ../conf/env.sample $config_file
|
config_auth="$final_path/live/auth.env"
|
||||||
ynh_replace_string --match_string="EXPOSED_PORT=.*$" --replace_string="EXPOSED_PORT=$port" --target_file="$config_file"
|
config_api_gateway="$final_path/live/api-gateway.env"
|
||||||
secret_key=$(ynh_string_random --length=48 | base64)
|
|
||||||
ynh_replace_string --match_string="SECRET_KEY_BASE=.*$" --replace_string="SECRET_KEY_BASE=$secret_key" --target_file="$config_file"
|
|
||||||
pseudo_key=$(ynh_string_random --length=48 | base64)
|
|
||||||
ynh_replace_string --match_string="PSEUDO_KEY_PARAMS_KEY=.*$" --replace_string="PSEUDO_KEY_PARAMS_KEY=$pseudo_key" --target_file="$config_file"
|
|
||||||
ynh_replace_string --match_string="RAILS_ENV=.*$" --replace_string="RAILS_ENV=production" --target_file="$config_file"
|
|
||||||
ynh_replace_string --match_string="DB_DATABASE=.*$" --replace_string="DB_DATABASE=$db_name" --target_file="$config_file"
|
|
||||||
ynh_replace_string --match_string="DB_USERNAME=.*$" --replace_string="DB_USERNAME=$db_user" --target_file="$config_file"
|
|
||||||
ynh_replace_string --match_string="DB_PASSWORD=.*$" --replace_string="DB_PASSWORD=$db_pwd" --target_file="$config_file"
|
|
||||||
ynh_replace_string --match_string="RAILS_RELATIVE_URL_ROOT=.*$" --replace_string="RAILS_RELATIVE_URL_ROOT=$path_url" --target_file="$config_file"
|
|
||||||
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_replace_string --match_string="RAILS_SERVE_STATIC_FILES=.*$" --replace_string="RAILS_SERVE_STATIC_FILES=true" --target_file="$config_file"
|
|
||||||
ynh_replace_string --match_string="REDIS_URL.*$" --replace_string="REDIS_URL=redis://localhost:6379/$redis_db" --target_file="$config_file"
|
|
||||||
|
|
||||||
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"
|
jwt_sectret=$(ynh_string_random --length=48 | base64)
|
||||||
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$final_path/live/app/views/user_mailer/welcome.html.erb"
|
legacy_jwt_sectret=$(ynh_string_random --length=48 | base64)
|
||||||
|
pseudo_key_params_key=$(ynh_string_random --length=48 | base64)
|
||||||
|
encryption_server_key=$(ynh_string_random --length=32 | base64)
|
||||||
|
|
||||||
|
ynh_app_setting_set --app=$app --key=jwt_sectret --value=$jwt_sectret
|
||||||
|
ynh_app_setting_set --app=$app --key=legacy_jwt_sectret --value=$legacy_jwt_sectret
|
||||||
|
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_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_auth.env.sample" --destination="$config_auth"
|
||||||
|
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
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing Standard Notes - Syncing Server..." --weight=93
|
ynh_script_progression --message="Installing Standard Notes - Syncing Server..." --weight=93
|
||||||
|
|
||||||
chown -R $app: "$final_path"
|
|
||||||
|
|
||||||
pushd "$final_path/live"
|
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 --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 config set with 'development'
|
||||||
ynh_exec_as $app $ynh_ruby_load_path bin/bundle install -j$(getconf _NPROCESSORS_ONLN)
|
#ynh_exec_as $app $ynh_ruby_load_path bin/bundle install -j$(getconf _NPROCESSORS_ONLN)
|
||||||
ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails db:migrate --quiet
|
pushd "$final_path/live/syncing-server-js"
|
||||||
ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails db:seed --quiet
|
ynh_exec_as $app env PATH=$ynh_node_load_PATH yarn install --pure-lockfile
|
||||||
# ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:precompile --quiet
|
ynh_exec_as $app env PATH=$ynh_node_load_PATH yarn build
|
||||||
|
popd
|
||||||
|
pushd "$final_path/live/syncing-server-js-worker"
|
||||||
|
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 build
|
||||||
|
popd
|
||||||
|
pushd "$final_path/live/auth"
|
||||||
|
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 build
|
||||||
|
popd
|
||||||
|
pushd "$final_path/live/auth-worker"
|
||||||
|
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 build
|
||||||
|
popd
|
||||||
|
pushd "$final_path/live/api-gateway"
|
||||||
|
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 build
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALLING Standard Notes - Extensions
|
# INSTALLING Standard Notes - Extensions
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing Standard Notes - Extensions..." --weight=1
|
#ynh_script_progression --message="Installing Standard Notes - Extensions..." --weight=1
|
||||||
|
#
|
||||||
|
#
|
||||||
if [ $path_url = "/" ]
|
#if [ $path_url = "/" ]
|
||||||
then
|
#then
|
||||||
path=""
|
# path=""
|
||||||
else
|
#else
|
||||||
path=$path_url
|
# path=$path_url
|
||||||
fi
|
#fi
|
||||||
|
#
|
||||||
ynh_replace_string --match_string="__DOMAIN__PATH__" --replace_string="$domain$path" --target_file="$final_path/live/public/extensions/repo.json"
|
#ynh_replace_string --match_string="__DOMAIN__PATH__" --replace_string="$domain$path" --target_file="$final_path/live/public/extensions/repo.json"
|
||||||
|
#
|
||||||
find "$final_path/live/public/extensions/src/" -name "*.json" -print0 | while read -d $'\0' file
|
#find "$final_path/live/public/extensions/src/" -name "*.json" -print0 | while read -d $'\0' file
|
||||||
do
|
#do
|
||||||
ynh_replace_string --match_string="__DOMAIN__PATH__" --replace_string="$domain$path" --target_file="$file"
|
# ynh_replace_string --match_string="__DOMAIN__PATH__" --replace_string="$domain$path" --target_file="$file"
|
||||||
done
|
#done
|
||||||
|
#
|
||||||
find "../conf/" -name "ext_*.src" -print0 | while read -d $'\0' file
|
#find "../conf/" -name "ext_*.src" -print0 | while read -d $'\0' file
|
||||||
do
|
#do
|
||||||
basename=$(basename -as .src $file)
|
#basename=$(basename -as .src $file)
|
||||||
ynh_setup_source --dest_dir="$final_path/live/public/extensions/src/${basename#'ext_'}" --source_id="$basename"
|
# ynh_setup_source --dest_dir="$final_path/live/public/extensions/src/${basename#'ext_'}" --source_id="$basename"
|
||||||
done
|
#done
|
||||||
|
#
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring a systemd service..." --weight=4
|
ynh_script_progression --message="Configuring a systemd service..." --weight=4
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config --service="$app-syncing-server-js" --template="systemd_syncing-server-js"
|
||||||
|
ynh_add_systemd_config --service="$app-syncing-server-js-worker" --template="systemd_syncing-server-js-worker"
|
||||||
|
ynh_add_systemd_config --service="$app-auth" --template="systemd_auth"
|
||||||
|
ynh_add_systemd_config --service="$app-auth-worker" --template="systemd_auth-worker"
|
||||||
|
ynh_add_systemd_config --service="$app-api-gateway" --template="systemd_api-gateway"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
# STORE THE CONFIG FILE CHECKSUM
|
||||||
|
@ -215,7 +238,9 @@ ynh_add_systemd_config
|
||||||
ynh_script_progression --message="Storing the config file checksum..." --weight=1
|
ynh_script_progression --message="Storing the config file checksum..." --weight=1
|
||||||
|
|
||||||
# Calculate and store the config file checksum into the app settings
|
# Calculate and store the config file checksum into the app settings
|
||||||
ynh_store_file_checksum --file="$config_file"
|
ynh_store_file_checksum --file="$onfig_syncing_server_js"
|
||||||
|
ynh_store_file_checksum --file="$onfig_auth"
|
||||||
|
ynh_store_file_checksum --file="$onfig_api_gateway"
|
||||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -231,10 +256,10 @@ chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R $app: "$final_path"
|
chown -R $app: "$final_path"
|
||||||
|
|
||||||
mkdir -p "$final_path/live/log"
|
#mkdir -p "$final_path/live/log"
|
||||||
chown -R $app: "$final_path/live/log/"
|
#chown -R $app: "$final_path/live/log/"
|
||||||
mkdir -p "$final_path/live/tmp"
|
#mkdir -p "$final_path/live/tmp"
|
||||||
chown -R $app: "$final_path/live/tmp/"
|
#chown -R $app: "$final_path/live/tmp/"
|
||||||
|
|
||||||
mkdir -p "/var/log/$app"
|
mkdir -p "/var/log/$app"
|
||||||
chown -R $app: "/var/log/$app"
|
chown -R $app: "/var/log/$app"
|
||||||
|
@ -245,15 +270,23 @@ chown -R $app: "/var/log/$app"
|
||||||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||||
|
|
||||||
# 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="$final_path/live/log/production.log"
|
||||||
ynh_use_logrotate --logfile="/var/log/$app/$app.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/auth.log"
|
||||||
|
ynh_use_logrotate --logfile="/var/log/$app/auth-worker.log"
|
||||||
|
ynh_use_logrotate --logfile="/var/log/$app/api-gateway.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrate $app service in Yunohost..." --weight=1
|
ynh_script_progression --message="Integrate $app service in Yunohost..." --weight=1
|
||||||
|
|
||||||
yunohost service add $app --description "Standard Notes - Syncing Server" --log "/var/log/$app/$app.log"
|
yunohost service add $app --description "Standard Notes - Syncing Server" --log "/var/log/$app/syncing-server-js.log"
|
||||||
|
yunohost service add $app --description "Standard Notes - Syncing Server - Worker" --log "/var/log/$app/syncing-server-js-worker.log"
|
||||||
|
yunohost service add $app --description "Standard Notes - Auth" --log "/var/log/$app/auth.log"
|
||||||
|
yunohost service add $app --description "Standard Notes - Auth - Worker" --log "/var/log/$app/auth-worker.log"
|
||||||
|
yunohost service add $app --description "Standard Notes - API Gateway" --log "/var/log/$app/api-gateway.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP FAIL2BAN
|
# SETUP FAIL2BAN
|
||||||
|
@ -261,7 +294,6 @@ yunohost service add $app --description "Standard Notes - Syncing Server" --log
|
||||||
ynh_script_progression --message="Configuring fail2ban..." --weight=1
|
ynh_script_progression --message="Configuring fail2ban..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated fail2ban config
|
# Create a dedicated fail2ban config
|
||||||
touch "/var/log/$app/$app.log"
|
|
||||||
ynh_add_fail2ban_config --use_template
|
ynh_add_fail2ban_config --use_template
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -283,7 +315,11 @@ fi
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name="$app-syncing-server-js" --action="start" --log_path="/var/log/$app/sycing-server-js.log"
|
||||||
|
ynh_systemd_action --service_name="$app-syncing-server-js-worker" --action="start" --log_path="/var/log/$app/sycing-server-js-worker.log"
|
||||||
|
ynh_systemd_action --service_name="$app-auth" --action="start" --log_path="/var/log/$app/auth.log"
|
||||||
|
ynh_systemd_action --service_name="$app-auth-worker" --action="start" --log_path="/var/log/$app/auth-worker.log"
|
||||||
|
ynh_systemd_action --service_name="$app-api-gateway" --action="start" --log_path="/var/log/$app/api-gateway.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
@ -295,7 +331,7 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
#=================================================
|
#=================================================
|
||||||
# WAITING FOR SERVICE
|
# WAITING FOR SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Waiting for service..." --weight=1
|
ynh_script_progression --message="Waiting for services..." --weight=1
|
||||||
|
|
||||||
is_service_ready
|
is_service_ready
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,11 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port_syncing_server_js=$(ynh_app_setting_get --app=$app --key=port_syncing_server_js)
|
||||||
|
port_syncing_server_js_worker=$(ynh_app_setting_get --app=$app --key=port_syncing_server_js_worker)
|
||||||
|
port_auth=$(ynh_app_setting_get --app=$app --key=port_auth)
|
||||||
|
port_auth_worker=$(ynh_app_setting_get --app=$app --key=port_auth_worker)
|
||||||
|
port_api_gateway=$(ynh_app_setting_get --app=$app --key=port_api_gateway)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
@ -43,7 +47,11 @@ fi
|
||||||
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
|
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
|
||||||
|
|
||||||
# Remove the dedicated systemd config
|
# Remove the dedicated systemd config
|
||||||
ynh_remove_systemd_config --service="$app"
|
ynh_remove_systemd_config --service="$app-syncing-server-js"
|
||||||
|
ynh_remove_systemd_config --service="$app-syncing-server-js-worker"
|
||||||
|
ynh_remove_systemd_config --service="$app-auth"
|
||||||
|
ynh_remove_systemd_config --service="$app-auth-worker"
|
||||||
|
ynh_remove_systemd_config --service="$app-api-gateway"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE MYSQL DATABASE
|
# REMOVE THE MYSQL DATABASE
|
||||||
|
@ -66,7 +74,6 @@ ynh_redis_remove_db
|
||||||
ynh_script_progression --message="Removing dependencies..." --weight=10
|
ynh_script_progression --message="Removing dependencies..." --weight=10
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_ruby
|
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -94,16 +101,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight
|
||||||
ynh_remove_logrotate
|
ynh_remove_logrotate
|
||||||
ynh_secure_remove --file="/var/log/$app"
|
ynh_secure_remove --file="/var/log/$app"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CLOSE A PORT
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
if yunohost firewall list | grep -q "\- $port$"
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Closing port $port..."
|
|
||||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE FAIL2BAN CONFIGURATION
|
# REMOVE FAIL2BAN CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue