2017-06-10 10:10:31 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-12-19 00:02:20 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2018-12-16 23:05:12 +01:00
|
|
|
|
2018-12-19 00:02:20 +01:00
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
source /usr/share/yunohost/helpers
|
2018-12-16 23:05:12 +01:00
|
|
|
|
|
|
|
# Load common variables and helpers
|
|
|
|
source ./_common.sh
|
2017-06-10 10:10:31 +02:00
|
|
|
|
2018-12-19 00:02:20 +01:00
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
|
|
|
|
2017-06-10 10:10:31 +02:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
|
|
|
# Retrieve app settings
|
|
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
|
|
|
path_url=$(ynh_app_setting_get "$app" path_url)
|
|
|
|
admin=$(ynh_app_setting_get "$app" admin)
|
|
|
|
is_public=$(ynh_app_setting_get "$app" is_public)
|
2018-12-16 23:05:12 +01:00
|
|
|
port=$(ynh_app_setting_get "$app" web_port)
|
|
|
|
portUnicorn=$(ynh_app_setting_get "$app" unicorn_port)
|
2017-06-10 10:10:31 +02:00
|
|
|
|
2018-12-19 00:02:20 +01:00
|
|
|
#=================================================
|
|
|
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
|
|
#=================================================
|
|
|
|
|
2019-01-13 15:44:16 +01:00
|
|
|
# Backup the current version of the app
|
|
|
|
ynh_backup_before_upgrade
|
|
|
|
ynh_clean_setup () {
|
|
|
|
# restore it if the upgrade fails
|
|
|
|
ynh_restore_upgradebackup
|
|
|
|
}
|
2018-12-19 00:02:20 +01:00
|
|
|
|
|
|
|
# Exit if an error occurs during the execution of the script
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# CHECK THE PATH
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Normalize the URL path syntax
|
|
|
|
path_url=$(ynh_normalize_url_path $path_url)
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD UPGRADE STEPS
|
|
|
|
#=================================================
|
|
|
|
# NGINX CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
|
2018-12-16 23:05:12 +01:00
|
|
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
2018-12-19 00:34:06 +01:00
|
|
|
ynh_add_nginx_config
|
2017-06-10 10:10:31 +02:00
|
|
|
|
2018-12-19 00:02:20 +01:00
|
|
|
#=================================================
|
|
|
|
# CONFIGURE GITLAB
|
|
|
|
#=================================================
|
2017-06-10 10:10:31 +02:00
|
|
|
|
2018-12-16 23:05:12 +01:00
|
|
|
# Configure gitlab with gitlab.rb file
|
|
|
|
config_gitlab
|
2017-06-10 10:10:31 +02:00
|
|
|
|
2018-12-19 00:02:20 +01:00
|
|
|
#=================================================
|
|
|
|
# UPGRADE DEPENDENCIES
|
|
|
|
#=================================================
|
|
|
|
|
2018-12-16 23:05:12 +01:00
|
|
|
ynh_install_app_dependencies openssh-server
|
2017-06-10 10:10:31 +02:00
|
|
|
|
2018-12-19 00:02:20 +01:00
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND INSTALL GITLAB
|
|
|
|
#=================================================
|
2017-06-10 10:10:31 +02:00
|
|
|
|
2018-12-16 23:05:12 +01:00
|
|
|
# Update Gitlab
|
|
|
|
setup_source $architecture
|
2018-04-14 18:38:22 +02:00
|
|
|
|
2018-12-19 00:02:20 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
|
|
|
# SETUP SSOWAT
|
|
|
|
#=================================================
|
|
|
|
|
2017-06-10 10:10:31 +02:00
|
|
|
# If app is public, add url to SSOWat conf as skipped_uris
|
|
|
|
if [[ $is_public -eq 1 ]]; then
|
|
|
|
# See install script
|
|
|
|
ynh_app_setting_set "$app" unprotected_uris "/"
|
|
|
|
fi
|
|
|
|
|
2018-12-19 00:02:20 +01:00
|
|
|
#=================================================
|
|
|
|
# RELOAD NGINX
|
|
|
|
#=================================================
|
|
|
|
|
2017-06-10 10:10:31 +02:00
|
|
|
# Reload nginx service
|
2019-01-05 15:22:23 +01:00
|
|
|
systemctl reload nginx
|
2019-01-05 11:12:03 +01:00
|
|
|
|
2019-01-13 15:44:16 +01:00
|
|
|
#=================================================
|
|
|
|
# WAIT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
waiting_to_start
|