Merge branch 'master' into JrCs-pr-fixes

This commit is contained in:
Sameer Naik 2015-12-11 20:26:00 +05:30
commit cdee89bacd
13 changed files with 222 additions and 225 deletions

View File

@ -2,6 +2,11 @@
This file only reflects the changes that are made in this image. Please refer to the upstream GitLab [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) for the list of changes in GitLab.
**8.2.3**
- fixed static asset routing when `GITLAB_RELATIVE_URL_ROOT` is used.
- added `GITLAB_BACKUP_PG_SCHEMA` configuration parameter
- gitlab: upgrade to CE v8.2.3
**8.2.2**
- added `GITLAB_DOWNLOADS_DIR` configuration parameter
- `DB_TYPE` parameter renamed to `DB_ADAPTER` with `mysql2` and `postgresql` as accepted values

View File

@ -1,7 +1,7 @@
FROM sameersbn/ubuntu:14.04.20151117
MAINTAINER sameer@damagehead.com
ENV GITLAB_VERSION=8.2.2 \
ENV GITLAB_VERSION=8.2.3 \
GITLAB_SHELL_VERSION=2.6.8 \
GITLAB_WORKHORSE_VERSION=0.4.2 \
GITLAB_USER="git" \

View File

@ -2,7 +2,7 @@
[![Deploy to Tutum](https://s.tutum.co/deploy-to-tutum.svg)](https://dashboard.tutum.co/stack/deploy/)
# sameersbn/gitlab:8.2.2
# sameersbn/gitlab:8.2.3
- [Introduction](#introduction)
- [Changelog](Changelog.md)
@ -108,7 +108,7 @@ Automated builds of the image are available on [Dockerhub](https://hub.docker.co
> **Note**: Builds are also available on [Quay.io](https://quay.io/repository/sameersbn/gitlab)
```bash
docker pull sameersbn/gitlab:8.2.2
docker pull sameersbn/gitlab:8.2.3
```
You can also pull the `latest` tag which is built from the repository *HEAD*
@ -150,7 +150,7 @@ docker run --name gitlab-postgresql -d \
--env 'DB_NAME=gitlabhq_production' \
--env 'DB_USER=gitlab' --env 'DB_PASS=password' \
--volume /srv/docker/gitlab/postgresql:/var/lib/postgresql \
sameersbn/postgresql:9.4-9
sameersbn/postgresql:9.4-10
```
Step 2. Launch a redis container
@ -170,7 +170,7 @@ docker run --name gitlab -d \
--env 'GITLAB_PORT=10080' --env 'GITLAB_SSH_PORT=10022' \
--env 'GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string' \
--volume /srv/docker/gitlab/gitlab:/home/git/data \
sameersbn/gitlab:8.2.2
sameersbn/gitlab:8.2.3
```
*Please refer to [Available Configuration Parameters](#available-configuration-parameters) to understand `GITLAB_PORT` and other configuration options*
@ -206,7 +206,7 @@ Volumes can be mounted in docker by specifying the `-v` option in the docker run
```bash
docker run --name gitlab -d \
--volume /srv/docker/gitlab/gitlab:/home/git/data \
sameersbn/gitlab:8.2.2
sameersbn/gitlab:8.2.3
```
## Database
@ -237,7 +237,7 @@ docker run --name gitlab -d \
--env 'DB_NAME=gitlabhq_production' \
--env 'DB_USER=gitlab' --env 'DB_PASS=password' \
--volume /srv/docker/gitlab/gitlab:/home/git/data \
sameersbn/gitlab:8.2.2
sameersbn/gitlab:8.2.3
```
#### Linking to PostgreSQL Container
@ -251,7 +251,7 @@ To illustrate linking with a postgresql container, we will use the [sameersbn/po
First, lets pull the postgresql image from the docker index.
```bash
docker pull sameersbn/postgresql:9.4-9
docker pull sameersbn/postgresql:9.4-10
```
For data persistence lets create a store for the postgresql and start the container.
@ -270,7 +270,7 @@ docker run --name gitlab-postgresql -d \
--env 'DB_NAME=gitlabhq_production' \
--env 'DB_USER=gitlab' --env 'DB_PASS=password' \
--volume /srv/docker/gitlab/postgresql:/var/lib/postgresql \
sameersbn/postgresql:9.4-9
sameersbn/postgresql:9.4-10
```
The above command will create a database named `gitlabhq_production` and also create a user named `gitlab` with the password `password` with access to the `gitlabhq_production` database.
@ -280,7 +280,7 @@ We are now ready to start the GitLab application.
```bash
docker run --name gitlab -d --link gitlab-postgresql:postgresql \
--volume /srv/docker/gitlab/gitlab:/home/git/data \
sameersbn/gitlab:8.2.2
sameersbn/gitlab:8.2.3
```
Here the image will also automatically fetch the `DB_NAME`, `DB_USER` and `DB_PASS` variables from the postgresql container as they are specified in the `docker run` command for the postgresql container. This is made possible using the magic of docker links and works with the following images:
@ -334,7 +334,7 @@ docker run --name gitlab -d \
--env 'DB_NAME=gitlabhq_production' \
--env 'DB_USER=gitlab' --env 'DB_PASS=password' \
--volume /srv/docker/gitlab/gitlab:/home/git/data \
sameersbn/gitlab:8.2.2
sameersbn/gitlab:8.2.3
```
#### Linking to MySQL Container
@ -377,7 +377,7 @@ We are now ready to start the GitLab application.
```bash
docker run --name gitlab -d --link gitlab-mysql:mysql \
--volume /srv/docker/gitlab/gitlab:/home/git/data \
sameersbn/gitlab:8.2.2
sameersbn/gitlab:8.2.3
```
Here the image will also automatically fetch the `DB_NAME`, `DB_USER` and `DB_PASS` variables from the mysql container as they are specified in the `docker run` command for the mysql container. This is made possible using the magic of docker links and works with the following images:
@ -404,7 +404,7 @@ The image can be configured to use an external redis server. The configuration s
```bash
docker run --name gitlab -it --rm \
--env 'REDIS_HOST=192.168.1.100' --env 'REDIS_PORT=6379' \
sameersbn/gitlab:8.2.2
sameersbn/gitlab:8.2.3
```
### Linking to Redis Container
@ -431,7 +431,7 @@ We are now ready to start the GitLab application.
```bash
docker run --name gitlab -d --link gitlab-redis:redisio \
sameersbn/gitlab:8.2.2
sameersbn/gitlab:8.2.3
```
### Mail
@ -461,7 +461,7 @@ If you are using Gmail then all you need to do is:
docker run --name gitlab -d \
--env 'IMAP_USER=USER@gmail.com' --env 'IMAP_PASS=PASSWORD' \
--volume /srv/docker/gitlab/gitlab:/home/git/data \
sameersbn/gitlab:8.2.2
sameersbn/gitlab:8.2.3
```
Please refer the [Available Configuration Parameters](#available-configuration-parameters) section for the list of SMTP parameters that can be specified.
@ -538,7 +538,7 @@ docker run --name gitlab -d \
--env 'GITLAB_SSH_PORT=10022' --env 'GITLAB_PORT=10443' \
--env 'GITLAB_HTTPS=true' --env 'SSL_SELF_SIGNED=true' \
--volume /srv/docker/gitlab/gitlab:/home/git/data \
sameersbn/gitlab:8.2.2
sameersbn/gitlab:8.2.3
```
In this configuration, any requests made over the plain http protocol will automatically be redirected to use the https protocol. However, this is not optimal when using a load balancer.
@ -554,7 +554,7 @@ docker run --name gitlab -d \
--env 'GITLAB_HTTPS=true' --env 'SSL_SELF_SIGNED=true' \
--env 'GITLAB_HTTPS_HSTS_MAXAGE=2592000' \
--volume /srv/docker/gitlab/gitlab:/home/git/data \
sameersbn/gitlab:8.2.2
sameersbn/gitlab:8.2.3
```
If you want to completely disable HSTS set `GITLAB_HTTPS_HSTS_ENABLED` to `false`.
@ -577,7 +577,7 @@ docker run --name gitlab -d \
--env 'GITLAB_SSH_PORT=10022' --env 'GITLAB_PORT=443' \
--env 'GITLAB_HTTPS=true' --env 'SSL_SELF_SIGNED=true' \
--volume /srv/docker/gitlab/gitlab:/home/git/data \
sameersbn/gitlab:8.2.2
sameersbn/gitlab:8.2.3
```
Again, drop the `--env 'SSL_SELF_SIGNED=true'` option if you are using CA certified SSL certificates.
@ -625,7 +625,7 @@ Let's assume we want to deploy our application to '/git'. GitLab needs to know t
docker run --name gitlab -it --rm \
--env 'GITLAB_RELATIVE_URL_ROOT=/git' \
--volume /srv/docker/gitlab/gitlab:/home/git/data \
sameersbn/gitlab:8.2.2
sameersbn/gitlab:8.2.3
```
GitLab will now be accessible at the `/git` path, e.g. `http://www.example.com/git`.
@ -721,14 +721,14 @@ Also the container processes seem to be executed as the host's user/group `1000`
```bash
docker run --name gitlab -it --rm [options] \
--env "USERMAP_UID=$(id -u git)" --env "USERMAP_GID=$(id -g git)" \
sameersbn/gitlab:8.2.2
sameersbn/gitlab:8.2.3
```
When changing this mapping, all files and directories in the mounted data volume `/home/git/data` have to be re-owned by the new ids. This can be achieved automatically using the following command:
```bash
docker run --name gitlab -d [OPTIONS] \
sameersbn/gitlab:8.2.2 app:sanitize
sameersbn/gitlab:8.2.3 app:sanitize
```
### Piwik
@ -780,6 +780,7 @@ Below is the complete list of available options that can be used to customize yo
- **GITLAB_LFS_OBJECTS_DIR**: Directory to store the lfs-objects. Defaults to `$GITLAB_SHARED_DIR/lfs-objects`
- **GITLAB_BACKUPS**: Setup cron job to automatic backups. Possible values `disable`, `daily`, `weekly` or `monthly`. Disabled by default
- **GITLAB_BACKUP_EXPIRY**: Configure how long (in seconds) to keep backups before they are deleted. By default when automated backups are disabled backups are kept forever (0 seconds), else the backups expire in 7 days (604800 seconds).
- **GITLAB_BACKUP_PG_SCHEMA**: Specify the PostgreSQL schema for the backups. No defaults, which means that all schemas will be backed up. see #524
- **GITLAB_BACKUP_ARCHIVE_PERMISSIONS**: Sets the permissions of the backup archives. Defaults to `0600`. [See](http://doc.gitlab.com/ce/raketasks/backup_restore.html#backup-archive-permissions)
- **GITLAB_BACKUP_TIME**: Set a time for the automatic backups in `HH:MM` format. Defaults to `04:00`.
- **GITLAB_SSH_HOST**: The ssh host. Defaults to **GITLAB_HOST**.
@ -911,7 +912,7 @@ Execute the rake task to create a backup.
```bash
docker run --name gitlab -it --rm [OPTIONS] \
sameersbn/gitlab:8.2.2 app:rake gitlab:backup:create
sameersbn/gitlab:8.2.3 app:rake gitlab:backup:create
```
A backup will be created in the backups folder of the [Data Store](#data-store). You can change the location of the backups using the `GITLAB_BACKUP_DIR` configuration parameter.
@ -932,7 +933,7 @@ Execute the rake task to restore a backup. Make sure you run the container in in
```bash
docker run --name gitlab -it --rm [OPTIONS] \
sameersbn/gitlab:8.2.2 app:rake gitlab:backup:restore
sameersbn/gitlab:8.2.3 app:rake gitlab:backup:restore
```
The list of all available backups will be displayed in reverse chronological order. Select the backup you want to restore and continue.
@ -941,7 +942,7 @@ To avoid user interaction in the restore operation, specify the timestamp of the
```bash
docker run --name gitlab -it --rm [OPTIONS] \
sameersbn/gitlab:8.2.2 app:rake gitlab:backup:restore BACKUP=1417624827
sameersbn/gitlab:8.2.3 app:rake gitlab:backup:restore BACKUP=1417624827
```
## Automated Backups
@ -966,7 +967,7 @@ The `app:rake` command allows you to run gitlab rake tasks. To run a rake task s
```bash
docker run --name gitlab -d [OPTIONS] \
sameersbn/gitlab:8.2.2 app:rake gitlab:env:info
sameersbn/gitlab:8.2.3 app:rake gitlab:env:info
```
You can also use `docker exec` to run raketasks on running gitlab instance. For example,
@ -979,7 +980,7 @@ Similarly, to import bare repositories into GitLab project instance
```bash
docker run --name gitlab -d [OPTIONS] \
sameersbn/gitlab:8.2.2 app:rake gitlab:import:repos
sameersbn/gitlab:8.2.3 app:rake gitlab:import:repos
```
Or
@ -1001,7 +1002,7 @@ To upgrade to newer gitlab releases, simply follow this 4 step upgrade procedure
- **Step 1**: Update the docker image.
```bash
docker pull sameersbn/gitlab:8.2.2
docker pull sameersbn/gitlab:8.2.3
```
- **Step 2**: Stop and remove the currently running image
@ -1025,7 +1026,7 @@ Replace `x.x.x` with the version you are upgrading from. For example, if you are
> **Note**: Since GitLab `8.0.0` you need to provide the `GITLAB_SECRETS_DB_KEY_BASE` parameter while starting the image.
```bash
docker run --name gitlab -d [OPTIONS] sameersbn/gitlab:8.2.2
docker run --name gitlab -d [OPTIONS] sameersbn/gitlab:8.2.3
```
## Shell Access

View File

@ -1 +1 @@
8.2.2
8.2.3

View File

@ -117,18 +117,18 @@ chmod +x /etc/init.d/gitlab
rm -rf /etc/nginx/sites-enabled/default
# configure sshd
sed -i 's|^[#]*UsePAM yes|UsePAM no|' /etc/ssh/sshd_config
sed -i 's|^[#]*UsePrivilegeSeparation yes|UsePrivilegeSeparation no|' /etc/ssh/sshd_config
sed -i 's|^[#]*PasswordAuthentication yes|PasswordAuthentication no|' /etc/ssh/sshd_config
sed -i 's|^[#]*LogLevel INFO|LogLevel VERBOSE|' /etc/ssh/sshd_config
sed -i "s|^[#]*UsePAM yes|UsePAM no|" /etc/ssh/sshd_config
sed -i "s|^[#]*UsePrivilegeSeparation yes|UsePrivilegeSeparation no|" /etc/ssh/sshd_config
sed -i "s|^[#]*PasswordAuthentication yes|PasswordAuthentication no|" /etc/ssh/sshd_config
sed -i "s|^[#]*LogLevel INFO|LogLevel VERBOSE|" /etc/ssh/sshd_config
echo "UseDNS no" >> /etc/ssh/sshd_config
# move supervisord.log file to ${GITLAB_LOG_DIR}/supervisor/
sed -i 's|^[#]*logfile=.*|logfile='"${GITLAB_LOG_DIR}"'/supervisor/supervisord.log ;|' /etc/supervisor/supervisord.conf
sed -i "s|^[#]*logfile=.*|logfile=${GITLAB_LOG_DIR}/supervisor/supervisord.log ;|" /etc/supervisor/supervisord.conf
# move nginx logs to ${GITLAB_LOG_DIR}/nginx
sed -i 's|access_log /var/log/nginx/access.log;|access_log '"${GITLAB_LOG_DIR}"'/nginx/access.log;|' /etc/nginx/nginx.conf
sed -i 's|error_log /var/log/nginx/error.log;|error_log '"${GITLAB_LOG_DIR}"'/nginx/error.log;|' /etc/nginx/nginx.conf
sed -i "s|access_log /var/log/nginx/access.log;|access_log ${GITLAB_LOG_DIR}/nginx/access.log;|" /etc/nginx/nginx.conf
sed -i "s|error_log /var/log/nginx/error.log;|error_log ${GITLAB_LOG_DIR}/nginx/error.log;|" /etc/nginx/nginx.conf
# configure supervisord log rotation
cat > /etc/logrotate.d/supervisord <<EOF

View File

@ -348,7 +348,7 @@ production: &base
path: "{{GITLAB_BACKUP_DIR}}" # Relative paths are relative to Rails.root (default: tmp/backups/)
archive_permissions: {{GITLAB_BACKUP_ARCHIVE_PERMISSIONS}} # Permissions for the resulting backup.tar file (default: 0600)
keep_time: {{GITLAB_BACKUP_EXPIRY}} # default: 0 (forever) (in seconds)
# pg_schema: public # default: nil, it means that all schemas will be backed up
pg_schema: {{GITLAB_BACKUP_PG_SCHEMA}} # default: nil, it means that all schemas will be backed up
upload:
# Fog storage connection settings, see http://fog.io/storage/ .
connection:

View File

@ -65,7 +65,6 @@ server {
error_log {{GITLAB_LOG_DIR}}/nginx/gitlab_error.log;
location {{GITLAB_RELATIVE_URL_ROOT}} {
# alias {{GITLAB_INSTALL_DIR}}/public;
## Serve static files from defined root folder.
## @gitlab is a named location for the upstream fallback, see below.
try_files $uri /index.html $uri.html @gitlab;
@ -195,8 +194,8 @@ server {
## WARNING: If you are using relative urls remove the block below
## See config/application.rb under "Relative url support" for the list of
## other files that need to be changed for relative url support
location ~ ^{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}assets/(.*) {
alias {{GITLAB_INSTALL_DIR}}/public/assets/$1;
location ~ ^/(assets)/ {
root {{GITLAB_INSTALL_DIR}}/public;
gzip_static on; # to serve pre-gzipped version
expires max;
add_header Cache-Control public;

View File

@ -113,7 +113,6 @@ server {
error_log {{GITLAB_LOG_DIR}}/nginx/gitlab_error.log;
location {{GITLAB_RELATIVE_URL_ROOT}} {
# alias {{GITLAB_INSTALL_DIR}}/public;
## Serve static files from defined root folder.
## @gitlab is a named location for the upstream fallback, see below.
try_files $uri /index.html $uri.html @gitlab;
@ -245,8 +244,8 @@ server {
## WARNING: If you are using relative urls remove the block below
## See config/application.rb under "Relative url support" for the list of
## other files that need to be changed for relative url support
location ~ ^{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}assets/(.*) {
alias {{GITLAB_INSTALL_DIR}}/public/assets/$1;
location ~ ^/(assets)/ {
root {{GITLAB_INSTALL_DIR}}/public;
gzip_static on; # to serve pre-gzipped version
expires max;
add_header Cache-Control public;

View File

@ -96,6 +96,7 @@ CA_CERTIFICATES_PATH=${CA_CERTIFICATES_PATH:-$GITLAB_DATA_DIR/certs/ca.crt}
GITLAB_BACKUPS=${GITLAB_BACKUPS:-disable}
GITLAB_BACKUP_TIME=${GITLAB_BACKUP_TIME:-04:00}
GITLAB_BACKUP_EXPIRY=${GITLAB_BACKUP_EXPIRY:-}
GITLAB_BACKUP_PG_SCHEMA=${GITLAB_BACKUP_PG_SCHEMA:-}
GITLAB_BACKUP_ARCHIVE_PERMISSIONS=${GITLAB_BACKUP_ARCHIVE_PERMISSIONS:-0600}
case ${GITLAB_BACKUPS} in
daily|weekly|monthly) GITLAB_BACKUP_EXPIRY=${GITLAB_BACKUP_EXPIRY:-604800} ;;

View File

@ -5,6 +5,17 @@ source ${GITLAB_RUNTIME_DIR}/env-defaults
SYSCONF_TEMPLATES_DIR="${GITLAB_RUNTIME_DIR}/config"
USERCONF_TEMPLATES_DIR="${GITLAB_DATA_DIR}/config"
GITLAB_CONFIG="${GITLAB_INSTALL_DIR}/config/gitlab.yml"
GITLAB_DATABASE_CONFIG="${GITLAB_INSTALL_DIR}/config/database.yml"
GITLAB_UNICORN_CONFIG="${GITLAB_INSTALL_DIR}/config/unicorn.rb"
GITLAB_SMTP_CONFIG="${GITLAB_INSTALL_DIR}/config/initializers/smtp_settings.rb"
GITLAB_RESQUE_CONFIG="${GITLAB_INSTALL_DIR}/config/resque.yml"
GITLAB_SECRETS_CONFIG="${GITLAB_INSTALL_DIR}/config/secrets.yml"
GITLAB_ROBOTS_CONFIG="${GITLAB_INSTALL_DIR}/public/robots.txt"
GITLAB_SHELL_CONFIG="${GITLAB_SHELL_INSTALL_DIR}/config.yml"
GITLAB_NGINX_CONFIG="/etc/nginx/sites-enabled/gitlab"
GITLAB_CI_NGINX_CONFIG="/etc/nginx/sites-enabled/gitlab_ci"
## Execute a command as GITLAB_USER
exec_as_git() {
sudo -HEu ${GITLAB_USER} "$@"
@ -165,13 +176,12 @@ gitlab_configure_database() {
gitlab_finalize_database_parameters
gitlab_check_database_connection
replace_placeholders \
${GITLAB_INSTALL_DIR}/config/database.yml \
replace_placeholders ${GITLAB_DATABASE_CONFIG} \
DB_ADAPTER DB_ENCODING DB_HOST DB_PORT DB_NAME DB_USER DB_PASS DB_POOL
if [[ ${DB_ADAPTER} == postgresql ]]; then
exec_as_git sed -i '/reconnect: /d' ${GITLAB_INSTALL_DIR}/config/database.yml
exec_as_git sed -i '/collation: /d' ${GITLAB_INSTALL_DIR}/config/database.yml
exec_as_git sed -i "/reconnect: /d" ${GITLAB_DATABASE_CONFIG}
exec_as_git sed -i "/collation: /d" ${GITLAB_DATABASE_CONFIG}
fi
}
@ -218,30 +228,30 @@ gitlab_configure_redis() {
gitlab_finalize_redis_parameters
gitlab_check_redis_connection
exec_as_git sed -i 's|{{REDIS_HOST}}|'"${REDIS_HOST}"'|g' ${GITLAB_INSTALL_DIR}/config/resque.yml
exec_as_git sed -i 's|{{REDIS_PORT}}|'"${REDIS_PORT}"'|g' ${GITLAB_INSTALL_DIR}/config/resque.yml
exec_as_git sed -i "s|{{REDIS_HOST}}|${REDIS_HOST}|g" ${GITLAB_RESQUE_CONFIG}
exec_as_git sed -i "s|{{REDIS_PORT}}|${REDIS_PORT}|g" ${GITLAB_RESQUE_CONFIG}
}
gitlab_configure_unicorn() {
echo "Configuring gitlab::unicorn..."
if [[ -n ${GITLAB_RELATIVE_URL_ROOT} ]]; then
exec_as_git sed -i 's|{{GITLAB_RELATIVE_URL_ROOT}}|'"${GITLAB_RELATIVE_URL_ROOT}"'|' ${GITLAB_INSTALL_DIR}/config/unicorn.rb
exec_as_git sed -i "s|{{GITLAB_RELATIVE_URL_ROOT}}|${GITLAB_RELATIVE_URL_ROOT}|" ${GITLAB_UNICORN_CONFIG}
else
exec_as_git sed -i '/{{GITLAB_RELATIVE_URL_ROOT}}/d' ${GITLAB_INSTALL_DIR}/config/unicorn.rb
exec_as_git sed -i "/{{GITLAB_RELATIVE_URL_ROOT}}/d" ${GITLAB_UNICORN_CONFIG}
fi
# configure workers
exec_as_git sed -i 's|{{GITLAB_INSTALL_DIR}}|'"${GITLAB_INSTALL_DIR}"'|g' ${GITLAB_INSTALL_DIR}/config/unicorn.rb
exec_as_git sed -i 's|{{UNICORN_WORKERS}}|'"${UNICORN_WORKERS}"'|' ${GITLAB_INSTALL_DIR}/config/unicorn.rb
exec_as_git sed -i "s|{{GITLAB_INSTALL_DIR}}|${GITLAB_INSTALL_DIR}|g" ${GITLAB_UNICORN_CONFIG}
exec_as_git sed -i "s|{{UNICORN_WORKERS}}|${UNICORN_WORKERS}|" ${GITLAB_UNICORN_CONFIG}
# configure timeout
exec_as_git sed -i 's|{{UNICORN_TIMEOUT}}|'"${UNICORN_TIMEOUT}"'|' ${GITLAB_INSTALL_DIR}/config/unicorn.rb
exec_as_git sed -i "s|{{UNICORN_TIMEOUT}}|${UNICORN_TIMEOUT}|" ${GITLAB_UNICORN_CONFIG}
}
gitlab_configure_timezone() {
echo "Configuring gitlab::timezone..."
GITLAB_TIMEZONE="$(echo "${GITLAB_TIMEZONE}" | sed 's|[&]|\\&|g')"
exec_as_git sed -i 's|{{GITLAB_TIMEZONE}}|'"${GITLAB_TIMEZONE}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "s|{{GITLAB_TIMEZONE}}|${GITLAB_TIMEZONE}|" ${GITLAB_CONFIG}
}
gitlab_configure_mail_delivery() {
@ -249,37 +259,35 @@ gitlab_configure_mail_delivery() {
echo "Configuring gitlab::smtp_settings..."
if [[ -z "${SMTP_USER}" ]]; then
exec_as_git sed -i '/{{SMTP_USER}}/d' ${GITLAB_INSTALL_DIR}/config/initializers/smtp_settings.rb
exec_as_git sed -i '/{{SMTP_PASS}}/d' ${GITLAB_INSTALL_DIR}/config/initializers/smtp_settings.rb
exec_as_git sed -i '/{{SMTP_USER}}/d' ${GITLAB_SMTP_CONFIG}
exec_as_git sed -i '/{{SMTP_PASS}}/d' ${GITLAB_SMTP_CONFIG}
if [[ -z "${SMTP_PASS}" ]]; then
exec_as_git sed -i '/{{SMTP_PASS}}/d' ${GITLAB_INSTALL_DIR}/config/initializers/smtp_settings.rb
exec_as_git sed -i '/{{SMTP_PASS}}/d' ${GITLAB_SMTP_CONFIG}
fi
fi
replace_placeholders \
${GITLAB_INSTALL_DIR}/config/initializers/smtp_settings.rb \
replace_placeholders ${GITLAB_SMTP_CONFIG} \
SMTP_USER SMTP_PASS SMTP_HOST SMTP_PORT SMTP_DOMAIN SMTP_STARTTLS SMTP_TLS SMTP_OPENSSL_VERIFY_MODE
case ${SMTP_AUTHENTICATION} in
"") exec_as_git sed -i '/{{SMTP_AUTHENTICATION}}/d' ${GITLAB_INSTALL_DIR}/config/initializers/smtp_settings.rb ;;
*) exec_as_git sed -i 's|{{SMTP_AUTHENTICATION}}|'"${SMTP_AUTHENTICATION}"'|' ${GITLAB_INSTALL_DIR}/config/initializers/smtp_settings.rb ;;
"") exec_as_git sed -i "/{{SMTP_AUTHENTICATION}}/d" ${GITLAB_SMTP_CONFIG} ;;
*) exec_as_git sed -i "s|{{SMTP_AUTHENTICATION}}|${SMTP_AUTHENTICATION}|" ${GITLAB_SMTP_CONFIG} ;;
esac
if [[ ${SMTP_CA_ENABLED} == true ]]; then
if [[ -d ${SMTP_CA_PATH} ]]; then
exec_as_git sed -i 's|{{SMTP_CA_PATH}}|'"${SMTP_CA_PATH}"'|' ${GITLAB_INSTALL_DIR}/config/initializers/smtp_settings.rb
exec_as_git sed -i "s|{{SMTP_CA_PATH}}|${SMTP_CA_PATH}|" ${GITLAB_SMTP_CONFIG}
fi
if [[ -f ${SMTP_CA_FILE} ]]; then
exec_as_git sed -i 's|{{SMTP_CA_FILE}}|'"${SMTP_CA_FILE}"'|' ${GITLAB_INSTALL_DIR}/config/initializers/smtp_settings.rb
exec_as_git sed -i "s|{{SMTP_CA_FILE}}|${SMTP_CA_FILE}|" ${GITLAB_SMTP_CONFIG}
fi
else
exec_as_git sed -i '/{{SMTP_CA_PATH}}/d' ${GITLAB_INSTALL_DIR}/config/initializers/smtp_settings.rb
exec_as_git sed -i '/{{SMTP_CA_FILE}}/d' ${GITLAB_INSTALL_DIR}/config/initializers/smtp_settings.rb
exec_as_git sed -i "/{{SMTP_CA_PATH}}/d" ${GITLAB_SMTP_CONFIG}
exec_as_git sed -i "/{{SMTP_CA_FILE}}/d" ${GITLAB_SMTP_CONFIG}
fi
fi
replace_placeholders \
${GITLAB_INSTALL_DIR}/config/gitlab.yml \
replace_placeholders ${GITLAB_CONFIG} \
GITLAB_EMAIL_ENABLED GITLAB_EMAIL GITLAB_EMAIL_DISPLAY_NAME GITLAB_EMAIL_REPLY_TO
}
@ -288,36 +296,34 @@ gitlab_configure_mailroom() {
echo "Configuring gitlab::incoming_email..."
if [[ -z "${IMAP_USER}" ]]; then
exec_as_git sed -i '/{{IMAP_USER}}/d' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i '/{{IMAP_PASS}}/d' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i '/{{IMAP_USER}}/d' ${GITLAB_CONFIG}
exec_as_git sed -i '/{{IMAP_PASS}}/d' ${GITLAB_CONFIG}
else
if [[ -z "${IMAP_PASS}" ]]; then
exec_as_git sed -i '/{{IMAP_PASS}}/d' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i '/{{IMAP_PASS}}/d' ${GITLAB_CONFIG}
fi
fi
else
exec_as_git sed -i '/{{IMAP_USER}}/d' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i '/{{IMAP_PASS}}/d' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i '/{{IMAP_HOST}}/d' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i '/{{IMAP_PORT}}/d' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i '/{{IMAP_SSL}}/d' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i '/{{IMAP_STARTTLS}}/d' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i '/{{IMAP_MAILBOX}}/d' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "/{{IMAP_USER}}/d" ${GITLAB_CONFIG}
exec_as_git sed -i "/{{IMAP_PASS}}/d" ${GITLAB_CONFIG}
exec_as_git sed -i "/{{IMAP_HOST}}/d" ${GITLAB_CONFIG}
exec_as_git sed -i "/{{IMAP_PORT}}/d" ${GITLAB_CONFIG}
exec_as_git sed -i "/{{IMAP_SSL}}/d" ${GITLAB_CONFIG}
exec_as_git sed -i "/{{IMAP_STARTTLS}}/d" ${GITLAB_CONFIG}
exec_as_git sed -i "/{{IMAP_MAILBOX}}/d" ${GITLAB_CONFIG}
fi
replace_placeholders \
${GITLAB_INSTALL_DIR}/config/gitlab.yml \
replace_placeholders ${GITLAB_CONFIG} \
GITLAB_INCOMING_EMAIL_ADDRESS GITLAB_INCOMING_EMAIL_ENABLED IMAP_USER IMAP_PASS IMAP_HOST IMAP_PORT IMAP_SSL IMAP_STARTTLS IMAP_MAILBOX
# enable/disable startup of mailroom
echo "mail_room_enabled=${GITLAB_INCOMING_EMAIL_ENABLED}" >> /etc/default/gitlab
sed -i 's|{{GITLAB_INCOMING_EMAIL_ENABLED}}|'"${GITLAB_INCOMING_EMAIL_ENABLED}"'|' /etc/supervisor/conf.d/mail_room.conf
sed -i "s|{{GITLAB_INCOMING_EMAIL_ENABLED}}|${GITLAB_INCOMING_EMAIL_ENABLED}|" /etc/supervisor/conf.d/mail_room.conf
}
gitlab_configure_ldap() {
echo "Configuring gitlab::ldap..."
replace_placeholders \
${GITLAB_INSTALL_DIR}/config/gitlab.yml \
replace_placeholders ${GITLAB_CONFIG} \
LDAP_ENABLED LDAP_HOST LDAP_PORT LDAP_UID LDAP_METHOD LDAP_BIND_DN LDAP_PASS LDAP_ACTIVE_DIRECTORY \
LDAP_ALLOW_USERNAME_OR_EMAIL_LOGIN LDAP_BLOCK_AUTO_CREATED_USERS LDAP_BASE LDAP_USER_FILTER LDAP_LABEL
}
@ -326,12 +332,11 @@ gitlab_configure_oauth_google() {
if [[ -n ${OAUTH_GOOGLE_API_KEY} && -n ${OAUTH_GOOGLE_APP_SECRET} ]]; then
echo "Configuring gitlab::oauth::google..."
OAUTH_ENABLED=${OAUTH_ENABLED:-true}
replace_placeholders \
${GITLAB_INSTALL_DIR}/config/gitlab.yml \
replace_placeholders ${GITLAB_CONFIG} \
OAUTH_GOOGLE_API_KEY OAUTH_GOOGLE_APP_SECRET OAUTH_GOOGLE_RESTRICT_DOMAIN
exec_as_git sed -i 's|{{OAUTH_GOOGLE_APPROVAL_PROMPT}}||' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
else
exec_as_git sed -i "/name: 'google_oauth2'/,/{{OAUTH_GOOGLE_RESTRICT_DOMAIN}}/d" ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "/name: 'google_oauth2'/,/{{OAUTH_GOOGLE_RESTRICT_DOMAIN}}/d" ${GITLAB_CONFIG}
fi
}
@ -339,11 +344,10 @@ gitlab_configure_oauth_facebook() {
if [[ -n ${OAUTH_FACEBOOK_API_KEY} && -n ${OAUTH_FACEBOOK_APP_SECRET} ]]; then
echo "Configuring gitlab::oauth::facebook..."
OAUTH_ENABLED=${OAUTH_ENABLED:-true}
replace_placeholders \
${GITLAB_INSTALL_DIR}/config/gitlab.yml \
replace_placeholders ${GITLAB_CONFIG} \
OAUTH_FACEBOOK_API_KEY OAUTH_FACEBOOK_APP_SECRET
else
exec_as_git sed -i "/name: 'facebook'/,/{{OAUTH_FACEBOOK_APP_SECRET}}/d" ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "/name: 'facebook'/,/{{OAUTH_FACEBOOK_APP_SECRET}}/d" ${GITLAB_CONFIG}
fi
}
@ -351,11 +355,10 @@ gitlab_configure_oauth_twitter() {
if [[ -n ${OAUTH_TWITTER_API_KEY} && -n ${OAUTH_TWITTER_APP_SECRET} ]]; then
echo "Configuring gitlab::oauth::twitter..."
OAUTH_ENABLED=${OAUTH_ENABLED:-true}
replace_placeholders \
${GITLAB_INSTALL_DIR}/config/gitlab.yml \
replace_placeholders ${GITLAB_CONFIG} \
OAUTH_TWITTER_API_KEY OAUTH_TWITTER_APP_SECRET
else
exec_as_git sed -i "/name: 'twitter'/,/{{OAUTH_TWITTER_APP_SECRET}}/d" ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "/name: 'twitter'/,/{{OAUTH_TWITTER_APP_SECRET}}/d" ${GITLAB_CONFIG}
fi
}
@ -363,12 +366,11 @@ gitlab_configure_oauth_github() {
if [[ -n ${OAUTH_GITHUB_API_KEY} && -n ${OAUTH_GITHUB_APP_SECRET} ]]; then
echo "Configuring gitlab::oauth::github..."
OAUTH_ENABLED=${OAUTH_ENABLED:-true}
replace_placeholders \
${GITLAB_INSTALL_DIR}/config/gitlab.yml \
replace_placeholders ${GITLAB_CONFIG} \
OAUTH_GITHUB_API_KEY OAUTH_GITHUB_APP_SECRET
exec_as_git sed -i 's|{{OAUTH_GITHUB_SCOPE}}|user:email|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
else
exec_as_git sed -i "/name: 'github'/,/{{OAUTH_GITHUB_SCOPE}}/d" ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "/name: 'github'/,/{{OAUTH_GITHUB_SCOPE}}/d" ${GITLAB_CONFIG}
fi
}
@ -376,12 +378,11 @@ gitlab_configure_oauth_gitlab() {
if [[ -n ${OAUTH_GITLAB_API_KEY} && -n ${OAUTH_GITLAB_APP_SECRET} ]]; then
echo "Configuring gitlab::oauth::gitlab..."
OAUTH_ENABLED=${OAUTH_ENABLED:-true}
replace_placeholders \
${GITLAB_INSTALL_DIR}/config/gitlab.yml \
replace_placeholders ${GITLAB_CONFIG} \
OAUTH_GITLAB_API_KEY OAUTH_GITLAB_APP_SECRET
exec_as_git sed -i 's|{{OAUTH_GITLAB_SCOPE}}|api|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
else
exec_as_git sed -i "/name: 'gitlab'/,/{{OAUTH_GITLAB_SCOPE}}/d" ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "/name: 'gitlab'/,/{{OAUTH_GITLAB_SCOPE}}/d" ${GITLAB_CONFIG}
fi
}
@ -389,11 +390,10 @@ gitlab_configure_oauth_bitbucket() {
if [[ -n ${OAUTH_BITBUCKET_API_KEY} && -n ${OAUTH_BITBUCKET_APP_SECRET} ]]; then
echo "Configuring gitlab::oauth::bitbucket..."
OAUTH_ENABLED=${OAUTH_ENABLED:-true}
replace_placeholders \
${GITLAB_INSTALL_DIR}/config/gitlab.yml \
replace_placeholders ${GITLAB_CONFIG} \
OAUTH_BITBUCKET_API_KEY OAUTH_BITBUCKET_APP_SECRET
else
exec_as_git sed -i "/name: 'bitbucket'/,/{{OAUTH_BITBUCKET_APP_SECRET}}/d" ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "/name: 'bitbucket'/,/{{OAUTH_BITBUCKET_APP_SECRET}}/d" ${GITLAB_CONFIG}
fi
}
@ -405,12 +405,11 @@ gitlab_configure_oauth_saml() {
-n ${OAUTH_SAML_NAME_IDENTIFIER_FORMAT} ]]; then
echo "Configuring gitlab::oauth::saml..."
OAUTH_ENABLED=${OAUTH_ENABLED:-true}
replace_placeholders \
${GITLAB_INSTALL_DIR}/config/gitlab.yml \
replace_placeholders ${GITLAB_CONFIG} \
OAUTH_SAML_LABEL OAUTH_SAML_ASSERTION_CONSUMER_SERVICE_URL OAUTH_SAML_IDP_CERT_FINGERPRINT \
OAUTH_SAML_IDP_SSO_TARGET_URL OAUTH_SAML_ISSUER OAUTH_SAML_NAME_IDENTIFIER_FORMAT
else
exec_as_git sed -i "/name: 'saml'/,/{{OAUTH_SAML_NAME_IDENTIFIER_FORMAT}}/d" ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "/name: 'saml'/,/{{OAUTH_SAML_NAME_IDENTIFIER_FORMAT}}/d" ${GITLAB_CONFIG}
fi
}
@ -420,11 +419,10 @@ gitlab_configure_oauth_crowd() {
-n ${OAUTH_CROWD_APP_PASSWORD} ]]; then
echo "Configuring gitlab::oauth::crowd..."
OAUTH_ENABLED=${OAUTH_ENABLED:-true}
replace_placeholders \
${GITLAB_INSTALL_DIR}/config/gitlab.yml \
replace_placeholders ${GITLAB_CONFIG} \
OAUTH_CROWD_SERVER_URL OAUTH_CROWD_APP_NAME OAUTH_CROWD_APP_PASSWORD
else
exec_as_git sed -i "/name: 'crowd'/,/{{OAUTH_CROWD_APP_PASSWORD}}/d" ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "/name: 'crowd'/,/{{OAUTH_CROWD_APP_PASSWORD}}/d" ${GITLAB_CONFIG}
fi
}
@ -441,16 +439,15 @@ gitlab_configure_oauth() {
gitlab_configure_oauth_crowd
OAUTH_ENABLED=${OAUTH_ENABLED:-false}
replace_placeholders \
${GITLAB_INSTALL_DIR}/config/gitlab.yml \
replace_placeholders ${GITLAB_CONFIG} \
OAUTH_ENABLED OAUTH_ALLOW_SSO OAUTH_BLOCK_AUTO_CREATED_USERS OAUTH_AUTO_LINK_LDAP_USER
case ${OAUTH_AUTO_SIGN_IN_WITH_PROVIDER} in
google_oauth2|facebook|twitter|github|gitlab|bitbucket|saml|crowd)
exec_as_git sed -i 's|{{OAUTH_AUTO_SIGN_IN_WITH_PROVIDER}}|'"${OAUTH_AUTO_SIGN_IN_WITH_PROVIDER}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "s|{{OAUTH_AUTO_SIGN_IN_WITH_PROVIDER}}|${OAUTH_AUTO_SIGN_IN_WITH_PROVIDER}|" ${GITLAB_CONFIG}
;;
*)
exec_as_git sed -i '/{{OAUTH_AUTO_SIGN_IN_WITH_PROVIDER}}/d' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "/{{OAUTH_AUTO_SIGN_IN_WITH_PROVIDER}}/d" ${GITLAB_CONFIG}
;;
esac
}
@ -464,18 +461,16 @@ gitlab_configure_secrets() {
return 1
fi
replace_placeholders \
${GITLAB_INSTALL_DIR}/config/secrets.yml \
GITLAB_SECRETS_DB_KEY_BASE
replace_placeholders ${GITLAB_SECRETS_CONFIG} GITLAB_SECRETS_DB_KEY_BASE
}
gitlab_configure_sidekiq() {
echo "Configuring gitlab::sidekiq..."
# configure sidekiq concurrency
sed -i 's|{{SIDEKIQ_CONCURRENCY}}|'"${SIDEKIQ_CONCURRENCY}"'|' /etc/supervisor/conf.d/sidekiq.conf
sed -i "s|{{SIDEKIQ_CONCURRENCY}}|${SIDEKIQ_CONCURRENCY}|" /etc/supervisor/conf.d/sidekiq.conf
# configure sidekiq shutdown timeout
sed -i 's|{{SIDEKIQ_SHUTDOWN_TIMEOUT}}|'"${SIDEKIQ_SHUTDOWN_TIMEOUT}"'|' /etc/supervisor/conf.d/sidekiq.conf
sed -i "s|{{SIDEKIQ_SHUTDOWN_TIMEOUT}}|${SIDEKIQ_SHUTDOWN_TIMEOUT}|" /etc/supervisor/conf.d/sidekiq.conf
# enable SidekiqMemoryKiller
## The MemoryKiller is enabled by gitlab if the `SIDEKIQ_MEMORY_KILLER_MAX_RSS` is
@ -520,63 +515,61 @@ gitlab_configure_backups_aws() {
printf "\nMissing AWS options. Aborting...\n"
return 1
fi
replace_placeholders \
${GITLAB_INSTALL_DIR}/config/gitlab.yml \
replace_placeholders ${GITLAB_CONFIG} \
AWS_BACKUP_REGION AWS_BACKUP_ACCESS_KEY_ID AWS_BACKUP_SECRET_ACCESS_KEY AWS_BACKUP_BUCKET
;;
*)
exec_as_git sed -i '/upload:/,/remote_directory:/d' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "/upload:/,/remote_directory:/d" ${GITLAB_CONFIG}
;;
esac
}
gitlab_configure_backups() {
echo "Configuring gitlab::backups..."
replace_placeholders \
${GITLAB_INSTALL_DIR}/config/gitlab.yml \
GITLAB_BACKUP_DIR GITLAB_BACKUP_EXPIRY GITLAB_BACKUP_ARCHIVE_PERMISSIONS
replace_placeholders ${GITLAB_CONFIG} \
GITLAB_BACKUP_DIR GITLAB_BACKUP_EXPIRY GITLAB_BACKUP_PG_SCHEMA GITLAB_BACKUP_ARCHIVE_PERMISSIONS
gitlab_configure_backups_cron
gitlab_configure_backups_aws
}
gitlab_configure_gravatar() {
exec_as_git sed -i 's|{{GITLAB_GRAVATAR_ENABLED}}|'"${GITLAB_GRAVATAR_ENABLED}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "s|{{GITLAB_GRAVATAR_ENABLED}}|${GITLAB_GRAVATAR_ENABLED}|" ${GITLAB_CONFIG}
if [[ -n ${GITLAB_GRAVATAR_HTTP_URL} ]]; then
echo "Configuring gitlab::gravatar::http..."
GITLAB_GRAVATAR_HTTP_URL=$(echo "${GITLAB_GRAVATAR_HTTP_URL}" | sed 's|[&]|\\&|g')
exec_as_git sed -i 's|{{GITLAB_GRAVATAR_HTTP_URL}}|'"${GITLAB_GRAVATAR_HTTP_URL}"'|g' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
GITLAB_GRAVATAR_HTTP_URL="$(echo "${GITLAB_GRAVATAR_HTTP_URL}" | sed 's|[&]|\\&|g')"
exec_as_git sed -i "s|{{GITLAB_GRAVATAR_HTTP_URL}}|${GITLAB_GRAVATAR_HTTP_URL}|g" ${GITLAB_CONFIG}
else
exec_as_git sed -i '/{{GITLAB_GRAVATAR_HTTP_URL}}/d' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "/{{GITLAB_GRAVATAR_HTTP_URL}}/d" ${GITLAB_CONFIG}
fi
if [[ -n ${GITLAB_GRAVATAR_HTTPS_URL} ]]; then
echo "Configuring gitlab::gravatar::https..."
GITLAB_GRAVATAR_HTTPS_URL=$(echo "${GITLAB_GRAVATAR_HTTPS_URL}" | sed 's|[&]|\\&|g')
exec_as_git sed -i 's|{{GITLAB_GRAVATAR_HTTPS_URL}}|'"${GITLAB_GRAVATAR_HTTPS_URL}"'|g' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
GITLAB_GRAVATAR_HTTPS_URL="$(echo "${GITLAB_GRAVATAR_HTTPS_URL}" | sed 's|[&]|\\&|g')"
exec_as_git sed -i "s|{{GITLAB_GRAVATAR_HTTPS_URL}}|${GITLAB_GRAVATAR_HTTPS_URL}|g" ${GITLAB_CONFIG}
else
exec_as_git sed -i '/{{GITLAB_GRAVATAR_HTTPS_URL}}/d' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "/{{GITLAB_GRAVATAR_HTTPS_URL}}/d" ${GITLAB_CONFIG}
fi
}
gitlab_configure_analytics_google() {
if [[ -n ${GOOGLE_ANALYTICS_ID} ]]; then
echo "Configuring gitlab::analytics:google..."
exec_as_git sed -i 's|{{GOOGLE_ANALYTICS_ID}}|'"${GOOGLE_ANALYTICS_ID}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "s|{{GOOGLE_ANALYTICS_ID}}|${GOOGLE_ANALYTICS_ID}|" ${GITLAB_CONFIG}
else
exec_as_git sed -i '/{{GOOGLE_ANALYTICS_ID}}/d' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "/{{GOOGLE_ANALYTICS_ID}}/d" ${GITLAB_CONFIG}
fi
}
gitlab_configure_analytics_piwik() {
if [[ -n ${PIWIK_URL} && -n ${PIWIK_SITE_ID} ]]; then
echo "Configuring gitlab::analytics:piwik..."
exec_as_git sed -i 's|{{PIWIK_URL}}|'"${PIWIK_URL}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{PIWIK_SITE_ID}}|'"${PIWIK_SITE_ID}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "s|{{PIWIK_URL}}|${PIWIK_URL}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{PIWIK_SITE_ID}}|${PIWIK_SITE_ID}|" ${GITLAB_CONFIG}
else
exec_as_git sed -i '/{{PIWIK_URL}}/d' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i '/{{PIWIK_SITE_ID}}/d' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "/{{PIWIK_URL}}/d" ${GITLAB_CONFIG}
exec_as_git sed -i "/{{PIWIK_SITE_ID}}/d" ${GITLAB_CONFIG}
fi
}
@ -587,59 +580,59 @@ gitlab_configure_analytics() {
gitlab_configure_rack_attack() {
echo "Configuring gitlab::rack_attack..."
exec_as_git sed -i 's|{{RACK_ATTACK_ENABLED}}|'"${RACK_ATTACK_ENABLED}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{RACK_ATTACK_WHITELIST}}|'"${RACK_ATTACK_WHITELIST}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{RACK_ATTACK_MAXRETRY}}|'"${RACK_ATTACK_MAXRETRY}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{RACK_ATTACK_FINDTIME}}|'"${RACK_ATTACK_FINDTIME}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{RACK_ATTACK_BANTIME}}|'"${RACK_ATTACK_BANTIME}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "s|{{RACK_ATTACK_ENABLED}}|${RACK_ATTACK_ENABLED}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{RACK_ATTACK_WHITELIST}}|${RACK_ATTACK_WHITELIST}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{RACK_ATTACK_MAXRETRY}}|${RACK_ATTACK_MAXRETRY}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{RACK_ATTACK_FINDTIME}}|${RACK_ATTACK_FINDTIME}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{RACK_ATTACK_BANTIME}}|${RACK_ATTACK_BANTIME}|" ${GITLAB_CONFIG}
}
gitlab_configure_ci() {
echo "Configuring gitlab::ci..."
exec_as_git sed -i 's|{{GITLAB_NOTIFY_ON_BROKEN_BUILDS}}|'"${GITLAB_NOTIFY_ON_BROKEN_BUILDS}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_NOTIFY_PUSHER}}|'"${GITLAB_NOTIFY_PUSHER}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_BUILDS_DIR}}|'"${GITLAB_BUILDS_DIR}"'|g' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "s|{{GITLAB_NOTIFY_ON_BROKEN_BUILDS}}|${GITLAB_NOTIFY_ON_BROKEN_BUILDS}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_NOTIFY_PUSHER}}|${GITLAB_NOTIFY_PUSHER}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_BUILDS_DIR}}|${GITLAB_BUILDS_DIR}|g" ${GITLAB_CONFIG}
}
gitlab_configure_artifacts() {
echo "Configuring gitlab::artifacts..."
exec_as_git sed -i 's|{{GITLAB_ARTIFACTS_ENABLED}}|'"${GITLAB_ARTIFACTS_ENABLED}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_ARTIFACTS_DIR}}|'"${GITLAB_ARTIFACTS_DIR}"'|g' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "s|{{GITLAB_ARTIFACTS_ENABLED}}|${GITLAB_ARTIFACTS_ENABLED}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_ARTIFACTS_DIR}}|${GITLAB_ARTIFACTS_DIR}|g" ${GITLAB_CONFIG}
}
gitlab_configure_lfs() {
echo "Configuring gitlab::lfs..."
exec_as_git sed -i 's|{{GITLAB_LFS_ENABLED}}|'"${GITLAB_LFS_ENABLED}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_LFS_OBJECTS_DIR}}|'"${GITLAB_LFS_OBJECTS_DIR}"'|g' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "s|{{GITLAB_LFS_ENABLED}}|${GITLAB_LFS_ENABLED}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_LFS_OBJECTS_DIR}}|${GITLAB_LFS_OBJECTS_DIR}|g" ${GITLAB_CONFIG}
}
gitlab_configure_project_features() {
echo "Configuring gitlab::project_features..."
exec_as_git sed -i 's|{{GITLAB_PROJECTS_ISSUES}}|'"${GITLAB_PROJECTS_ISSUES}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_PROJECTS_MERGE_REQUESTS}}|'"${GITLAB_PROJECTS_MERGE_REQUESTS}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_PROJECTS_WIKI}}|'"${GITLAB_PROJECTS_WIKI}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_PROJECTS_SNIPPETS}}|'"${GITLAB_PROJECTS_SNIPPETS}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_PROJECTS_BUILDS}}|'"${GITLAB_PROJECTS_BUILDS}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_WEBHOOK_TIMEOUT}}|'"${GITLAB_WEBHOOK_TIMEOUT}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "s|{{GITLAB_PROJECTS_ISSUES}}|${GITLAB_PROJECTS_ISSUES}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_PROJECTS_MERGE_REQUESTS}}|${GITLAB_PROJECTS_MERGE_REQUESTS}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_PROJECTS_WIKI}}|${GITLAB_PROJECTS_WIKI}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_PROJECTS_SNIPPETS}}|${GITLAB_PROJECTS_SNIPPETS}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_PROJECTS_BUILDS}}|${GITLAB_PROJECTS_BUILDS}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_WEBHOOK_TIMEOUT}}|${GITLAB_WEBHOOK_TIMEOUT}|" ${GITLAB_CONFIG}
}
nginx_configure_gitlab_ssl() {
if [[ ${GITLAB_HTTPS} == true && -f ${SSL_CERTIFICATE_PATH} && -f ${SSL_KEY_PATH} && -f ${SSL_DHPARAM_PATH} ]]; then
echo "Configuring nginx::gitlab::ssl..."
sed -i 's|{{SSL_CERTIFICATE_PATH}}|'"${SSL_CERTIFICATE_PATH}"'|' /etc/nginx/sites-enabled/gitlab
sed -i 's|{{SSL_KEY_PATH}}|'"${SSL_KEY_PATH}"'|' /etc/nginx/sites-enabled/gitlab
sed -i 's|{{SSL_DHPARAM_PATH}}|'"${SSL_DHPARAM_PATH}"'|' /etc/nginx/sites-enabled/gitlab
sed -i 's|{{SSL_VERIFY_CLIENT}}|'"${SSL_VERIFY_CLIENT}"'|' /etc/nginx/sites-enabled/gitlab
sed -i "s|{{SSL_CERTIFICATE_PATH}}|${SSL_CERTIFICATE_PATH}|" ${GITLAB_NGINX_CONFIG}
sed -i "s|{{SSL_KEY_PATH}}|${SSL_KEY_PATH}|" ${GITLAB_NGINX_CONFIG}
sed -i "s|{{SSL_DHPARAM_PATH}}|${SSL_DHPARAM_PATH}|" ${GITLAB_NGINX_CONFIG}
sed -i "s|{{SSL_VERIFY_CLIENT}}|${SSL_VERIFY_CLIENT}|" ${GITLAB_NGINX_CONFIG}
if [[ -f ${CA_CERTIFICATES_PATH} ]]; then
sed -i 's|{{CA_CERTIFICATES_PATH}}|'"${CA_CERTIFICATES_PATH}"'|' /etc/nginx/sites-enabled/gitlab
sed -i "s|{{CA_CERTIFICATES_PATH}}|${CA_CERTIFICATES_PATH}|" ${GITLAB_NGINX_CONFIG}
else
sed -i '/{{CA_CERTIFICATES_PATH}}/d' /etc/nginx/sites-enabled/gitlab
sed -i "/{{CA_CERTIFICATES_PATH}}/d" ${GITLAB_NGINX_CONFIG}
fi
if [[ ${GITLAB_HTTPS_HSTS_ENABLED} == true ]]; then
sed -i 's|{{GITLAB_HTTPS_HSTS_MAXAGE}}|'"${GITLAB_HTTPS_HSTS_MAXAGE}"'|' /etc/nginx/sites-enabled/gitlab
sed -i "s|{{GITLAB_HTTPS_HSTS_MAXAGE}}|${GITLAB_HTTPS_HSTS_MAXAGE}|" ${GITLAB_NGINX_CONFIG}
else
sed -i '/{{GITLAB_HTTPS_HSTS_MAXAGE}}/d' /etc/nginx/sites-enabled/gitlab
sed -i "/{{GITLAB_HTTPS_HSTS_MAXAGE}}/d" ${GITLAB_NGINX_CONFIG}
fi
fi
}
@ -647,34 +640,33 @@ nginx_configure_gitlab_ssl() {
nginx_configure_gitlab_relative_url() {
if [[ -n ${GITLAB_RELATIVE_URL_ROOT} ]]; then
echo "Configuring nginx::gitlab::relative_url..."
sed -i 's|{{GITLAB_RELATIVE_URL_ROOT}}|'"${GITLAB_RELATIVE_URL_ROOT}"'|g' /etc/nginx/sites-enabled/gitlab
sed -i 's|{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}|'"${GITLAB_RELATIVE_URL_ROOT}/"'|g' /etc/nginx/sites-enabled/gitlab
sed -i 's|# alias '"${GITLAB_INSTALL_DIR}"'/public|alias '"${GITLAB_INSTALL_DIR}"'/public|' /etc/nginx/sites-enabled/gitlab
sed -i "s|{{GITLAB_RELATIVE_URL_ROOT}}|${GITLAB_RELATIVE_URL_ROOT}|g" ${GITLAB_NGINX_CONFIG}
sed -i "s|{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}|${GITLAB_RELATIVE_URL_ROOT}/|g" ${GITLAB_NGINX_CONFIG}
else
sed -i 's|{{GITLAB_RELATIVE_URL_ROOT}}|/|' /etc/nginx/sites-enabled/gitlab
sed -i 's|{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}|/|g' /etc/nginx/sites-enabled/gitlab
sed -i "s|{{GITLAB_RELATIVE_URL_ROOT}}|/|" ${GITLAB_NGINX_CONFIG}
sed -i "s|{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}|/|g" ${GITLAB_NGINX_CONFIG}
fi
}
nginx_configure_gitlab_ipv6() {
if [[ ! -f /proc/net/if_inet6 ]]; then
# disable ipv6 support
sed -i '/listen \[::\]:80/d' /etc/nginx/sites-enabled/gitlab
sed -i '/listen \[::\]:443/d' /etc/nginx/sites-enabled/gitlab
sed -i "/listen \[::\]:80/d" ${GITLAB_NGINX_CONFIG}
sed -i "/listen \[::\]:443/d" ${GITLAB_NGINX_CONFIG}
fi
}
nginx_configure_gitlab() {
echo "Configuring nginx::gitlab..."
sed -i 's|{{GITLAB_INSTALL_DIR}}|'"${GITLAB_INSTALL_DIR}"'|g' /etc/nginx/sites-enabled/gitlab
sed -i 's|{{GITLAB_LOG_DIR}}|'"${GITLAB_LOG_DIR}"'|g' /etc/nginx/sites-enabled/gitlab
sed -i 's|{{YOUR_SERVER_FQDN}}|'"${GITLAB_HOST}"'|' /etc/nginx/sites-enabled/gitlab
sed -i 's|{{GITLAB_PORT}}|'"${GITLAB_PORT}"'|' /etc/nginx/sites-enabled/gitlab
sed -i "s|{{GITLAB_INSTALL_DIR}}|${GITLAB_INSTALL_DIR}|g" ${GITLAB_NGINX_CONFIG}
sed -i "s|{{GITLAB_LOG_DIR}}|${GITLAB_LOG_DIR}|g" ${GITLAB_NGINX_CONFIG}
sed -i "s|{{YOUR_SERVER_FQDN}}|${GITLAB_HOST}|" ${GITLAB_NGINX_CONFIG}
sed -i "s|{{GITLAB_PORT}}|${GITLAB_PORT}|" ${GITLAB_NGINX_CONFIG}
sed -i 's|{{NGINX_PROXY_BUFFERING}}|'"${NGINX_PROXY_BUFFERING}"'|g' /etc/nginx/sites-enabled/gitlab
sed -i 's|{{NGINX_ACCEL_BUFFERING}}|'"${NGINX_ACCEL_BUFFERING}"'|g' /etc/nginx/sites-enabled/gitlab
sed -i 's|{{NGINX_MAX_UPLOAD_SIZE}}|'"${NGINX_MAX_UPLOAD_SIZE}"'|' /etc/nginx/sites-enabled/gitlab
sed -i 's|{{NGINX_X_FORWARDED_PROTO}}|'"${NGINX_X_FORWARDED_PROTO}"'|g' /etc/nginx/sites-enabled/gitlab
sed -i "s|{{NGINX_PROXY_BUFFERING}}|${NGINX_PROXY_BUFFERING}|g" ${GITLAB_NGINX_CONFIG}
sed -i "s|{{NGINX_ACCEL_BUFFERING}}|${NGINX_ACCEL_BUFFERING}|g" ${GITLAB_NGINX_CONFIG}
sed -i "s|{{NGINX_MAX_UPLOAD_SIZE}}|${NGINX_MAX_UPLOAD_SIZE}|" ${GITLAB_NGINX_CONFIG}
sed -i "s|{{NGINX_X_FORWARDED_PROTO}}|${NGINX_X_FORWARDED_PROTO}|g" ${GITLAB_NGINX_CONFIG}
nginx_configure_gitlab_ssl
nginx_configure_gitlab_relative_url
@ -684,12 +676,12 @@ nginx_configure_gitlab() {
nginx_configure_gitlab_ci() {
if [[ -n $GITLAB_CI_HOST ]]; then
echo "Configuring nginx::gitlab_ci..."
sed -i 's|{{GITLAB_LOG_DIR}}|'"${GITLAB_LOG_DIR}"'|g' /etc/nginx/sites-enabled/gitlab_ci
sed -i 's|{{GITLAB_HOST}}|'"${GITLAB_HOST}"'|g' /etc/nginx/sites-enabled/gitlab_ci
sed -i 's|{{GITLAB_CI_HOST}}|'"${GITLAB_CI_HOST}"'|' /etc/nginx/sites-enabled/gitlab_ci
sed -i "s|{{GITLAB_LOG_DIR}}|${GITLAB_LOG_DIR}|g" ${GITLAB_CI_NGINX_CONFIG}
sed -i "s|{{GITLAB_HOST}}|${GITLAB_HOST}|g" ${GITLAB_CI_NGINX_CONFIG}
sed -i "s|{{GITLAB_CI_HOST}}|${GITLAB_CI_HOST}|" ${GITLAB_CI_NGINX_CONFIG}
DNS_RESOLVERS=$(cat /etc/resolv.conf | grep '^\s*nameserver' | awk '{print $2}' ORS=' ')
sed -i 's|{{DNS_RESOLVERS}}|'"${DNS_RESOLVERS}"'|' /etc/nginx/sites-enabled/gitlab_ci
sed -i "s|{{DNS_RESOLVERS}}|${DNS_RESOLVERS}|" ${GITLAB_CI_NGINX_CONFIG}
fi
}
@ -854,7 +846,7 @@ generate_ssh_key() {
}
generate_ssh_host_keys() {
sed -i 's,HostKey /etc/ssh/,HostKey '"${GITLAB_DATA_DIR}"'/ssh/,g' /etc/ssh/sshd_config
sed -i "s|HostKey /etc/ssh/|HostKey ${GITLAB_DATA_DIR}/ssh/|g" /etc/ssh/sshd_config
if [[ ! -e ${GITLAB_DATA_DIR}/ssh/ssh_host_rsa_key ]]; then
echo -n "Generating OpenSSH host keys... "
generate_ssh_key rsa1 ${GITLAB_DATA_DIR}/ssh/ssh_host_key
@ -882,59 +874,59 @@ initialize_system() {
install_configuration_templates() {
echo "Installing configuration templates..."
install_template ${GITLAB_USER} gitlabhq/gitlab.yml ${GITLAB_INSTALL_DIR}/config/gitlab.yml
install_template ${GITLAB_USER} gitlabhq/database.yml ${GITLAB_INSTALL_DIR}/config/database.yml
install_template ${GITLAB_USER} gitlabhq/unicorn.rb ${GITLAB_INSTALL_DIR}/config/unicorn.rb
install_template ${GITLAB_USER} gitlabhq/resque.yml ${GITLAB_INSTALL_DIR}/config/resque.yml
install_template ${GITLAB_USER} gitlabhq/secrets.yml ${GITLAB_INSTALL_DIR}/config/secrets.yml
install_template ${GITLAB_USER} gitlab-shell/config.yml ${GITLAB_SHELL_INSTALL_DIR}/config.yml
install_template ${GITLAB_USER} gitlabhq/gitlab.yml ${GITLAB_CONFIG}
install_template ${GITLAB_USER} gitlabhq/database.yml ${GITLAB_DATABASE_CONFIG}
install_template ${GITLAB_USER} gitlabhq/unicorn.rb ${GITLAB_UNICORN_CONFIG}
install_template ${GITLAB_USER} gitlabhq/resque.yml ${GITLAB_RESQUE_CONFIG}
install_template ${GITLAB_USER} gitlabhq/secrets.yml ${GITLAB_SECRETS_CONFIG}
install_template ${GITLAB_USER} gitlab-shell/config.yml ${GITLAB_SHELL_CONFIG}
if [[ ${SMTP_ENABLED} == true ]]; then
install_template ${GITLAB_USER} gitlabhq/smtp_settings.rb ${GITLAB_INSTALL_DIR}/config/initializers/smtp_settings.rb
install_template ${GITLAB_USER} gitlabhq/smtp_settings.rb ${GITLAB_SMTP_CONFIG}
fi
# custom user specified robots.txt
if [[ -f ${GITLAB_ROBOTS_PATH} ]]; then
exec_as_git cp ${GITLAB_ROBOTS_PATH} ${GITLAB_INSTALL_DIR}/public/robots.txt
exec_as_git cp ${GITLAB_ROBOTS_PATH} ${GITLAB_ROBOTS_CONFIG}
fi
## /etc/nginx/sites-enabled/gitlab
## ${GITLAB_NGINX_CONFIG}
if [[ ${GITLAB_HTTPS} == true ]]; then
if [[ -f ${SSL_CERTIFICATE_PATH} && -f ${SSL_KEY_PATH} && -f ${SSL_DHPARAM_PATH} ]]; then
install_template root nginx/gitlab-ssl /etc/nginx/sites-enabled/gitlab
install_template root nginx/gitlab-ssl ${GITLAB_NGINX_CONFIG}
else
echo "SSL keys and certificates were not found."
echo "Assuming that the container is running behind a HTTPS enabled load balancer."
install_template root nginx/gitlab /etc/nginx/sites-enabled/gitlab
install_template root nginx/gitlab ${GITLAB_NGINX_CONFIG}
fi
else
install_template root nginx/gitlab /etc/nginx/sites-enabled/gitlab
install_template root nginx/gitlab ${GITLAB_NGINX_CONFIG}
fi
if [[ -n $GITLAB_CI_HOST ]]; then
install_template root nginx/gitlab_ci /etc/nginx/sites-enabled/gitlab_ci
install_template root nginx/gitlab_ci ${GITLAB_CI_NGINX_CONFIG}
fi
}
configure_gitlab() {
echo "Configuring gitlab..."
exec_as_git sed -i 's|{{GITLAB_INSTALL_DIR}}|'"${GITLAB_INSTALL_DIR}"'|g' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_SHELL_INSTALL_DIR}}|'"${GITLAB_SHELL_INSTALL_DIR}"'|g' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_DATA_DIR}}|'"${GITLAB_DATA_DIR}"'|g' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_REPOS_DIR}}|'"${GITLAB_REPOS_DIR}"'|g' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_DOWNLOADS_DIR}}|'"${GITLAB_DOWNLOADS_DIR}"'|g' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_SHARED_DIR}}|'"${GITLAB_SHARED_DIR}"'|g' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "s|{{GITLAB_INSTALL_DIR}}|${GITLAB_INSTALL_DIR}|g" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_SHELL_INSTALL_DIR}}|${GITLAB_SHELL_INSTALL_DIR}|g" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_DATA_DIR}}|${GITLAB_DATA_DIR}|g" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_REPOS_DIR}}|${GITLAB_REPOS_DIR}|g" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_DOWNLOADS_DIR}}|${GITLAB_DOWNLOADS_DIR}|g" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_SHARED_DIR}}|${GITLAB_SHARED_DIR}|g" ${GITLAB_CONFIG}
exec_as_git sed -i 's|{{GITLAB_HOST}}|'"${GITLAB_HOST}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_PORT}}|'"${GITLAB_PORT}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_RELATIVE_URL_ROOT}}|'"${GITLAB_RELATIVE_URL_ROOT}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_HTTPS}}|'"${GITLAB_HTTPS}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_MAX_SIZE}}|'"${GITLAB_MAX_SIZE}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_SSH_HOST}}|'"${GITLAB_SSH_HOST}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_SSH_PORT}}|'"${GITLAB_SSH_PORT}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_USERNAME_CHANGE}}|'"${GITLAB_USERNAME_CHANGE}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_CREATE_GROUP}}|'"${GITLAB_CREATE_GROUP}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i 's|{{GITLAB_TIMEOUT}}|'"${GITLAB_TIMEOUT}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml
exec_as_git sed -i "s|{{GITLAB_HOST}}|${GITLAB_HOST}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_PORT}}|${GITLAB_PORT}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_RELATIVE_URL_ROOT}}|${GITLAB_RELATIVE_URL_ROOT}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_HTTPS}}|${GITLAB_HTTPS}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_MAX_SIZE}}|${GITLAB_MAX_SIZE}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_SSH_HOST}}|${GITLAB_SSH_HOST}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_SSH_PORT}}|${GITLAB_SSH_PORT}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_USERNAME_CHANGE}}|${GITLAB_USERNAME_CHANGE}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_CREATE_GROUP}}|${GITLAB_CREATE_GROUP}|" ${GITLAB_CONFIG}
exec_as_git sed -i "s|{{GITLAB_TIMEOUT}}|${GITLAB_TIMEOUT}|" ${GITLAB_CONFIG}
gitlab_configure_database
gitlab_configure_redis
@ -958,22 +950,22 @@ configure_gitlab() {
configure_gitlab_shell() {
echo "Configuring gitlab-shell..."
exec_as_git sed -i 's|{{GITLAB_RELATIVE_URL_ROOT}}|'"${GITLAB_RELATIVE_URL_ROOT}"'|' ${GITLAB_SHELL_INSTALL_DIR}/config.yml
exec_as_git sed -i 's|{{GITLAB_HOME}}|'"${GITLAB_HOME}"'|g' ${GITLAB_SHELL_INSTALL_DIR}/config.yml
exec_as_git sed -i 's|{{GITLAB_LOG_DIR}}|'"${GITLAB_LOG_DIR}"'|g' ${GITLAB_SHELL_INSTALL_DIR}/config.yml
exec_as_git sed -i 's|{{GITLAB_DATA_DIR}}|'"${GITLAB_DATA_DIR}"'|g' ${GITLAB_SHELL_INSTALL_DIR}/config.yml
exec_as_git sed -i 's|{{GITLAB_BACKUP_DIR}}|'"${GITLAB_BACKUP_DIR}"'|g' ${GITLAB_SHELL_INSTALL_DIR}/config.yml
exec_as_git sed -i 's|{{GITLAB_REPOS_DIR}}|'"${GITLAB_REPOS_DIR}"'|g' ${GITLAB_SHELL_INSTALL_DIR}/config.yml
exec_as_git sed -i 's|{{GITLAB_SHELL_INSTALL_DIR}}|'"${GITLAB_SHELL_INSTALL_DIR}"'|g' ${GITLAB_SHELL_INSTALL_DIR}/config.yml
exec_as_git sed -i 's|{{SSL_SELF_SIGNED}}|'"${SSL_SELF_SIGNED}"'|' ${GITLAB_SHELL_INSTALL_DIR}/config.yml
exec_as_git sed -i "s|{{GITLAB_RELATIVE_URL_ROOT}}|${GITLAB_RELATIVE_URL_ROOT}|" ${GITLAB_SHELL_CONFIG}
exec_as_git sed -i "s|{{GITLAB_HOME}}|${GITLAB_HOME}|g" ${GITLAB_SHELL_CONFIG}
exec_as_git sed -i "s|{{GITLAB_LOG_DIR}}|${GITLAB_LOG_DIR}|g" ${GITLAB_SHELL_CONFIG}
exec_as_git sed -i "s|{{GITLAB_DATA_DIR}}|${GITLAB_DATA_DIR}|g" ${GITLAB_SHELL_CONFIG}
exec_as_git sed -i "s|{{GITLAB_BACKUP_DIR}}|${GITLAB_BACKUP_DIR}|g" ${GITLAB_SHELL_CONFIG}
exec_as_git sed -i "s|{{GITLAB_REPOS_DIR}}|${GITLAB_REPOS_DIR}|g" ${GITLAB_SHELL_CONFIG}
exec_as_git sed -i "s|{{GITLAB_SHELL_INSTALL_DIR}}|${GITLAB_SHELL_INSTALL_DIR}|g" ${GITLAB_SHELL_CONFIG}
exec_as_git sed -i "s|{{SSL_SELF_SIGNED}}|${SSL_SELF_SIGNED}|" ${GITLAB_SHELL_CONFIG}
exec_as_git sed -i 's|{{REDIS_HOST}}|'"${REDIS_HOST}"'|' ${GITLAB_SHELL_INSTALL_DIR}/config.yml
exec_as_git sed -i 's|{{REDIS_PORT}}|'"${REDIS_PORT}"'|' ${GITLAB_SHELL_INSTALL_DIR}/config.yml
exec_as_git sed -i "s|{{REDIS_HOST}}|${REDIS_HOST}|" ${GITLAB_SHELL_CONFIG}
exec_as_git sed -i "s|{{REDIS_PORT}}|${REDIS_PORT}|" ${GITLAB_SHELL_CONFIG}
}
configure_nginx() {
echo "Configuring nginx..."
sed -i 's|worker_processes .*|worker_processes '"${NGINX_WORKERS}"';|' /etc/nginx/nginx.conf
sed -i "s|worker_processes .*|worker_processes ${NGINX_WORKERS};|" /etc/nginx/nginx.conf
nginx_configure_gitlab
nginx_configure_gitlab_ci
}

View File

@ -1,6 +1,6 @@
postgresql:
restart: always
image: sameersbn/postgresql:9.4-9
image: sameersbn/postgresql:9.4-10
environment:
- DB_USER=gitlab
- DB_PASS=password
@ -9,7 +9,7 @@ postgresql:
- /srv/docker/gitlab/postgresql:/var/lib/postgresql
gitlab:
restart: always
image: sameersbn/gitlab:8.2.2
image: sameersbn/gitlab:8.2.3
links:
- redis:redisio
- postgresql:postgresql

View File

@ -7,7 +7,7 @@ metadata:
spec:
containers:
- name: gitlab
image: sameersbn/gitlab:8.2.2
image: sameersbn/gitlab:8.2.3
env:
- name: TZ
value: Asia/Kolkata

View File

@ -7,7 +7,7 @@ metadata:
spec:
containers:
- name: postgresql
image: sameersbn/postgresql:9.4-9
image: sameersbn/postgresql:9.4-10
env:
- name: DB_USER
value: gitlab