From 50fe5479079abb7af73e2243a14c6b6faff012b2 Mon Sep 17 00:00:00 2001 From: kam Date: Wed, 28 Jun 2017 15:41:05 +0200 Subject: [PATCH 1/8] with the new yunohost fork --- manifest.json | 10 +++++++++- scripts/install | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 0970a40..920e3de 100644 --- a/manifest.json +++ b/manifest.json @@ -43,7 +43,15 @@ "example": "/example", "default": "/example" }, - + { + "name": "admin", + "type": "user", + "ask": { + "en": "Choose an admin user", + "fr": "Choisissez l’administrateur" + }, + "example": "johndoe" + }, { "name": "is_public", "type": "boolean", diff --git a/scripts/install b/scripts/install index 5ef4800..83c8ad4 100644 --- a/scripts/install +++ b/scripts/install @@ -19,6 +19,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC +admin=$YNH_APP_ARG_ADMIN # Source YunoHost helpers source /usr/share/yunohost/helpers @@ -26,6 +27,8 @@ source /usr/share/yunohost/helpers # Save app settings ynh_app_setting_set "$app" is_public "$is_public" +mailadmin=$(ynh_user_get_info $admin mail) + # Check domain/path availability sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \ || ynh_die "Path not available: ${domain}${path_url}" @@ -42,8 +45,25 @@ sudo apt-get install -yy gitlab-ce # Gitlab configuration + +sed -i "s@GENERATED_EXTERNAL_URL@https://$domain@" ../conf/gitlab.rb +sed -i "s@PORT@$port@" ../conf/gitlab.rb + +sudo cp -f ../conf/gitlab.rb /etc/gitlab/gitlab.rb sudo gitlab-ctl reconfigure +echo $admin +echo $mailadmin + +echo "newuser = User.new({ \"email\"=>'$mailadmin', \"username\"=>'$admin', \"name\"=>'$admin', \"password\"=>'12345678'}) +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 From 88bb4ab8bb29659dd80071868edf1d10d577697a Mon Sep 17 00:00:00 2001 From: kam Date: Wed, 28 Jun 2017 16:22:57 +0200 Subject: [PATCH 2/8] config file forgotten --- conf/gitlab.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 conf/gitlab.rb diff --git a/conf/gitlab.rb b/conf/gitlab.rb new file mode 100644 index 0000000..8f2fc30 --- /dev/null +++ b/conf/gitlab.rb @@ -0,0 +1,21 @@ +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'] = PORT +nginx['listen_https'] = false From 03c6434e54eac358b6468bcbf5a593ed6a796a18 Mon Sep 17 00:00:00 2001 From: kam Date: Wed, 28 Jun 2017 16:28:20 +0200 Subject: [PATCH 3/8] fix --- scripts/install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 83c8ad4..e4979fd 100644 --- a/scripts/install +++ b/scripts/install @@ -28,6 +28,8 @@ source /usr/share/yunohost/helpers ynh_app_setting_set "$app" is_public "$is_public" mailadmin=$(ynh_user_get_info $admin mail) +port=$(ynh_find_port 8080) +rdmPass=$(ynh_string_random 30) # Check domain/path availability sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \ @@ -52,10 +54,8 @@ sed -i "s@PORT@$port@" ../conf/gitlab.rb sudo cp -f ../conf/gitlab.rb /etc/gitlab/gitlab.rb sudo gitlab-ctl reconfigure -echo $admin -echo $mailadmin -echo "newuser = User.new({ \"email\"=>'$mailadmin', \"username\"=>'$admin', \"name\"=>'$admin', \"password\"=>'12345678'}) +echo "newuser = User.new({ \"email\"=>'$mailadmin', \"username\"=>'$admin', \"name\"=>'$admin', \"password\"=>'$rdmPass'}) newuser.admin = true newuser.confirmed_at = Time.now newuser.confirmation_token = nil From a5bba7624462170b155007e7c80a00f6b68480e0 Mon Sep 17 00:00:00 2001 From: kam Date: Wed, 28 Jun 2017 16:54:03 +0200 Subject: [PATCH 4/8] fix --- conf/nginx.conf | 35 ++++++----------------------------- scripts/install | 2 +- 2 files changed, 7 insertions(+), 30 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 8c76342..b4e5fd9 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,33 +1,10 @@ location YNH_WWW_PATH { - # Path to source - alias YNH_WWW_ALIAS ; + proxy_pass http://localhost:PORT; + 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 ""; } diff --git a/scripts/install b/scripts/install index e4979fd..f8ce0e1 100644 --- a/scripts/install +++ b/scripts/install @@ -74,7 +74,7 @@ sudo gitlab-ctl reconfigure # Modify Nginx configuration file and copy it to Nginx conf directory nginx_conf=../conf/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@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf # If a dedicated php-fpm process is used: # 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 From 463daf0db6c33c94a7ea01b554263cc10b10e5fb Mon Sep 17 00:00:00 2001 From: kam Date: Wed, 28 Jun 2017 17:00:31 +0200 Subject: [PATCH 5/8] update nginx conf. --- scripts/install | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/install b/scripts/install index f8ce0e1..b318463 100644 --- a/scripts/install +++ b/scripts/install @@ -74,6 +74,7 @@ sudo gitlab-ctl reconfigure # Modify Nginx configuration file and copy it to Nginx conf directory nginx_conf=../conf/nginx.conf sed -i "s@YNH_WWW_PATH@$path_url@g" $nginx_conf +sed -i "s@PORT@$port@g" $nginx_conf # sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf # If a dedicated php-fpm process is used: # Don't forget to modify ../conf/nginx.conf accordingly or your app will not work! @@ -88,4 +89,6 @@ if [[ $is_public -eq 1 ]]; then fi # Reload services +sudo yunohost app ssowatconf sudo service nginx reload +sudo gitlab-ctl restart From 8094273c587ccb39b9805aa67ad3d2994b94f4f4 Mon Sep 17 00:00:00 2001 From: kam Date: Thu, 29 Jun 2017 09:56:39 +0200 Subject: [PATCH 6/8] Add some conf for uniconPort --- conf/gitlab.rb | 4 +++- scripts/install | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/conf/gitlab.rb b/conf/gitlab.rb index 8f2fc30..6cae7f4 100644 --- a/conf/gitlab.rb +++ b/conf/gitlab.rb @@ -17,5 +17,7 @@ gitlab_rails['ldap_servers'] = YAML.load <<-'EOS' # remember to close this block user_filter: '' EOS -nginx['listen_port'] = PORT +nginx['listen_port'] = PORTNGINX nginx['listen_https'] = false + +unicorn['port'] = PORTUNICORN diff --git a/scripts/install b/scripts/install index b318463..3424e9c 100644 --- a/scripts/install +++ b/scripts/install @@ -28,7 +28,8 @@ source /usr/share/yunohost/helpers ynh_app_setting_set "$app" is_public "$is_public" mailadmin=$(ynh_user_get_info $admin mail) -port=$(ynh_find_port 8080) +portNginx=$(ynh_find_port 8080) +portUnicorn=$(ynh_find_port 8080) rdmPass=$(ynh_string_random 30) # Check domain/path availability @@ -49,7 +50,8 @@ sudo apt-get install -yy gitlab-ce # Gitlab configuration sed -i "s@GENERATED_EXTERNAL_URL@https://$domain@" ../conf/gitlab.rb -sed -i "s@PORT@$port@" ../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 From 702b8692c2b643fd7ce4c4422171cf3e8c9d1ec2 Mon Sep 17 00:00:00 2001 From: kam Date: Thu, 29 Jun 2017 10:04:25 +0200 Subject: [PATCH 7/8] if i make 2 call of ynh_find_port for 2 different need, will not work! --- manifest.json | 2 +- scripts/install | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 920e3de..7dec0dc 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "url": "http://example.com" }, "requirements": { - "yunohost": ">> 2.4.0" + "yunohost": ">> 2.6.0" }, "multi_instance": true, "services": [ diff --git a/scripts/install b/scripts/install index 3424e9c..065a6b3 100644 --- a/scripts/install +++ b/scripts/install @@ -29,7 +29,7 @@ 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 8080) +portUnicorn=$(ynh_find_port 9080) rdmPass=$(ynh_string_random 30) # Check domain/path availability From cc0fc5f5af2f42411117801f563f5c089e93ebab Mon Sep 17 00:00:00 2001 From: kam Date: Thu, 29 Jun 2017 10:38:46 +0200 Subject: [PATCH 8/8] fix --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 065a6b3..2fc9dab 100644 --- a/scripts/install +++ b/scripts/install @@ -76,7 +76,7 @@ sudo gitlab-ctl reconfigure # Modify Nginx configuration file and copy it to Nginx conf directory nginx_conf=../conf/nginx.conf sed -i "s@YNH_WWW_PATH@$path_url@g" $nginx_conf -sed -i "s@PORT@$port@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: # Don't forget to modify ../conf/nginx.conf accordingly or your app will not work!