Skip to content

Commit b97cd22

Browse files
committed
Adding microsetup, just Gitlab and Gitlabrunner (and nginx)
1 parent 058456d commit b97cd22

File tree

4 files changed

+170
-1
lines changed

4 files changed

+170
-1
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ If your change the ports in the docker-compose.yml change them also in nginx-rev
4848

4949
Bring up your own DevOp Playground ... just do a
5050

51+
### micro setup (GitLab,GitLab-runner) takes 4GiB
52+
```
53+
git clone https://github.com/Springjunky/docker-local-build-environment.git
54+
cd docker-local-build-environment
55+
sudo ./setupEnvironment.sh
56+
docker-compose up -f docker-compose-micro-ci.yml up --build
57+
docker-compose logs
58+
```
59+
starts 3 container
60+
5161
### minimal setup (GitLab,GitLab-runner,Jenkins,Nexus,Postgres) takes 6GiB
5262
```
5363
git clone https://github.com/Springjunky/docker-local-build-environment.git
@@ -85,7 +95,7 @@ starts 8 container
8595
8696
docker-compose logs
8797
```
88-
start 10 container
98+
starts 10 container
8999

90100
### The first startup takes a long time (especially gitlab), so be patient
91101
open your favorite browser (_not_ at localhost, use the $(hostname)/jenkins )

docker-compose-micro-ci.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#####################################
2+
# Don't touch this file is generated
3+
# expecilly for: ${DC_HOSTNAME}
4+
###################################
5+
#
6+
# Consider to Backup ${DC_BASE_DATA_DIR}
7+
#
8+
version: "3"
9+
10+
networks:
11+
devstacknetwork:
12+
driver: bridge
13+
14+
services:
15+
# ------------------------------------------------------------------------------
16+
ngnix:
17+
container_name: nginx-reverse
18+
build: nginx-reverse
19+
ports:
20+
- 80:80 # http://
21+
- 2222:2222 # ssh port of gitlab (ssh://git@myHOST:2222/scott/foo.git)
22+
- 5555:5555 # Gitlab Docker Registry do NOT use 5000, this is an internal PORT of the gitlab-ce Image
23+
#command: ["nginx-debug", "-g", "daemon off;"] # Start nginx in debug to see whats going on
24+
depends_on: # start proxy after all the others
25+
- gitlab
26+
volumes:
27+
# Overwrites the Dockerfile Copys (ugly but works)
28+
- ./nginx-reverse/reverse-proxy-micro.conf:/etc/nginx/conf.d/reverse-proxy.conf
29+
- ./nginx-reverse/nginx-micro.conf:/etc/nginx/nginx.conf
30+
networks:
31+
- devstacknetwork
32+
33+
34+
# ------------------------------------------------------------------------------
35+
gitlab:
36+
image: 'gitlab/gitlab-ce:latest'
37+
container_name: gitlab-ce
38+
extra_hosts:
39+
- ${DC_HOSTNAME}:${DC_HOSTIP}
40+
networks:
41+
- devstacknetwork
42+
environment:
43+
GITLAB_OMNIBUS_CONFIG: |
44+
external_url 'http://${DC_HOSTNAME}/gitlab'
45+
gitlab_rails['initial_root_password'] = "gitlab4me"
46+
gitlab_rails['initial_shared_runners_registration_token'] = "s3cretToken4Runner"
47+
gitlab_rails['gitlab_shell_ssh_port'] = 2222
48+
# docker-registry config
49+
registry_external_url 'https://${DC_HOSTNAME}:5555'
50+
registry_nginx['listen_port'] = 5555
51+
registry_nginx['listen_https'] = true
52+
# SSL config just for the docker-registry need
53+
nginx['ssl_certificate'] = "/etc/gitlab/ssl/${DC_HOSTNAME}.crt"
54+
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/${DC_HOSTNAME}.key"
55+
registry_nginx['proxy_set_headers'] = {
56+
"X-Forwarded-Proto" => "https",
57+
"X-Forwarded-Ssl" => "on"
58+
}
59+
volumes:
60+
- ${DC_BASE_DATA_DIR}/gitlab/config:/etc/gitlab
61+
- ${DC_BASE_DATA_DIR}/gitlab/logs:/var/log/gitlab
62+
- ${DC_BASE_DATA_DIR}/gitlab/data:/var/opt/gitlab
63+
# ------------------------------------------------------------------------------
64+
gitlabrunner:
65+
build: gitlabrunner
66+
container_name: gitlabrunner
67+
network_mode: "host"
68+
extra_hosts:
69+
- ${DC_HOSTNAME}:${DC_HOSTIP}
70+
environment:
71+
- GITLAB_URL=http://${DC_HOSTNAME}/gitlab
72+
- HOSTNAME=${DC_HOSTNAME}
73+
- HOSTIP=${DC_HOSTIP}
74+
- REGISTER_TOKEN=s3cretToken4Runner
75+
- REGISTER_TRYS=60 # every 10 seconds a try to register the runner..gitlab takes a long time to startup
76+
volumes:
77+
- ${DC_BASE_DATA_DIR}/gitlab-runner/config:/etc/gitlab-runner
78+
- /var/run/docker.sock:/var/run/docker.sock
79+

nginx-reverse/nginx-micro.conf

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Docker doco says turn daemon off - but it produces errors if you do;the
2+
# NGINX Docker container now wires this in for you
3+
# daemon off;
4+
user nginx;
5+
worker_processes 1;
6+
7+
error_log /var/log/nginx/error.log debug;
8+
pid /var/run/nginx.pid;
9+
10+
events {
11+
worker_connections 1024;
12+
}
13+
14+
http {
15+
include /etc/nginx/mime.types;
16+
17+
# Need to set proxy headers so that the Jenkins Tomcat instance works properly
18+
proxy_set_header X-Real-IP $remote_addr;
19+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
20+
21+
proxy_headers_hash_max_size 1024;
22+
proxy_headers_hash_bucket_size 512;
23+
24+
default_type application/octet-stream;
25+
26+
log_format main '$remote_addr - $remote_user [$time_local] "["servername:"$server_name"uri:"$request_uri] $request" '
27+
'$status $body_bytes_sent "$http_referer" '
28+
'"$http_user_agent" "$http_x_forwarded_for"';
29+
30+
access_log /var/log/nginx/access.log main;
31+
32+
sendfile on;
33+
#tcp_nopush on;
34+
35+
keepalive_timeout 65;
36+
37+
38+
# Cope with large file uploads; needed to publish plugins, amongst other things.
39+
client_max_body_size 300m;
40+
client_body_buffer_size 128k;
41+
42+
# Turn on GZip compression
43+
gzip on;
44+
gzip_http_version 1.0;
45+
gzip_comp_level 6;
46+
gzip_min_length 0;
47+
gzip_buffers 16 8k;
48+
gzip_proxied any;
49+
gzip_types text/plain text/css text/xml text/javascript application/xml application/xml+rss application/javascript application/json;
50+
gzip_disable "MSIE [1-6]\.";
51+
gzip_vary on;
52+
53+
# include sub-config files, especially the jenkins server
54+
include /etc/nginx/conf.d/*.conf;
55+
}
56+
57+
# Stream pass through for SSL and JDBC Connections
58+
stream {
59+
server {
60+
listen 5555;
61+
proxy_pass gitlab:5555;
62+
}
63+
server {
64+
listen 2222;
65+
proxy_pass gitlab:22;
66+
67+
}
68+
}
69+
70+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
server {
2+
listen 80;
3+
server_name "" ;
4+
access_log on;
5+
# Same like external_url 'http://HOSTNAME/gitlab' in docker-compose
6+
location ^~/gitlab {
7+
proxy_pass http://gitlab:80;
8+
include /etc/nginx/conf.d/proxy-settings.conf;
9+
}
10+
}

0 commit comments

Comments
 (0)