Skip to content

Commit 99b37a3

Browse files
authored
docs: Improve development environment docs (#10)
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
1 parent d0deb6d commit 99b37a3

File tree

5 files changed

+41
-41
lines changed

5 files changed

+41
-41
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ Your commits must meet the following criteria
1010

1111
- It is signed. To learn how, check [this guide](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits).
1212
- It includes a `--sign-off` stanza. By doing this you state that you can certify [Developer Certificate of Origin](https://developercertificate.org).
13-
- Its message tries to follow the Conventional Commits [guidelines](https://www.conventionalcommits.org/en/v1.0.0/>).
13+
- Its message tries to follow the Conventional Commits [guidelines](https://www.conventionalcommits.org/en/v1.0.0).
1414

1515
A commit then would look like
1616

1717
```
18-
git commit -S -s -m "<your commit message that follows https://www.conventionalcommits.org/en/v1.0.0/>"
18+
git commit -S -s -m "<your commit message that follows https://www.conventionalcommits.org/en/v1.0.0"
1919
```
2020

2121
## Code Reviews

app/cli/Makefile

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,15 @@
11
VERSION=$(shell git describe --tags --always)
22

3-
.PHONY: init
4-
# init env
5-
init:
6-
go install github.com/spf13/cobra-cli@latest
7-
8-
# If the first argument is "run"...
9-
ifeq (run,$(firstword $(MAKECMDGOALS)))
10-
# use the rest as arguments for "run"
11-
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
12-
# ...and turn them into do-nothing targets
13-
$(eval $(RUN_ARGS):;@:)
14-
endif
15-
163
.PHONY: api
174
# generate api proto
185
api:
196
cd ./api && buf generate
207

21-
.PHONY: run
22-
# run
23-
run:
24-
go run main.go --insecure --control-plane localhost:9000 --artifact-cas localhost:9001 $(RUN_ARGS)
25-
268
.PHONY: build
279
# build
2810
build:
2911
mkdir -p bin/ && go build -ldflags "-X github.com/chainloop-dev/chainloop/app/cli/cmd.Version=$(VERSION)" -o ./bin/chainloop ./main.go
3012

31-
.PHONY: all
32-
# generate all
33-
all:
34-
make build;
35-
3613
.PHONY: test
3714
# test
3815
test:

app/controlplane/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ build:
1616
mkdir -p bin/ && go build -ldflags\
1717
"-X github.com/chainloop-dev/chainloop/app/controlplane/internal/server.Version=$(VERSION)\
1818
-X main.Version=$(VERSION)"\
19-
-o ./bin/control-plane ./cmd/...
19+
-o ./bin/control-plane ./cmd/...
2020

2121
.PHONY: run
2222
# run

devel/README.md

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,69 @@
11
## Local development
22

3-
### Pre-requisites
3+
For development, Chainloop components (Control Plane, Artifact CAS and CLI) come pre-configured to talk to a set of auxiliary services (Dex, PostgresSQL and Vault) that can be run using [Docker Compose](https://docs.docker.com/compose/), so you can start contributing in no time! :)
44

5-
To run Chainloop core components locally you need
5+
![development environment](../docs/img/dev-env-overview.png)
6+
7+
### 1 - Prerequisites
8+
9+
To get up and running you'll need
610

711
- Golang 1.20+ toolchain
8-
- `make`
12+
- [Docker Compose](https://docs.docker.com/compose/)
13+
- `make` (optional)
14+
15+
### 2 - Run pre-required/auxiliary services
916

10-
In addition to those, you'll need:
17+
Chainloop requires some configuration to be in place such as
1118

12-
- PostgreSQL 14
13-
- Access to a credentials manager. Currently Hashicorp Vault and AWS secret manager are supported.
19+
- PostgreSQL 14 connection from the Control plane
20+
- Access to a secrets manager. Currently Hashicorp Vault and AWS secret manager are supported.
1421
- Open ID connect (OIDC) single sign-on credentials.
1522

16-
Luckily, these can be easily run by leveraging the provided docker compose that can be found in the `devel` directory.
23+
Luckily, you can leverage the provided docker compose file that can be found in the `devel` directory to do all the setup for you.
1724

1825
```
1926
cd devel
2027
docker compose up
2128
```
2229

23-
### Chainloop Components
30+
### 3 - Run Chainloop server-side components
2431

25-
Once you have the pre-required service up and running, you should be able to run the different Chainloop components, in our case we have three.
32+
Once you have the pre-required services up and running, you should be able to run the different Chainloop server-side components, in our case we have:
2633

2734
- The Control Plane (`app/controlplane`)
2835
- The Artifact Content Addressable Storage (CAS) Proxy (`app/artifact-cas`)
29-
- The Command line interface (CLI) that is used for both a) operate on the control plane and b) run the attestation process on your CI/CD (`app/cli`)
3036

31-
These three components are built in Golang and have a `Makefile` and a `make run` target for convenience.
37+
These components are built using [Go](https://go.dev/), have a `Makefile` and a `make run` target for convenience.
38+
39+
- run controlplane `make -C app/controlplane run`
40+
- run CAS `make -C app/cas run`
41+
42+
### 4 - Using the CLI pointing to the local environment
43+
44+
The Command line interface (CLI) is used for both a) operate on the control plane and b) run the attestation process on your CI/CD.
3245

33-
i.e `make -C app/controlplane run`
46+
You can run it by executing `go run app/cli/main.go`
3447

35-
### Logging in the control-plane
48+
3.1 - Configure the CLI to point to the local control plane and CAS services.
3649

37-
Once you have the Controlplane and the Artifact API running, you can get started by authenticating using the CLI
50+
```
51+
go run app/cli/main.go config save --insecure --control-plane localhost:9000 --artifact-cas localhost:9001
52+
```
53+
54+
3.2 - Logging in the control-plane
55+
56+
You should now be ready to authenticate the CLI
57+
58+
> NOTE: In development a `--insecure` flag must be provided to talk to the local APIs
3859
3960
```
40-
make -C app/cli -- auth login
61+
go run --insecure app/cli/main.go auth login
4162
```
4263

4364
You will get redirected to the pre-configured local OIDC provider (DEX) where there are two configured users
4465

4566
- `sarah@chainloop.local`/`password`
4667
- `john@chainloop.local`/`password`
68+
69+
Once logged in, you are ready to follow our [Getting Started guide](https://docs.chainloop.dev/getting-started/setup)

docs/img/dev-env-overview.png

374 KB
Loading

0 commit comments

Comments
 (0)