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

Merge pull request #3 from strictosensus/master

enable LDAP support
This commit is contained in:
Rafi59 2017-06-29 15:22:55 +00:00 committed by GitHub
commit 07afb3622e
4 changed files with 65 additions and 32 deletions

23
conf/gitlab.rb Normal file
View file

@ -0,0 +1,23 @@
external_url 'GENERATED_EXTERNAL_URL'
gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS' # remember to close this block with 'EOS' below
main: # 'main' is the GitLab 'provider ID' of this LDAP server
label: 'LDAP'
host: 'localhost'
port: 389
uid: 'uid'
method: 'plain' # "tls" or "ssl" or "plain"
bind_dn: ''
password: ''
active_directory: false
allow_username_or_email_login: false
block_auto_created_users: false
base: 'ou=users,dc=yunohost,dc=org'
user_filter: ''
EOS
nginx['listen_port'] = PORTNGINX
nginx['listen_https'] = false
unicorn['port'] = PORTUNICORN

View file

@ -1,33 +1,10 @@
location YNH_WWW_PATH { location YNH_WWW_PATH {
# Path to source proxy_pass http://localhost:PORT;
alias YNH_WWW_ALIAS ; proxy_set_header Host $host;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Example PHP configuration (remove if not used)
index index.php;
# Common parameter to increase upload size limit in conjuction with dedicated php-fpm file
#client_max_body_size 50M;
try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
# Filename to be changed if dedicated php-fpm process is required
# This is to be used INSTEAD of line above
# Don't forget to adjust scripts install/upgrade/remove/backup accordingly
#
#fastcgi_pass unix:/var/run/php5-fpm-YNH_WWW_APP.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
# PHP configuration end
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;
proxy_set_header Accept-Encoding "";
} }

View file

@ -14,7 +14,7 @@
"url": "http://example.com" "url": "http://example.com"
}, },
"requirements": { "requirements": {
"yunohost": ">> 2.4.0" "yunohost": ">> 2.6.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
@ -43,7 +43,15 @@
"example": "/example", "example": "/example",
"default": "/example" "default": "/example"
}, },
{
"name": "admin",
"type": "user",
"ask": {
"en": "Choose an admin user",
"fr": "Choisissez ladministrateur"
},
"example": "johndoe"
},
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",

View file

@ -19,6 +19,7 @@ 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
admin=$YNH_APP_ARG_ADMIN
# Source YunoHost helpers # Source YunoHost helpers
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -26,6 +27,11 @@ source /usr/share/yunohost/helpers
# Save app settings # Save app settings
ynh_app_setting_set "$app" is_public "$is_public" ynh_app_setting_set "$app" is_public "$is_public"
mailadmin=$(ynh_user_get_info $admin mail)
portNginx=$(ynh_find_port 8080)
portUnicorn=$(ynh_find_port 9080)
rdmPass=$(ynh_string_random 30)
# Check domain/path availability # Check domain/path availability
sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \ sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \
|| ynh_die "Path not available: ${domain}${path_url}" || ynh_die "Path not available: ${domain}${path_url}"
@ -42,9 +48,25 @@ sudo apt-get install -yy gitlab-ce
# Gitlab configuration # Gitlab configuration
sed -i "s@GENERATED_EXTERNAL_URL@https://$domain@" ../conf/gitlab.rb
sed -i "s@PORTNGINX@$portNginx@" ../conf/gitlab.rb
sed -i "s@PORTUNICORN@$portUnicorn@" ../conf/gitlab.rb
sudo cp -f ../conf/gitlab.rb /etc/gitlab/gitlab.rb
sudo gitlab-ctl reconfigure sudo gitlab-ctl reconfigure
echo "newuser = User.new({ \"email\"=>'$mailadmin', \"username\"=>'$admin', \"name\"=>'$admin', \"password\"=>'$rdmPass'})
newuser.admin = true
newuser.confirmed_at = Time.now
newuser.confirmation_token = nil
newuser.save" | sudo gitlab-rails console
sudo gitlab-ctl reconfigure
# Set permissions to app files # Set permissions to app files
# you may need to make some file and/or directory writeable by www-data (nginx user) # you may need to make some file and/or directory writeable by www-data (nginx user)
@ -54,7 +76,8 @@ sudo gitlab-ctl reconfigure
# Modify Nginx configuration file and copy it to Nginx conf directory # Modify Nginx configuration file and copy it to Nginx conf directory
nginx_conf=../conf/nginx.conf nginx_conf=../conf/nginx.conf
sed -i "s@YNH_WWW_PATH@$path_url@g" $nginx_conf sed -i "s@YNH_WWW_PATH@$path_url@g" $nginx_conf
sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf sed -i "s@PORT@$portNginx@g" $nginx_conf
# sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf
# If a dedicated php-fpm process is used: # If a dedicated php-fpm process is used:
# Don't forget to modify ../conf/nginx.conf accordingly or your app will not work! # Don't forget to modify ../conf/nginx.conf accordingly or your app will not work!
# sed -i "s@YNH_WWW_APP@$app@g" $nginx_conf # sed -i "s@YNH_WWW_APP@$app@g" $nginx_conf
@ -68,4 +91,6 @@ if [[ $is_public -eq 1 ]]; then
fi fi
# Reload services # Reload services
sudo yunohost app ssowatconf
sudo service nginx reload sudo service nginx reload
sudo gitlab-ctl restart