diff --git a/resources/gitlab b/resources/gitlab index 185c65c7..82c5784d 100755 --- a/resources/gitlab +++ b/resources/gitlab @@ -1,6 +1,7 @@ #!/bin/bash GITLAB_HOST=${GITLAB_HOST:-localhost} +GITLAB_PORT=${GITLAB_PORT:-80} GITLAB_HTTPS=${GITLAB_HTTPS:-false} GITLAB_EMAIL=${GITLAB_EMAIL:-gitlab@localhost} GITLAB_SUPPORT=${GITLAB_SUPPORT:-support@localhost} @@ -125,13 +126,14 @@ sudo -u git -H git config --global user.email "${GITLAB_EMAIL}" sudo -u git -H git config --global core.autocrlf input # configure server url -sudo -u git -H sed 's/host: localhost/host: '${GITLAB_HOST}'/' -i /home/git/gitlab/config/gitlab.yml -sudo -u git -H sed 's/https: false/https: '${GITLAB_HTTPS}'/' -i /home/git/gitlab/config/gitlab.yml -sudo -u git -H sed 's/email_from: gitlab@localhost/email_from: '${GITLAB_EMAIL}'/' -i /home/git/gitlab/config/gitlab.yml -sudo -u git -H sed 's/support_email: support@localhost/support_email: '${GITLAB_SUPPORT}'/' -i /home/git/gitlab/config/gitlab.yml +sudo -u git -H sed 's/{{GITLAB_HOST}}/'${GITLAB_HOST}'/' -i /home/git/gitlab/config/gitlab.yml +sudo -u git -H sed 's/{{GITLAB_PORT}}/'${GITLAB_PORT}'/' -i /home/git/gitlab/config/gitlab.yml +sudo -u git -H sed 's/{{GITLAB_HTTPS}}/'${GITLAB_HTTPS}'/' -i /home/git/gitlab/config/gitlab.yml +sudo -u git -H sed 's/{{GITLAB_EMAIL}}/'${GITLAB_EMAIL}'/' -i /home/git/gitlab/config/gitlab.yml +sudo -u git -H sed 's/{{GITLAB_SUPPORT}}/'${GITLAB_SUPPORT}'/' -i /home/git/gitlab/config/gitlab.yml # configure gitlab signup configuration -sudo -u git -H sed 's/# signup_enabled: true/signup_enabled: '${GITLAB_SIGNUP}'/' -i /home/git/gitlab/config/gitlab.yml +sudo -u git -H sed 's/{{GITLAB_SIGNUP}}/'${GITLAB_SIGNUP}'/' -i /home/git/gitlab/config/gitlab.yml # configure database if [ "${DB_TYPE}" == "postgres" ]; then @@ -155,17 +157,18 @@ sudo -u git -H sed 's/{{DB_POOL}}/'${DB_POOL}'/' -i /home/git/gitlab/config/data sudo -u git -H sed 's/{{SIDEKIQ_CONCURRENCY}}/'${SIDEKIQ_CONCURRENCY}'/' -i /home/git/gitlab/config/sidekiq.yml # configure redis -sudo -u git -H sed 's/redis.example.com:6379/'${REDIS_HOST}':'${REDIS_PORT}'/' -i /home/git/gitlab/config/resque.yml +sudo -u git -H sed 's/{{REDIS_HOST}}/'${REDIS_HOST}'/' -i /home/git/gitlab/config/resque.yml +sudo -u git -H sed 's/{{REDIS_PORT}}/'${REDIS_PORT}'/' -i /home/git/gitlab/config/resque.yml # configure gitlab-shell -sudo -u git -H sed 's/host: 127.0.0.1/host: '${REDIS_HOST}'/' -i /home/git/gitlab-shell/config.yml -sudo -u git -H sed 's/port: 6379/port: '${REDIS_PORT}'/' -i /home/git/gitlab-shell/config.yml +sudo -u git -H sed 's/{{REDIS_HOST}}/'${REDIS_HOST}'/' -i /home/git/gitlab-shell/config.yml +sudo -u git -H sed 's/{{REDIS_PORT}}/'${REDIS_PORT}'/' -i /home/git/gitlab-shell/config.yml # configure unicorn workers -sed 's/worker_processes 2/worker_processes '${UNICORN_WORKERS}'/' -i /home/git/gitlab/config/unicorn.rb +sed 's/{{UNICORN_WORKERS}}/'${UNICORN_WORKERS}'/' -i /home/git/gitlab/config/unicorn.rb # configure unicorn timeout -sed 's/timeout 30/timeout '${UNICORN_TIMEOUT}'/' -i /home/git/gitlab/config/unicorn.rb +sed 's/{{UNICORN_TIMEOUT}}/'${UNICORN_TIMEOUT}'/' -i /home/git/gitlab/config/unicorn.rb # take ownership of /home/git/data chown git:git /home/git/data diff --git a/resources/setup/config/gitlab-shell/config.yml b/resources/setup/config/gitlab-shell/config.yml index 7ac6258c..43c17eaa 100644 --- a/resources/setup/config/gitlab-shell/config.yml +++ b/resources/setup/config/gitlab-shell/config.yml @@ -15,7 +15,7 @@ http_settings: # Give the canonicalized absolute pathname, # REPOS_PATH MUST NOT CONTAIN ANY SYMLINK!!! # Check twice that none of the components is a symlink, including "/home". -repos_path: "/home/git/repositories" +repos_path: "/home/git/data/repositories" # File used as authorized_keys for gitlab user auth_file: "/home/git/.ssh/authorized_keys" @@ -23,8 +23,8 @@ auth_file: "/home/git/.ssh/authorized_keys" # Redis settings used for pushing commit notices to gitlab redis: bin: /usr/bin/redis-cli - host: 127.0.0.1 - port: 6379 + host: {{REDIS_HOST}} + port: {{REDIS_PORT}} # socket: /tmp/redis.socket # Only define this if you want to use sockets namespace: resque:gitlab diff --git a/resources/setup/config/gitlabhq/gitlab.yml b/resources/setup/config/gitlabhq/gitlab.yml index c63e8cb7..c25982af 100644 --- a/resources/setup/config/gitlabhq/gitlab.yml +++ b/resources/setup/config/gitlabhq/gitlab.yml @@ -15,9 +15,9 @@ production: &base ## GitLab settings gitlab: ## Web server settings - host: localhost - port: 80 - https: false + host: {{GITLAB_HOST}} + port: {{GITLAB_PORT}} + https: {{GITLAB_HTTPS}} # Uncomment and customize the last line to run in a non-root path # WARNING: We recommend creating a FQDN to host GitLab in a root path instead of this. @@ -35,10 +35,10 @@ production: &base ## Email settings # Email address used in the "From" field in mails sent by GitLab - email_from: gitlab@localhost + email_from: {{GITLAB_EMAIL}} # Email address of your support contact (default: same as email_from) - support_email: support@localhost + support_email: {{GITLAB_SUPPORT}} ## User settings default_projects_limit: 10 @@ -55,7 +55,7 @@ production: &base ## Users management # default: false - Account passwords are not sent via the email if signup is enabled. - # signup_enabled: true + signup_enabled: {{GITLAB_SIGNUP}} # Restrict setting visibility levels for non-admin users. # The default is to allow all levels. @@ -175,7 +175,7 @@ production: &base # GitLab Satellites satellites: # Relative paths are relative to Rails.root (default: tmp/repo_satellites/) - path: /home/git/gitlab-satellites/ + path: /home/git/data/gitlab-satellites/ ## Backup settings backup: @@ -187,7 +187,7 @@ production: &base path: /home/git/gitlab-shell/ # REPOS_PATH MUST NOT BE A SYMLINK!!! - repos_path: /home/git/repositories/ + repos_path: /home/git/data/repositories/ hooks_path: /home/git/gitlab-shell/hooks/ # Git over HTTP diff --git a/resources/setup/config/gitlabhq/resque.yml b/resources/setup/config/gitlabhq/resque.yml index 3c7ad0e5..0a35982c 100644 --- a/resources/setup/config/gitlabhq/resque.yml +++ b/resources/setup/config/gitlabhq/resque.yml @@ -1,3 +1,3 @@ development: redis://localhost:6379 test: redis://localhost:6379 -production: redis://redis.example.com:6379 +production: redis://{{REDIS_HOST}}:{{REDIS_PORT}} diff --git a/resources/setup/config/gitlabhq/unicorn.rb b/resources/setup/config/gitlabhq/unicorn.rb index ba5e5cdd..fe0bda90 100644 --- a/resources/setup/config/gitlabhq/unicorn.rb +++ b/resources/setup/config/gitlabhq/unicorn.rb @@ -21,7 +21,7 @@ # Use at least one worker per core if you're on a dedicated server, # more will usually help for _short_ waits on databases/caches. -worker_processes 2 +worker_processes {{UNICORN_WORKERS}} # Since Unicorn is never exposed to outside clients, it does not need to # run on the standard HTTP port (80), there is no reason to start Unicorn @@ -40,7 +40,7 @@ listen "/home/git/gitlab/tmp/sockets/gitlab.socket", :backlog => 64 listen "127.0.0.1:8080", :tcp_nopush => true # nuke workers after 30 seconds instead of 60 seconds (the default) -timeout 30 +timeout {{UNICORN_TIMEOUT}} # feel free to point this anywhere accessible on the filesystem pid "/home/git/gitlab/tmp/pids/unicorn.pid" diff --git a/resources/setup/install b/resources/setup/install index 291a237c..ab98c360 100755 --- a/resources/setup/install +++ b/resources/setup/install @@ -21,7 +21,6 @@ chown -R git:git /home/git/gitlab-shell/ cd /home/git/gitlab-shell sudo -u git -H cp -a /gitlab/setup/config/gitlab-shell/config.yml config.yml -sudo -u git -H sed 's/repos_path: "\/home\/git\/repositories"/repos_path: "\/home\/git\/data\/repositories"/' -i config.yml sudo -u git -H ./bin/install # install gitlab @@ -39,10 +38,6 @@ sudo -u git -H cp /gitlab/setup/config/gitlabhq/sidekiq.yml config/sidekiq.yml sudo -u git -H cp /gitlab/setup/config/gitlabhq/unicorn.rb config/unicorn.rb sudo -u git -H cp /gitlab/setup/config/gitlabhq/rack_attack.rb config/initializers/rack_attack.rb -# configure repositories path -sudo -u git -H sed 's/repos_path: \/home\/git\/repositories\//repos_path: \/home\/git\/data\/repositories\//' -i config/gitlab.yml -sudo -u git -H sed 's/path: \/home\/git\/gitlab-satellites\//path: \/home\/git\/data\/gitlab-satellites\//' -i config/gitlab.yml - # create required tmp and log directories sudo -u git -H mkdir -p tmp/pids/ tmp/sockets/ chmod -R u+rwX log tmp