1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wekan_ynh.git synced 2024-09-03 20:36:09 +02:00

Merge branch 'testing' into testing

This commit is contained in:
yalh76 2019-03-15 19:35:31 +01:00 committed by GitHub
commit a4b48310cf
6 changed files with 18 additions and 69 deletions

View file

@ -52,10 +52,6 @@ LDAP is supported but and HTTP auth is stil not supported
* ARMv8-A - Not supported * ARMv8-A - Not supported
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/wekan%20%28Community%29.svg)](https://ci-stretch.nohost.me/ci/apps/wekan/) * Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/wekan%20%28Community%29.svg)](https://ci-stretch.nohost.me/ci/apps/wekan/)
## Limitations
* Any known limitations.
## Links ## Links
* Report a bug: https://github.com/YunoHost-Apps/wekan_ynh/issues * Report a bug: https://github.com/YunoHost-Apps/wekan_ynh/issues

View file

@ -25,22 +25,11 @@ ynh_abort_if_errors
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#================================================= #=================================================
app=$YNH_APP_INSTANCE_NAME
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
### If it's a multi-instance app, meaning it can be installed several times independently
### The id of the app as stated in the manifest is available as $YNH_APP_ID
### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
### The app instance name is available as $YNH_APP_INSTANCE_NAME
### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
### - ynhexample__{N} for the subsequent installations, with N=3,4, ...
### The app instance name is probably what interests you most, since this is
### guaranteed to be unique. This is a good unique identifier to define installation path,
### db names, ...
app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
@ -54,9 +43,6 @@ ynh_print_info "Validating installation parameters..."
final_path=/var/www/$app final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder" test ! -e "$final_path" || ynh_die "This path already contains a folder"
# Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url)
# Register (book) web path # Register (book) web path
ynh_webpath_register $app $domain $path_url ynh_webpath_register $app $domain $path_url
@ -68,25 +54,16 @@ ynh_print_info "Storing installation settings..."
ynh_app_setting_set $app domain $domain ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path_url ynh_app_setting_set $app path $path_url
ynh_app_setting_set $app is_public $is_public ynh_app_setting_set $app is_public $is_public
ynh_app_setting_set $app final_path $final_path
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_print_info "Configuring firewall..."
### Use these lines if you have to open a port for the application
### `ynh_find_port` will find the first available port starting from the given port.
### If you're not using these lines:
### - Remove the section "CLOSE A PORT" in the remove script
# Find a free port # Find a free port
port=$(ynh_find_port 8095) port=$(ynh_find_port 8095)
# Open this port
#ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
ynh_app_setting_set $app port $port ynh_app_setting_set $app port $port
# Registering db name
db_name=$(ynh_sanitize_dbid $app)
ynh_app_setting_set $app db_name $db_name
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
@ -113,34 +90,15 @@ ynh_print_info "Starting mongodb ..."
systemctl enable mongodb systemctl enable mongodb
systemctl restart mongodb systemctl restart mongodb
#=================================================
# CREATE A MONGODB DATABASE
#=================================================
ynh_print_info "Creating a MongoDB database..."
### Use these lines if you need a database for the application.
### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password.
### The password will be stored as 'mysqlpwd' into the app settings,
### and will be available as $db_pwd
### If you're not using these lines:
### - Remove the section "BACKUP THE MYSQL DATABASE" in the backup script
### - Remove also the section "REMOVE THE MYSQL DATABASE" in the remove script
### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script
db_name=$(ynh_sanitize_dbid $app)
ynh_app_setting_set $app db_name $db_name
#ynh_mysql_setup_db $db_name $db_name
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_print_info "Setting up source files..." ynh_print_info "Setting up wekan source files..."
### `ynh_setup_source` is used to install an app from a zip or tar.gz file, ### `ynh_setup_source` is used to install an app from a zip or tar.gz file,
### downloaded from an upstream source, like a git repository. ### downloaded from an upstream source, like a git repository.
### `ynh_setup_source` use the file conf/app.src ### `ynh_setup_source` use the file conf/app.src
ynh_app_setting_set $app final_path $final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path" ynh_setup_source "$final_path"
@ -213,7 +171,7 @@ ynh_store_file_checksum "$final_path/.env"
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
ynh_print_info "Fixing permissions ..." ynh_print_info "Configuring file permissions ..."
### For security reason, any app should set the permissions to root: before anything else. ### For security reason, any app should set the permissions to root: before anything else.
### Then, if write authorization is needed, any access should be given only to directories ### Then, if write authorization is needed, any access should be given only to directories
@ -260,6 +218,7 @@ systemctl reload nginx
#================================================= #=================================================
# START SERVICE # START SERVICE
#================================================= #=================================================
ynh_print_info "Now starting Wekan service..."
ynh_systemd_action --action=start --service_name=$app --log_path="systemd" --line_match="Kadira: completed instrumenting the app" ynh_systemd_action --action=start --service_name=$app --log_path="systemd" --line_match="Kadira: completed instrumenting the app"
sleep 10 sleep 10

View file

@ -82,16 +82,6 @@ ynh_print_info "Removing nginx web server configuration"
# Remove the dedicated nginx config # Remove the dedicated nginx config
ynh_remove_nginx_config ynh_remove_nginx_config
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $port$"
then
ynh_print_info "Closing port $port"
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -106,6 +106,7 @@ mongorestore --db $db_name ./dump/$db_name
ynh_print_info "Restoring the systemd configuration..." ynh_print_info "Restoring the systemd configuration..."
ynh_restore_file "/etc/systemd/system/$app.service" ynh_restore_file "/etc/systemd/system/$app.service"
systemctl daemon-reload
systemctl enable $app.service systemctl enable $app.service
#================================================= #=================================================
@ -127,6 +128,7 @@ systemctl reload nginx
#================================================= #=================================================
# START SERVICE # START SERVICE
#================================================= #=================================================
ynh_print_info "Now starting Wekan service..."
ynh_systemd_action --action=start --service_name=$app --log_path="systemd" --line_match="Kadira: completed instrumenting the app" ynh_systemd_action --action=start --service_name=$app --log_path="systemd" --line_match="Kadira: completed instrumenting the app"
sleep 10 sleep 10

View file

@ -25,6 +25,7 @@ final_path=$(ynh_app_setting_get $app final_path)
db_name=$(ynh_app_setting_get $app db_name) db_name=$(ynh_app_setting_get $app db_name)
port=$(ynh_app_setting_get $app port) port=$(ynh_app_setting_get $app port)
# Previous versions of the app did not have the db_name setting
if [ -z "$db_name" ] if [ -z "$db_name" ]
then then
db_name=$app db_name=$app
@ -91,10 +92,10 @@ if ynh_version_gt "1.07~ynh2" "${previous_version}" ; then
# Gotta regen the systemd config because mongodb service name changed # Gotta regen the systemd config because mongodb service name changed
ynh_use_nodejs ynh_use_nodejs
ynh_replace_string "__ENV_PATH__" "$nodejs_path" "../conf/systemd.service" ynh_replace_string "__ENV_PATH__" "$nodejs_path" "../conf/systemd.service"
ynh_replace_string "__DB_NAME__" "$db_name" "../conf/systemd.service" ynh_replace_string "__DB_NAME__" "$db_name" "../conf/systemd.service"
ynh_replace_string "__DOMAIN_URI__" "$domain$path_url" "../conf/systemd.service" ynh_replace_string "__DOMAIN_URI__" "$domain$path_url" "../conf/systemd.service"
ynh_replace_string "__PORT__" "$port" "../conf/systemd.service" ynh_replace_string "__PORT__" "$port" "../conf/systemd.service"
ynh_add_systemd_config ynh_add_systemd_config
fi fi
@ -173,6 +174,7 @@ systemctl reload nginx
#================================================= #=================================================
# START SERVICE # START SERVICE
#================================================= #=================================================
ynh_print_info "Now restarting Wekan service..."
ynh_systemd_action --action=restart --service_name=$app --log_path="systemd" --line_match="Kadira: completed instrumenting the app" ynh_systemd_action --action=restart --service_name=$app --log_path="systemd" --line_match="Kadira: completed instrumenting the app"

View file

@ -15,7 +15,7 @@ abort_if_up_to_date () {
version=$(read_json "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" 'version' 2> /dev/null || echo '20160501-7') version=$(read_json "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" 'version' 2> /dev/null || echo '20160501-7')
last_version=$(read_manifest 'version') last_version=$(read_manifest 'version')
if [ "${version}" = "${last_version}" ]; then if [ "${version}" = "${last_version}" ]; then
info "Up-to-date, nothing to do" ynh_print_info "Up-to-date, nothing to do"
ynh_die "" 0 ynh_die "" 0
fi fi
} }