Add gitlab (#1683)

* Add gitlab
This commit is contained in:
ahkui 2018-07-18 21:20:43 +08:00 committed by Shao Yu-Lung (Allen)
parent 0f65c60a89
commit d8b2b8c233
7 changed files with 118 additions and 2 deletions

View File

@ -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> <br>
<a name="Use-Adminer"></a> <a name="Use-Adminer"></a>
## Use Adminer ## Use Adminer

View File

@ -97,7 +97,7 @@ Beanstalkd - RabbitMQ - PHP Worker
- **Queueing Management:** - **Queueing Management:**
Beanstalkd Console - RabbitMQ Console Beanstalkd Console - RabbitMQ Console
- **Random Tools:** - **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. 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. 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.

View File

@ -720,6 +720,50 @@ services:
- "dockerhost:${DOCKER_HOST_IP}" - "dockerhost:${DOCKER_HOST_IP}"
ports: ports:
- 9010:9000 - 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 #########################################
jupyterhub: jupyterhub:

View File

@ -361,6 +361,14 @@ SOLR_VERSION=5.5
SOLR_PORT=8983 SOLR_PORT=8983
SOLR_DATAIMPORTHANDLER_MYSQL=false 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 ###############################################
JUPYTERHUB_POSTGRES_HOST=postgres JUPYTERHUB_POSTGRES_HOST=postgres
JUPYTERHUB_POSTGRES_USER=laradock_jupyterhub JUPYTERHUB_POSTGRES_USER=laradock_jupyterhub

3
gitlab/Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM gitlab/gitlab-ce:latest
LABEL maintainer="ahkui <ahkui@outlook.com>"

View File

@ -1,2 +1,3 @@
*.sh *.sh
!init_gitlab_db.sh
!init_jupyterhub_db.sh !init_jupyterhub_db.sh

View File

@ -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