1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gitlab_ynh.git synced 2024-09-03 18:36:35 +02:00
gitlab_ynh/scripts/upgrade
2018-04-14 18:38:22 +02:00

46 lines
1.3 KiB
Bash

#!/bin/bash
# Exit on command errors and treat unset variables as an error
set -eu
# See comments in install script
app=$YNH_APP_INSTANCE_NAME
# Source YunoHost helpers
source /usr/share/yunohost/helpers
# 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)
portNginx=$(ynh_find_port 8080)
portUnicorn=$(ynh_find_port 9080)
# Gitlab configuration
gitlab_conf_path=../conf/gitlab.rb
ynh_replace_string "GENERATED_EXTERNAL_URL" "https://$domain${path_url%/}" $gitlab_conf_path
ynh_replace_string "PORTNGINX" "$portNginx" $gitlab_conf_path
ynh_replace_string "PORTUNICORN" "$portUnicorn" $gitlab_conf_path
sudo cp -f ../conf/gitlab.rb /etc/gitlab/gitlab.rb
# Modify Nginx configuration file and copy it to Nginx conf directory
nginx_conf=../conf/nginx.conf
ynh_replace_string "YNH_WWW_PATH" "${path_url%/}/" $nginx_conf
ynh_replace_string "PORT" "$portNginx" $nginx_conf
sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
sudo apt-get update
sudo apt-get install -yy gitlab-ce
# 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 service
sudo service nginx reload