1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/diaspora_ynh.git synced 2024-09-03 18:26:13 +02:00

Fix install script

This commit is contained in:
Augustin Trancart 2019-12-02 21:01:24 +01:00
parent 49fe33865e
commit 00e92cebf6
10 changed files with 1403 additions and 373 deletions

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://github.com/diaspora/diaspora/archive/v0.7.12.0.zip
SOURCE_SUM=8bed8a84a336d51a7983636eab9670d85fdd1fc5
SOURCE_SUM_PRG=sha256
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -1,27 +1,28 @@
postgresql: &postgresql
adapter: postgresql
host: "localhost"
port: 5432
username: "{{ app }}"
password: "{{ db_pass }}"
encoding: unicode
mysql: &mysql mysql: &mysql
adapter: mysql2 adapter: mysql2
host: "localhost" host: "localhost"
port: 3306 port: 3306
username: "DBUSERTOCHANGE" username: "root"
password: "DBPASSTOCHANGE" password: ""
# socket: /tmp/mysql.sock # socket: /tmp/mysql.sock
charset: utf8mb4 encoding: utf8mb4
collation: utf8mb4_bin collation: utf8mb4_bin
postgres: &postgres
adapter: postgresql
host: localhost
port: 5432
username: postgres
password:
encoding: unicode
# Comment the the mysql line and uncomment the postgres line # Comment the postgresql line and uncomment the mysql line
# if you want to use postgres # if you want to use mysql
common: &common common: &common
# Choose one of the following # Choose one of the following
<<: *mysql <<: *postgresql
#<<: *postgres #<<: *mysql
# Should match environment.sidekiq.concurrency # Should match environment.sidekiq.concurrency
#pool: 25 #pool: 25
@ -31,10 +32,9 @@ common: &common
################################################## ##################################################
# Normally you don't need to touch anything here # Normally you don't need to touch anything here
# ynh note: we actually do :-) how about having different database name for
# different instances on the same postgres cluster?
postgres_travis: &postgres_travis
adapter: postgresql
username: postgres
combined: &combined combined: &combined
<<: *common <<: *common
development: development:
@ -42,10 +42,10 @@ development:
database: diaspora_development database: diaspora_development
production: production:
<<: *combined <<: *combined
database: diaspora_production database: {{ app }}
test: test:
<<: *combined <<: *combined
database: "diaspora_test" database: diaspora_test
integration1: integration1:
<<: *combined <<: *combined
database: diaspora_integration1 database: diaspora_integration1

View file

@ -1,18 +0,0 @@
[Unit]
Description=Diaspora social network (worker %i)
PartOf=diaspora.target
StopWhenUnneeded=true
[Service]
User=diaspora
WorkingDirectory=/var/www/diaspora
Environment=RAILS_ENV=production
ExecStart=/var/www/diaspora/.rvm/scripts/extras/chruby.sh 2.2 -- bin/bundle exec sidekiq
Restart=always
CPUAccounting=true
MemoryAccounting=true
BlockIOAccounting=true
[Install]
WantedBy=diaspora.target
DefaultInstance=worker1

View file

@ -1,224 +0,0 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: diaspora_ynh
# Required-Start: $remote_fs $syslog mysql redis-server
# Required-Stop: $remote_fs $syslog mysql redis-server
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Diaspora application server
# Description: Start / stop the Diaspora app server
### END INIT INFO
# Author: FABIAN Tamas Laszlo <giganetom@gmail.com>
# Updated: Pirate Praveen <praveen@debian.org>
# Updated: aymhce <aymhce@gmail.com>
# PATH should only include /usr/* if it runs after the mountnfs.sh script
# Note: /usr/local/bin for foreman gem
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
DESC="Diaspora application server"
NAME=diaspora
DIASPORA_HOME="/var/www/diaspora"
STARTSCRIPT="./script/server"
LOGFILE=$DIASPORA_HOME/log/startscript.log
SCRIPTNAME=$0
USER=diaspora
STARTUP_TIMEOUT=100
. /lib/init/vars.sh
. /lib/lsb/init-functions
check_unicorn() {
pgrep -f "unicorn_rails master"
}
check_sidekiq() {
pgrep -f "sidekiq 3"
}
check_foreman() {
pgrep -f "foreman-runner"
}
check_foreman_start() {
pgrep -f "foreman start"
}
check_script_server() {
pgrep -f "script/server"
}
do_start()
{
if ! touch $LOGFILE; then
log_failure_msg "Could not touch logfile"
return 2
fi
if ! chown $USER $LOGFILE; then
log_failure_msg "Could not chown logfile"
return 2
fi
if check_unicorn && check_sidekiq; then
log_warning_msg "Diaspora is already running"
return 1
fi
if check_foreman || check_foreman_start || check_script_server; then
log_warning_msg "Diaspora is starting"
return 1
fi
export SERVERNAME=localhost
export ENVIRONMENT_URL=http://localhost
export RAILS_ENV=production
export DB=mysql
cd $DIASPORA_HOME
sudo su - $USER -c " . ~/.bashrc && cd $DIASPORA_HOME && $STARTSCRIPT >> $LOGFILE 2>&1 " &
if [ $? -gt 0 ]
then
log_failure_msg "Could not run start script"
return 2
else
log_success_msg "Starting diaspora server..."
return 0
fi
[ "$VERBOSE" != no ] && log_action_msg "Waiting for Diaspora processes... "
c=0
while ! check_unicorn > /dev/null || ! check_sidekiq > /dev/null; do
if [ $c -gt $STARTUP_TIMEOUT ]; then
log_failure_msg "Timeout waiting for Diaspora processes"
return 2
fi
c=`expr $c + 1`
sleep 1
[ "$VERBOSE" != no ] && echo -n "."
done
[ "$VERBOSE" != no ] && log_action_end_msg 0
}
do_stop()
{
for i in `check_unicorn`; do
[ "$VERBOSE" != no ] && log_action_msg "Killing unicorn master with PID $i"
kill -TERM $i
[ "$VERBOSE" != no ] && log_action_end_msg $?
done
for i in `check_sidekiq`; do
[ "$VERBOSE" != no ] && log_action_msg "Killing sidekiq with PID $i"
kill -TERM $i
[ "$VERBOSE" != no ] && log_action_end_msg $?
done
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
*) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
log_daemon_msg 'Checking for running Diaspora processes'
if ! check_unicorn
then
log_action_msg "unicorn not found"
unicorn_running=false
else
for i in `check_unicorn`; do
log_action_msg "Found unicorn master with PID $i"
unicorn_running=true
done
fi
if ! check_foreman
then
log_action_msg "foreman not found"
foreman_running=false
else
for i in `check_foreman`; do
log_action_msg "Found foreman with pid $i"
foreman_running=true
done
fi
if ! check_sidekiq
then
log_action_msg "sidekiq is not found"
sidekiq_running=false
else
for i in `check_sidekiq`; do
log_action_msg "Found sidekiq with PID $i"
sidekiq_running=true
done
fi
if $foreman_running && ! $unicorn_running; then
log_action_msg "Diaspora is starting, check after some time..."
log_end_msg 0
return 0
fi
if $unicorn_running && $sidekiq_running; then
log_action_msg "Diaspora health is OK"
log_end_msg 0
else
if $unicorn_running; then
log_failure_msg "Unicorn is RUNNING, but sidekiq is DOWN!"
log_end_msg 1
return 1
fi
if $sidekiq_running; then
log_failure_msg "Sidekiq is RUNNING, but unicorn is DOWN!"
log_end_msg 1
return 1
fi
log_daemon_msg "All Diaspora processes are DOWN"
log_end_msg 0
fi
;;
restart|force-reload)
[ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
ret=$?
sleep 5
case "$ret" in
0|1)
do_start
case "$?" in
0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
1) [ "$VERBOSE" != no ] && log_failure_msg "old process is still running" && log_end_msg 1 ;;
*) [ "$VERBOSE" != no ] && log_failure_msg "failed to start" && log_end_msg 1 ;;
esac
;;
*)
[ "$VERBOSE" != no ] && log_failure_msg "failed to stop"
[ "$VERBOSE" != no ] && log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:

1129
conf/mpapis@gmail.com.pgp Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,132 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFglzSYBEADfGIe+NZMt2ymkKz6QvgG7Kwu54s5E/rikRNRKviysO7O3NWC8
P6FQ80kf4s1OhMF+//xnQTXiqFyjCFqftbEM2ApK9YHTUoVFF8I6Ed3uRxP9H3fO
dkn3nkvWj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Mqi35Z/4Ev2nPBZ4M2
ToDdydSnuEhSC3rlyJ9Du724UsKBBoH/LiRp4yMv6Y7b4lH4orONriEjjb1X3Ln3
Dcp83Zho3ANvhjWz2lL4XRzCLnUdYwV56872vH3AeSAvjfgbf5oYlLhXgMUXsNF/
2YBn1UOcqwKgmOGl8capSPz2+q/sGjYLIMQ6pA5XKHrI8FjdON2AYxrSRb8RBBAW
hFvJNrAwzAqorolYtNkAfXgU0kayY9SXElQBsNnU/9EcW6/eqfZPWzHgTRXV6yvC
OAygYHVwad62iQMzFGSamQYcinnwZccRuRNRCYHzIjB9tCOMe2qa5pjPeYMTk8vK
9yrYeRzBeQFMQXQgRZV8GcN8E/qBBc85qGZWRw8XeXpqBo08teH81jnjbbw+uZrl
ItFD89SDex93x3lKKaBo31AAqmYx5hOEG4q2cOh33kB9WOozqLf0UjUQOyBpN+Cu
/PK2WJKMqBfFjpef34eIMVOzhxp/oQ4xVQD+H27ExayutgIvExrFBeRU1RxhwRAW
fiC0aDWzK4QuWnmZG1oSv7hLIMChvUM39Oo/Jz1BYTVfCRWMQZeX/ncaZCSBM/MM
iWTuv7mXY0bNG+s=
=SF+D
-----END PGP PUBLIC KEY BLOCK-----

View file

@ -16,7 +16,7 @@
"requirements": { "requirements": {
"yunohost": ">= 3.6.0" "yunohost": ">= 3.6.0"
}, },
"multi_instance": "false", "multi_instance": "true",
"services": [ "services": [
"nginx", "nginx",
"php7-fpm", "php7-fpm",

View file

@ -1,3 +1,4 @@
#!/bin/bash #!/bin/bash
pkg_dependencies="build-essential cmake libssl-dev libcurl4-openssl-dev libxml2-dev libxslt-dev imagemagick ghostscript curl libmagickwand-dev git libpq-dev redis-server nodejs" pkg_dependencies="build-essential cmake libssl-dev libcurl4-openssl-dev libxml2-dev libxslt-dev imagemagick ghostscript curl libmagickwand-dev git libpq-dev redis-server nodejs postgresql bison "
ruby_build_dependencies="bison libffi-dev libgdbm-dev libncurses5-dev libsqlite3-dev libyaml-dev pkg-config sqlite3 zlib1g-dev libgmp-dev libreadline-dev libssl-dev"

View file

@ -1,5 +1,13 @@
#!/bin/bash #!/bin/bash
# TODO
# - check logrotate
# - which service to register to ynuhosto? diaspora.target only ? All of them ?
# - backup / restore
# - changeurl ? Is that possible ? or even a good idea ?
# - make an admin automatically
# - integration with ssowat? Or not?
#================================================= #=================================================
# GENERIC START # GENERIC START
#================================================= #=================================================
@ -57,9 +65,10 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Saving app settings..." --time --weight=1 ynh_script_progression --message="Saving app settings..." --time --weight=1
ynh_app_setting_set $app domain $domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set $app path $path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set $app is_public $is_public ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
@ -68,8 +77,8 @@ ynh_app_setting_set $app is_public $is_public
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --time --weight=1 ynh_script_progression --message="Installing dependencies..." --time --weight=27
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies $ruby_build_dependencies
#================================================= #=================================================
# CREATE A POSTGRESQL DATABASE # CREATE A POSTGRESQL DATABASE
@ -79,83 +88,115 @@ db_name=$(ynh_sanitize_dbid $app)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_psql_test_if_first_run ynh_psql_test_if_first_run
ynh_psql_setup_db $db_name $db_name ynh_psql_setup_db $db_name $db_name
db_pass=$(ynh_app_setting_get --app=$app --key=psqlpwd)
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Creating database..." --time --weight=1 ynh_script_progression --message="Creating user..." --time --weight=1
# Create a system user # Create a system user
ynh_system_user_create $app ynh_system_user_create --username=$app --home_dir=$final_path --use_shell
mkdir -p $final_path
chown $app:$app $final_path
# SWITCH TO NEW USER UNTIL EOF
#=================================================
# INSTALL RVM AND RUBY FOR CURRENT USER
#=================================================
ynh_script_progression --message="Installing rvm..." --time --weight=10
sudo -u $app gpg --import ../conf/piotr.kuczynski\@gmail.com.pgp ../conf/mpapis\@gmail.com.pgp
pushd $final_path
sudo -u $app curl -sSL https://get.rvm.io | sudo -u $app bash -s stable
ynh_script_progression --message="Installing ruby 2.4 (this can take a long time)..." --time --weight=230
sudo -u $app $final_path/.rvm/bin/rvm autolibs read-fail
sudo -u $app $final_path/.rvm/bin/rvm install 2.4
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
# Download, check integrity, unucompress and patch the source from app.src
ynh_script_progression --message="Download the sources..." --time --weight=16
sudo -u $app git clone https://github.com/diaspora/diaspora.git -b v0.7.12.0
popd
ynh_app_setting_set --app=$app --key=final_path --value=$final_path #=================================================
# Download, check integrity, uncompress and patch the source from app.src # EXPORT VARIABLES FOR TEMPLATING
su -l $app -s /bin/bash #=================================================
cd ~ export app
git clone -b v0.7.12.0 https://github.com/diaspora/diaspora.git export domain
cd diaspora export path_url
config/database.yml export db_pass
cp config/diaspora.yml export final_path
curl -L https://s.diaspora.software/1t | bash
echo [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" | tee ~/.bashrc #=================================================
gem install bundler # CONFIGURE DIASPORA
RAILS_ENV=production bin/bundle install --jobs $(nproc) --deployment --without test development --with mysql #=================================================
ynh_script_progression --message="Configure diaspora..." --time --weight=1
ynh_render_template ../conf/diaspora.yml $final_path/diaspora/config/diaspora.yml
ynh_render_template ../conf/database.yml $final_path/diaspora/config/database.yml
#=================================================
# Bundle the ruby app
#=================================================
pushd $final_path/diaspora
ynh_script_progression --message="bundle the app..." --time --weight=1000
# here we *absolutely* need bash (not dash) because dash does not understand what rvm puts in .profile
# (wtf rvm for assuming everybody uses bash as default shell??)
# we also need a login shell to make sure .profile is loaded
sudo -u $app /bin/bash --login << EOF
rvm use --default 2.4
rvm 2.4 do gem install bundler
script/configure_bundler
bin/bundle install --full-index --with=postgresql
EOF
ynh_script_progression --message="Create db schema..." --time --weight=22
sudo -u $app /bin/bash --login << EOF
RAILS_ENV=production bundle exec rake db:migrate
EOF
#=================================================
# ASSETS PRECOMPILATION
#=================================================
ynh_script_progression --message="Precompile assets..." --time --weight=400
sudo -u $app /bin/bash --login << EOF
RAILS_ENV=production bin/rake assets:precompile
EOF
popd
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
# TODO serve public/ ?
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_script_progression --message="configure nginx..." --time --weight=1
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_systemd_config # TODO add service in yunohost panel ?
ynh_script_progression --message="configure systemd unit..." --time --weight=1
#================================================= ynh_render_template ../conf/diaspora_sidekiq.service /etc/systemd/system/${app}_sidekiq.service
# SETUP APPLICATION WITH CURL ynh_render_template ../conf/diaspora_web.service /etc/systemd/system/${app}_web.service
#================================================= ynh_render_template ../conf/diaspora.tmpfiles.d /etc/tmpfiles.d/${app}.conf
ynh_render_template ../conf/diaspora.target /etc/systemd/system/${app}.target
# Set right permissions for curl install systemctl daemon-reload
chown -R $app: $final_path systemd-tmpfiles --create
systemctl enable ${app}.target ${app}_sidekiq.service ${app}_web.service
# Set the app as temporarily public for curl call systemctl restart ${app}.target
ynh_app_setting_set $app unprotected_uris "/"
# Reload SSOwat config
yunohost app ssowatconf
# Reload Nginx
systemctl reload nginx
# Installation with curl
ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3"
#================================================= #=================================================
# STORE THE CHECKSUM OF THE CONFIG FILE # STORE THE CHECKSUM OF THE CONFIG FILE
#================================================= #=================================================
# 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 "$final_path/CONFIG_FILE" ynh_store_file_checksum --file="$final_path/diaspora/config/diaspora.yml"
ynh_store_file_checksum --file="$final_path/diaspora/config/database.yml"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions to app files
chown -R root: $final_path
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
@ -167,7 +208,7 @@ ynh_use_logrotate
#================================================= #=================================================
# ADVERTISE SERVICE IN ADMIN PANEL # ADVERTISE SERVICE IN ADMIN PANEL
#================================================= #=================================================
# TODO
yunohost service add NAME_INIT.D --log "/var/log/FILE.log" yunohost service add NAME_INIT.D --log "/var/log/FILE.log"
#================================================= #=================================================
@ -188,5 +229,5 @@ fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reload nginx..." --time --weight=1
systemctl reload nginx systemctl reload nginx

View file

@ -16,7 +16,6 @@ source /usr/share/yunohost/helpers
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get $app domain)
port=$(ynh_app_setting_get $app port)
db_name=$(ynh_app_setting_get $app db_name) db_name=$(ynh_app_setting_get $app db_name)
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get $app final_path)
@ -25,9 +24,13 @@ final_path=$(ynh_app_setting_get $app final_path)
#================================================= #=================================================
# STOP AND REMOVE SERVICE # STOP AND REMOVE SERVICE
#================================================= #=================================================
systemctl stop ${app}.target ${app}_sidekiq.service ${app}_web.service
# Remove the dedicated systemd config systemctl disable ${app}.target ${app}_sidekiq.service ${app}_web.service
ynh_remove_systemd_config ynh_secure_remove --file="/etc/systemd/system/${app}_web.service"
ynh_secure_remove --file="/etc/systemd/system/${app}_sidekiq.service"
ynh_secure_remove --file="/etc/tmpfiles.d/${app}.conf"
ynh_secure_remove --file="/etc/systemd/system/${app}.target"
systemctl daemon-reload
#================================================= #=================================================
# REMOVE SERVICE FROM ADMIN PANEL # REMOVE SERVICE FROM ADMIN PANEL
@ -39,6 +42,13 @@ then
yunohost service remove $app yunohost service remove $app
fi fi
#=================================================
# REMOVE THE POSTGRESQL DATABASE
#=================================================
# Remove a database if it exists, along with the associated user
ynh_psql_remove_db $db_name $db_name
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================
@ -46,20 +56,6 @@ fi
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_app_dependencies ynh_remove_app_dependencies
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db $db_name $db_name
#=================================================
# REMOVE APP MAIN DIR
#=================================================
# Remove the app directory securely
ynh_secure_remove "$final_path"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
@ -67,45 +63,14 @@ ynh_secure_remove "$final_path"
# Remove the dedicated nginx config # Remove the dedicated nginx config
ynh_remove_nginx_config ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
# Remove the dedicated php-fpm config
ynh_remove_fpm_config
#================================================= #=================================================
# REMOVE LOGROTATE CONFIGURATION # REMOVE LOGROTATE CONFIGURATION
#================================================= #=================================================
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
# TODO setup logrotate ?
ynh_remove_logrotate ynh_remove_logrotate
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $port$"
then
echo "Close port $port"
yunohost firewall disallow TCP $port 2>&1
fi
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE THE CRON FILE
#=================================================
# Remove a cron file
ynh_secure_remove "/etc/cron.d/$app"
# Remove a directory securely
ynh_secure_remove "/etc/$app/"
# Remove the log files
ynh_secure_remove "/var/log/$app/"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
@ -113,4 +78,14 @@ ynh_secure_remove "/var/log/$app/"
#================================================= #=================================================
# Delete a system user # Delete a system user
# because we use gpg, sometimes rogue processes (gpg an d dirmngr) stays a bit,
# preventing the deletion of the user. Hence we kill all processes belonging to $app
pkill -9 -u `id -u $app`
ynh_system_user_delete $app ynh_system_user_delete $app
#=================================================
# REMOVE APP MAIN DIR
#=================================================
# Remove the app directory securely
ynh_secure_remove "$final_path"