Skip to content

Commit 966c938

Browse files
authored
fix(development): make development environment work by default (#1264)
Signed-off-by: Miguel <[email protected]>
1 parent 3675bbb commit 966c938

File tree

7 files changed

+121
-40
lines changed

7 files changed

+121
-40
lines changed

app/controlplane/configs/config.devel.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ data:
5555
# Development credentials for the SSO authentication roundtrip
5656
auth:
5757
oidc:
58-
domain: ${DEX_DOMAIN:http://dex:5556/dex}
58+
domain: ${DEX_DOMAIN:http://0.0.0.0:5556/dex}
5959
client_id: "chainloop-dev"
6060
client_secret: "ZXhhbXBsZS1hcHAtc2VjcmV0"
6161

devel/README.md

+41
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,44 @@ Running the following command fixes the issue:
120120
```
121121
sudo ln -s $HOME/.docker/run/docker.sock /var/run/docker.sock
122122
```
123+
124+
## Labs Environments
125+
126+
For quick testing you can use the provided `compose.labs.yml` file to run the Chainloop components and the auxiliary services.
127+
128+
### 0 - Prerequisites
129+
130+
- Docker and Docker Compose
131+
- Add entry in `/etc/hosts` for the hostname `dex` pointing to `127.0.0.1`
132+
133+
134+
### 1 - Run Containerized Environment
135+
136+
Run the labs environment
137+
138+
```sh
139+
docker compose -f compose.labs.yml up
140+
```
141+
142+
143+
### 2 - Configure Chainloop CLI
144+
145+
Download Chainloop CLI
146+
147+
```sh
148+
curl -sfL https://docs.chainloop.dev/install.sh | bash -s
149+
```
150+
151+
Configure the CLI to point to the local control plane and CAS services.
152+
153+
```sh
154+
chainloop config save --insecure --control-plane localhost:9000 --artifact-cas localhost:9001
155+
```
156+
157+
and login
158+
159+
```
160+
chainloop --insecure auth login
161+
```
162+
163+
you are now ready to use the CLI and follow the [quickstart guide](https://docs.chainloop.dev/quickstart)

devel/compose.common.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# NOTE: This setup is meant to be used for development purposes only.
2+
services:
3+
postgresql:
4+
image: docker.io/bitnami/postgresql:16
5+
# Expose the port to the host to enable baremetal controlplane development
6+
ports:
7+
- 5432:5432
8+
volumes:
9+
- postgresql_data:/bitnami/postgresql
10+
environment:
11+
- ALLOW_EMPTY_PASSWORD=yes
12+
- POSTGRESQL_DATABASE=controlplane
13+
- POSTGRESQL_USERNAME=postgres
14+
healthcheck:
15+
test: ["CMD", "pg_isready", "-U", "postgres"]
16+
interval: 2s
17+
retries: 10
18+
19+
# in memory-only vault for development
20+
# note that secrets will get removed when the container is restarted
21+
vault:
22+
image: docker.io/vault:1.12.3
23+
cap_add:
24+
- IPC_LOCK
25+
ports:
26+
- 8200:8200
27+
environment:
28+
- VAULT_DEV_ROOT_TOKEN_ID=notasecret
29+
healthcheck:
30+
test: [ "CMD", "wget", "--spider", "http://127.0.0.1:8200/v1/sys/health" ]
31+
interval: 10s
32+
timeout: 3s
33+
retries: 10
34+
start_period: 5s
35+
volumes:
36+
postgresql_data:

devel/labs.compose.yaml devel/compose.labs.yaml

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
name: chainloop-lab
22

33
include:
4-
- ./compose.yml
4+
- ./compose.common.yml
55
services:
6+
# OIDC provider for labs
7+
dex:
8+
volumes:
9+
- ".:/wd"
10+
image: docker.io/bitnami/dex:2
11+
working_dir: /wd/dex
12+
command: "serve config.labs.yaml"
13+
ports:
14+
- "0.0.0.0:5556:5556/tcp"
15+
616
# The control plane is the main service
717
control-plane:
818
image: ghcr.io/chainloop-dev/chainloop/control-plane:latest

devel/compose.yml

+5-36
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,9 @@
1-
# NOTE: This setup is meant to be used for development purposes only.
2-
services:
3-
postgresql:
4-
image: docker.io/bitnami/postgresql:16
5-
# Expose the port to the host to enable baremetal controlplane development
6-
ports:
7-
- 5432:5432
8-
volumes:
9-
- postgresql_data:/bitnami/postgresql
10-
environment:
11-
- ALLOW_EMPTY_PASSWORD=yes
12-
- POSTGRESQL_DATABASE=controlplane
13-
- POSTGRESQL_USERNAME=postgres
14-
healthcheck:
15-
test: ["CMD", "pg_isready", "-U", "postgres"]
16-
interval: 2s
17-
retries: 10
18-
19-
# in memory-only vault for development
20-
# note that secrets will get removed when the container is restarted
21-
vault:
22-
image: docker.io/vault:1.12.3
23-
cap_add:
24-
- IPC_LOCK
25-
ports:
26-
- 8200:8200
27-
environment:
28-
- VAULT_DEV_ROOT_TOKEN_ID=notasecret
29-
healthcheck:
30-
test: [ "CMD", "wget", "--spider", "http://127.0.0.1:8200/v1/sys/health" ]
31-
interval: 10s
32-
timeout: 3s
33-
retries: 10
34-
start_period: 5s
1+
# NOTE: By default this file runs a development setup.
2+
# To run a labs setup, use `docker-compose -f compose.labs.yml up`
3+
include:
4+
- ./compose.common.yml
355

6+
services:
367
# OIDC provider for development
378
dex:
389
volumes:
@@ -43,5 +14,3 @@ services:
4314
ports:
4415
- "0.0.0.0:5556:5556/tcp"
4516

46-
volumes:
47-
postgresql_data:

devel/dex/config.dev.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# this requires adding an entry `127.0.0.1 dex` to /etc/hosts
2-
issuer: http://dex:5556/dex
1+
issuer: "http://0.0.0.0:5556/dex"
32

43
storage:
54
type: memory

devel/dex/config.labs.yaml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
issuer: "http://dex:5556/dex"
2+
3+
storage:
4+
type: memory
5+
6+
web:
7+
http: 0.0.0.0:5556
8+
9+
staticClients:
10+
- id: chainloop-dev
11+
redirectURIs:
12+
- "http://0.0.0.0:8000/auth/callback"
13+
- "http://localhost:8000/auth/callback"
14+
name: "Chainloop Dev"
15+
secret: ZXhhbXBsZS1hcHAtc2VjcmV0
16+
17+
# required to enable static passwords
18+
enablePasswordDB: true
19+
20+
staticPasswords:
21+
- email: "[email protected]"
22+
# password: "password"
23+
hash: "$2a$10$2b2cU8CPhOTaGrs1HRQuAueS7JTT5ZHsHSzYiFPm1leZck7Mc8T4W"
24+
- email: "[email protected]"
25+
# password: "password"
26+
hash: "$2a$10$2b2cU8CPhOTaGrs1HRQuAueS7JTT5ZHsHSzYiFPm1leZck7Mc8T4W"

0 commit comments

Comments
 (0)