Skip to content

Commit 7b3e5c6

Browse files
alfespa17stanleyz
authored andcommitted
feat: Upgrade docker compose guide to version 2.25.0 with local https support (AzBuilder#1860)
* feat: Update docker compose to 2.25.0 using traefik with https * feat: Update docker compose to 2.25.0 using traefik with https * feat: Update docker compose to 2.25.0 using traefik with https [skip ci]
1 parent 32baf7a commit 7b3e5c6

12 files changed

+500
-232
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*.zip
1919
*.tar.gz
2020
*.rar
21+
*.pem
2122

2223
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
2324
hs_err_pid*

docker-compose/.env

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
##################
2+
#GENERAL SETTINGS#
3+
##################
4+
TK_VERSION=2.25.0
5+
DOMAIN=platform.local
6+
7+
##################
8+
#NETWORK SETTINGS#
9+
##################
10+
EXTERNAL_NETWORK_NAME=terrakube-network
11+
TRAEFIK_IPV4_ADDRESS=10.25.25.253
12+
HOST_GATEWAY=10.25.25.253
13+
TRAEFIK_HTTP_PORT=80
14+
TRAEFIK_HTTPS_PORT=443
15+
DNS_IP_PUBLIC=
16+
17+
##########
18+
#SECURITY#
19+
##########
20+
PAT_SECRET=ejZRSFgheUBOZXAyUURUITUzdmdINDNeUGpSWHlDM1g=
21+
INTERNAL_SECRET=S2JeOGNNZXJQTlpWNmhTITkha2NEKkt1VVBVQmFeQjM=
22+
23+
#####
24+
#DEX#
25+
#####
26+
TK_DEX_VERSION=v2.42.0
27+
28+
###################
29+
#OPEN LDAP SETTING#
30+
###################
31+
TK_LDAP_VERSION=2.6.9-debian-12-r10
32+
33+
#######################
34+
#MINIO STORAGE BACKEND#
35+
#######################
36+
TK_MINIO_VERSION=2025
37+
TK_OUTPUT_ACCESS_KEY=minioadmin
38+
TK_OUTPUT_ENDPOINT=http://terrakube-minio:9000
39+
TK_OUTPUT_SECRET_KEY=minioadmin
40+
TK_OUTPUT_STORAGE_REGION=us-east-1
41+
TK_OUTPUT_BUCKET_NAME=sample
42+
TK_OUTPUT_BUCKET_REGION=us-east-1
43+
44+
###################
45+
#DATABASE SETTINGS#
46+
###################
47+
TK_POSTGRESQL_VERSION=17
48+
TK_POSTGRESQL_USERNAME=terrakube
49+
TK_POSTGRESQL_PASSWORD=terrakubepassword
50+
TK_POSTGRESQL_DATABASE_NAME=terrakubedb
51+
52+
################
53+
#REDIS SETTINGS#
54+
################
55+
TK_REDIS_CONTAINER_NAME=terrakube-redis
56+
TK_REDIS_PASSWORD=password123456
57+
TK_REDIS_VERSION=7.0.10
58+
59+

docker-compose/README.md

+42-8
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,61 @@
11
# Terrakube Docker Compose
22

3+
## Local Domains
4+
5+
We will be using following domains to run Terrakube with docker compose:
6+
7+
```shell
8+
terrakube.platform.local
9+
terrakube-api.platform.local
10+
terrakube-registry.platform.local
11+
terrakube-dex.platform.local
12+
```
13+
14+
## HTTPS Local Certificates
15+
16+
Install [mkcert](https://github.com/FiloSottile/mkcert#installation) to generate the local certificates.
17+
18+
## Generate local CA certificate
19+
20+
```shell
21+
mkcert -install
22+
Created a new local CA 💥
23+
The local CA is now installed in the system trust store! ⚡️
24+
The local CA is now installed in the Firefox trust store (requires browser restart)! 🦊
25+
```
26+
27+
## Create Docker Network
28+
29+
```bash
30+
docker network create terrakube-network -d bridge --subnet 10.25.25.0/24 --gateway 10.25.25.254
31+
```
32+
33+
We will be using `10.25.25.253` for our the traefik gateway
34+
335
## Local DNS entries
436

537
Update the /etc/hosts file adding the following entries:
638

739
```bash
8-
127.0.0.1 terrakube-api
9-
127.0.0.1 terrakube-ui
10-
127.0.0.1 terrakube-executor
11-
127.0.0.1 terrakube-dex
12-
127.0.0.1 terrakube-registry
40+
10.25.25.253 terrakube.platform.local
41+
10.25.25.253 terrakube-api.platform.local
42+
10.25.25.253 terrakube-registry.platform.local
43+
10.25.25.253 terrakube-dex.platform.local
1344
```
1445

15-
## Running Terrakube Locally.
46+
## Running Terrakube Locally with HTTPS
1647

1748
```bash
1849
git clone https://github.com/AzBuilder/terrakube.git
1950
cd terrakube/docker-compose
20-
docker-compose up -d
51+
mkcert -key-file key.pem -cert-file cert.pem platform.local *.platform.local
52+
CAROOT=$(mkcert -CAROOT)/rootCA.pem
53+
cp $CAROOT rootCA.pem
54+
docker compose up -d --force-recreate
2155
```
2256

2357
Terrakube will be available in the following URL:
2458

25-
* http://terrakube-ui:3000
59+
* https://terrakube.platform.local
2660
* Username: admin@example.com
2761
* Password: admin

docker-compose/api.env

-29
This file was deleted.

docker-compose/config-ldap.yaml

+60-57
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,77 @@
1-
issuer: http://terrakube-dex:5556/dex
1+
issuer: https://terrakube-dex.platform.local/dex
22

33
storage:
44
type: memory
55
web:
66
http: 0.0.0.0:5556
7-
allowedOrigins: ['*']
7+
allowedOrigins: ["*"]
88

99
oauth2:
10-
responseTypes: ["code", "token", "id_token"]
10+
responseTypes: ["code", "token", "id_token"]
1111

1212
connectors:
13-
- type: ldap
14-
name: OpenLDAP
15-
id: ldap
16-
config:
17-
# The following configurations seem to work with OpenLDAP:
18-
#
19-
# 1) Plain LDAP, without TLS:
20-
host: ldap-service:1389
21-
insecureNoSSL: true
22-
#
23-
# 2) LDAPS without certificate validation:
24-
#host: localhost:636
25-
#insecureNoSSL: false
26-
#insecureSkipVerify: true
27-
#
28-
# 3) LDAPS with certificate validation:
29-
#host: YOUR-HOSTNAME:636
30-
#insecureNoSSL: false
31-
#insecureSkipVerify: false
32-
#rootCAData: 'CERT'
33-
# ...where CERT="$( base64 -w 0 your-cert.crt )"
13+
- type: ldap
14+
name: OpenLDAP
15+
id: ldap
16+
config:
17+
# The following configurations seem to work with OpenLDAP:
18+
#
19+
# 1) Plain LDAP, without TLS:
20+
host: terrakube-ldap-service:1389
21+
insecureNoSSL: true
22+
insecureSkipVerify: true
23+
#
24+
# 2) LDAPS without certificate validation:
25+
#host: localhost:636
26+
#insecureNoSSL: false
27+
#insecureSkipVerify: true
28+
#
29+
# 3) LDAPS with certificate validation:
30+
#host: YOUR-HOSTNAME:636
31+
#insecureNoSSL: false
32+
#insecureSkipVerify: false
33+
#rootCAData: 'CERT'
34+
# ...where CERT="$( base64 -w 0 your-cert.crt )"
3435

35-
# This would normally be a read-only user.
36-
bindDN: cn=admin,dc=example,dc=org
37-
bindPW: admin
36+
# This would normally be a read-only user.
37+
bindDN: cn=admin,dc=example,dc=org
38+
bindPW: admin
3839

39-
usernamePrompt: Email Address
40+
usernamePrompt: Email Address
4041

41-
userSearch:
42-
baseDN: ou=users,dc=example,dc=org
43-
filter: "(objectClass=person)"
44-
username: mail
45-
# "DN" (case sensitive) is a special attribute name. It indicates that
46-
# this value should be taken from the entity's DN not an attribute on
47-
# the entity.
48-
idAttr: DN
49-
emailAttr: mail
50-
nameAttr: cn
42+
userSearch:
43+
baseDN: ou=users,dc=example,dc=org
44+
filter: "(objectClass=person)"
45+
username: mail
46+
# "DN" (case sensitive) is a special attribute name. It indicates that
47+
# this value should be taken from the entity's DN not an attribute on
48+
# the entity.
49+
idAttr: DN
50+
emailAttr: mail
51+
nameAttr: cn
5152

52-
groupSearch:
53-
baseDN: ou=Groups,dc=example,dc=org
54-
filter: "(objectClass=groupOfNames)"
53+
groupSearch:
54+
baseDN: ou=Groups,dc=example,dc=org
55+
filter: "(objectClass=groupOfNames)"
5556

56-
userMatchers:
57-
# A user is a member of a group when their DN matches
58-
# the value of a "member" attribute on the group entity.
59-
- userAttr: DN
60-
groupAttr: member
57+
userMatchers:
58+
# A user is a member of a group when their DN matches
59+
# the value of a "member" attribute on the group entity.
60+
- userAttr: DN
61+
groupAttr: member
6162

62-
# The group name should be the "cn" value.
63-
nameAttr: cn
63+
# The group name should be the "cn" value.
64+
nameAttr: cn
6465

6566
staticClients:
66-
- id: example-app
67-
redirectURIs:
68-
- 'http://terrakube-ui:3000'
69-
- '/device/callback'
70-
- 'http://localhost:10000/login'
71-
- 'http://localhost:10001/login'
72-
name: 'Example App'
73-
#secret: ZXhhbXBsZS1hcHAtc2VjcmV0
74-
public: true
67+
- id: terrakube-app
68+
redirectURIs:
69+
- "https://terrakube.platform.local"
70+
- "https://terrakube-api.platform.local"
71+
- "https://terrakube-dex.platform.local"
72+
- "/device/callback"
73+
- "http://localhost:10000/login"
74+
- "http://localhost:10001/login"
75+
name: "Example App"
76+
#secret: ZXhhbXBsZS1hcHAtc2VjcmV0
77+
public: true

docker-compose/docker-compose.yaml

-87
This file was deleted.

0 commit comments

Comments
 (0)