Skip to content

Commit

Permalink
Add gitlab (laradock#1683)
Browse files Browse the repository at this point in the history
* Add gitlab
  • Loading branch information
ahkui authored and bestlong committed Jul 18, 2018
1 parent 0f65c60 commit d8b2b8c
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 2 deletions.
19 changes: 19 additions & 0 deletions DOCUMENTATION/content/documentation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,25 @@ docker-compose up -d mariadb phpmyadmin



<br>
<a name="Use-Gitlab"></a>
## Use Gitlab

1 - Run the Gitlab Container (`gitlab`) with the `docker-compose up` command. Example:

```bash
docker-compose up -d gitlab
```

2 - Open your browser and visit the localhost on port **8989**: `http://localhost:8989`
<br>
*Note: You may change GITLAB_DOMAIN_NAME to your own domain name like `http://gitlab.example.com` default is `http://localhost`*






<br>
<a name="Use-Adminer"></a>
## Use Adminer
Expand Down
2 changes: 1 addition & 1 deletion DOCUMENTATION/content/introduction/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Beanstalkd - RabbitMQ - PHP Worker
- **Queueing Management:**
Beanstalkd Console - RabbitMQ Console
- **Random Tools:**
HAProxy - Certbot - Blackfire - Selenium - Jenkins - ElasticSearch - Kibana - Grafana - Mailhog - MailDev - Minio - Varnish - Swoole - NetData - Portainer - Laravel Echo...
HAProxy - Certbot - Blackfire - Selenium - Jenkins - ElasticSearch - Kibana - Grafana - Gitlab - Mailhog - MailDev - Minio - Varnish - Swoole - NetData - Portainer - Laravel Echo...

Laradock introduces the **Workspace** Image, as a development environment.
It contains a rich set of helpful tools, all pre-configured to work and integrate with almost any combination of Containers and tools you may choose.
Expand Down
44 changes: 44 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,50 @@ services:
- "dockerhost:${DOCKER_HOST_IP}"
ports:
- 9010:9000
networks:
- backend

### Gitlab ################################################
gitlab:
build:
context: ./gitlab
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url '${GITLAB_DOMAIN_NAME}'
redis['enable'] = false
nginx['listen_https'] = false
nginx['listen_port'] = 80
postgresql['enable'] = false
gitlab_rails['trusted_proxies'] = ['caddy','nginx','apache2']
gitlab_rails['redis_host'] = 'redis'
gitlab_rails['redis_database'] = 8
gitlab_rails['db_host'] = 'postgres'
gitlab_rails['db_username'] = 'laradock_gitlab'
gitlab_rails['db_password'] = 'laradock_gitlab'
gitlab_rails['db_database'] = 'laradock_gitlab'
gitlab_rails['initial_root_password'] = '${GITLAB_ROOT_PASSWORD}'
gitlab_rails['gitlab_shell_ssh_port'] = ${GITLAB_HOST_SSH_PORT}
volumes:
- ${DATA_PATH_HOST}/gitlab/config:/etc/gitlab
- ${DATA_PATH_HOST}/gitlab/data:/var/opt/gitlab
- ${GITLAB_HOST_LOG_PATH}:/var/log/gitlab
ports:
- "${GITLAB_HOST_HTTP_PORT}:80"
- "${GITLAB_HOST_HTTPS_PORT}:443"
- "${GITLAB_HOST_SSH_PORT}:22"
networks:
- backend
depends_on:
- redis
- postgres
gitlab-runner:
image: gitlab/gitlab-runner:latest
environment:
- CI_SERVER_URL=${GITLAB_DOMAIN_NAME}
volumes:
- ${DATA_PATH_HOST}/gitlab/runner:/etc/gitlab-runner
- /var/run/docker.sock:/var/run/docker.sock:rw
restart: always

### JupyterHub #########################################
jupyterhub:
Expand Down
8 changes: 8 additions & 0 deletions env-example
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,14 @@ SOLR_VERSION=5.5
SOLR_PORT=8983
SOLR_DATAIMPORTHANDLER_MYSQL=false

### GITLAB ###############################################
GITLAB_HOST_HTTP_PORT=8989
GITLAB_HOST_HTTPS_PORT=9898
GITLAB_HOST_SSH_PORT=2289
GITLAB_DOMAIN_NAME=http://localhost
GITLAB_ROOT_PASSWORD=laradock
GITLAB_HOST_LOG_PATH=./logs/gitlab

### JUPYTERHUB ###############################################
JUPYTERHUB_POSTGRES_HOST=postgres
JUPYTERHUB_POSTGRES_USER=laradock_jupyterhub
Expand Down
3 changes: 3 additions & 0 deletions gitlab/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM gitlab/gitlab-ce:latest

LABEL maintainer="ahkui <[email protected]>"
3 changes: 2 additions & 1 deletion postgres/docker-entrypoint-initdb.d/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.sh
!init_jupyterhub_db.sh
!init_gitlab_db.sh
!init_jupyterhub_db.sh
41 changes: 41 additions & 0 deletions postgres/docker-entrypoint-initdb.d/init_gitlab_db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash
#
# Copy createdb.sh.example to createdb.sh
# then uncomment then set database name and username to create you need databases
#
# example: .env POSTGRES_USER=appuser and need db name is myshop_db
#
# psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
# CREATE USER myuser WITH PASSWORD 'mypassword';
# CREATE DATABASE myshop_db;
# GRANT ALL PRIVILEGES ON DATABASE myshop_db TO myuser;
# EOSQL
#
# this sh script will auto run when the postgres container starts and the $DATA_PATH_HOST/postgres not found.
#
#
# psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
# CREATE USER db1 WITH PASSWORD 'db1';
# CREATE DATABASE db1;
# GRANT ALL PRIVILEGES ON DATABASE db1 TO db1;
# EOSQL
#
# psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
# CREATE USER db2 WITH PASSWORD 'db2';
# CREATE DATABASE db2;
# GRANT ALL PRIVILEGES ON DATABASE db2 TO db2;
# EOSQL
#
# psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
# CREATE USER db3 WITH PASSWORD 'db3';
# CREATE DATABASE db3;
# GRANT ALL PRIVILEGES ON DATABASE db3 TO db3;
# EOSQL
#
### default database and user for gitlab ##############################################
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER laradock_gitlab WITH PASSWORD 'laradock_gitlab';
CREATE DATABASE laradock_gitlab;
GRANT ALL PRIVILEGES ON DATABASE laradock_gitlab TO laradock_gitlab;
ALTER ROLE laradock_gitlab CREATEROLE SUPERUSER;
EOSQL

0 comments on commit d8b2b8c

Please sign in to comment.