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/install

84 lines
2.2 KiB
Text
Raw Normal View History

2017-06-10 10:10:31 +02:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
source /usr/share/yunohost/helpers
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
# Load common variables and helpers
source ./_common.sh
2017-06-10 10:10:31 +02:00
# Retrieve arguments
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
2017-06-28 15:41:05 +02:00
admin=$YNH_APP_ARG_ADMIN
2017-06-10 10:10:31 +02:00
# Check domain/path availability
ynh_webpath_available $domain $path_url || ynh_die "$domain is not available as domain, please use an other domain."
ynh_webpath_register $app $domain $path_url
2017-06-10 10:10:31 +02:00
# Check user parameter
ynh_user_exists "$admin" \
|| ynh_die "The chosen admin user does not exist."
2017-06-10 10:10:31 +02:00
2017-06-28 15:41:05 +02:00
mailadmin=$(ynh_user_get_info $admin mail)
port=$(ynh_find_port 8080)
portUnicorn=$(ynh_find_port 9080)
2017-06-28 16:28:20 +02:00
rdmPass=$(ynh_string_random 30)
2017-06-28 15:41:05 +02:00
# Save app settings
ynh_app_setting_set $app admin $admin
ynh_app_setting_set $app path_url $path_url
ynh_app_setting_set $app is_public $is_public
ynh_app_setting_set $app web_port $port
ynh_app_setting_set $app unicorn_port $portUnicorn
2017-06-10 10:10:31 +02:00
#=================================================
# STANDARD MODIFICATIONS
#=================================================
2017-06-10 10:10:31 +02:00
# Modify Nginx configuration file and copy it to Nginx conf directory
config_nginx
2017-06-10 10:35:32 +02:00
create_dir
2017-06-10 10:10:31 +02:00
# Configure gitlab with gitlab.rb file
config_gitlab
2017-06-28 15:41:05 +02:00
# Add dependencies
ynh_install_app_dependencies openssh-server
2017-06-28 15:41:05 +02:00
# Update to the last version
update_src_version
2017-06-28 15:41:05 +02:00
# Install gitlab
setup_source $architecture
2017-06-28 15:41:05 +02:00
2017-06-28 16:28:20 +02:00
echo "newuser = User.new({ \"email\"=>'$mailadmin', \"username\"=>'$admin', \"name\"=>'$admin', \"password\"=>'$rdmPass'})
2017-06-28 15:41:05 +02:00
newuser.admin = true
newuser.confirmed_at = Time.now
newuser.confirmation_token = nil
newuser.save" | sudo gitlab-rails console
2017-06-10 10:10:31 +02:00
sudo gitlab-ctl reconfigure
# If app is public, add url to SSOWat conf as skipped_uris
if [[ $is_public -eq 1 ]]; then
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set "$app" unprotected_uris "/"
fi
# Configure logrotate
#ynh_use_logrotate "/var/log/$app"
2017-06-10 10:10:31 +02:00
# Reload services
#sudo yunohost app ssowatconf
#sudo service nginx reload
#sudo gitlab-ctl restart