mirror of
https://github.com/YunoHost-Apps/gitlab_ynh.git
synced 2024-09-03 18:36:35 +02:00
112 lines
No EOL
3 KiB
Bash
112 lines
No EOL
3 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
source /usr/share/yunohost/helpers
|
|
|
|
# Load common variables and helpers
|
|
source ./_common.sh
|
|
|
|
#=================================================
|
|
# LOAD SETTINGS
|
|
#=================================================
|
|
|
|
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)
|
|
port=$(ynh_app_setting_get "$app" web_port)
|
|
portUnicorn=$(ynh_app_setting_get "$app" unicorn_port)
|
|
|
|
#=================================================
|
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
#=================================================
|
|
|
|
# TODO: Backup and Restore Scripts
|
|
## Backup the current version of the app
|
|
#ynh_backup_before_upgrade
|
|
#ynh_clean_setup () {
|
|
# # restore it if the upgrade fails
|
|
# ynh_restore_upgradebackup
|
|
#}
|
|
|
|
# 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
|
|
#=================================================
|
|
|
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
|
ynh_add_nginx_config
|
|
|
|
#=================================================
|
|
# CONFIGURE GITLAB
|
|
#=================================================
|
|
|
|
# Configure gitlab with gitlab.rb file
|
|
config_gitlab
|
|
|
|
#=================================================
|
|
# UPGRADE DEPENDENCIES
|
|
#=================================================
|
|
|
|
ynh_install_app_dependencies openssh-server
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND INSTALL GITLAB
|
|
#=================================================
|
|
|
|
# Update Gitlab
|
|
setup_source $architecture
|
|
|
|
#=================================================
|
|
# GENERIC FINALIZATION
|
|
#=================================================
|
|
# SETUP SSOWAT
|
|
#=================================================
|
|
|
|
# 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
|
|
|
|
#=================================================
|
|
# RELOAD NGINX
|
|
#=================================================
|
|
|
|
# Reload nginx service
|
|
systemctl reload nginx
|
|
|
|
#Fix for the CI
|
|
if sudo grep -qa container=lxc /proc/1/environ;
|
|
then
|
|
status_code=$(curl -s -o /dev/null -w '%{http_code}' "$domain${path_url%/}")
|
|
inc=0
|
|
|
|
# Have to wait the time that gitlab reload
|
|
while [ $status_code == "502" ] && [ $inc < 10 ]
|
|
do
|
|
sleep 10;
|
|
status_code=$(curl -s -o /dev/null -w '%{http_code}' "$domain${path_url%/}")
|
|
((inc++))
|
|
done;
|
|
fi; |