-
Notifications
You must be signed in to change notification settings - Fork 431
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: docker-compose file Signed-off-by: Yvonnick Esnault <[email protected]> * doc: title Signed-off-by: Yvonnick Esnault <[email protected]> * Update run-with-docker-compose.md * chore: use caddy built from master Signed-off-by: Yvonnick Esnault <[email protected]>
- Loading branch information
Showing
4 changed files
with
191 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
## Run with Docker-Compose | ||
|
||
The [docker-compose.yml](/docker-compose.yml) contains: | ||
- cds-db service with a postgresql | ||
- cds-cache service with a redis | ||
- cds-migrate service to prepare DB tables. | ||
- cds-api service | ||
- cds-ui service | ||
- cds-hatchery-swarm service | ||
- cds-hatchery-local service | ||
|
||
Docker compose is very convenient to launch CDS for testing it. But this is not recommended for a Production Installation. | ||
|
||
## How to run | ||
|
||
```bash | ||
$ git clone https://github.com/ovh/cds.git | ||
cd cds | ||
export HOSTNAME=$(hostname) | ||
|
||
# Create PG Database | ||
docker-compose up --no-recreate -d cds-db | ||
|
||
# check if db is UP | ||
# check if last log is "LOG: database system is ready to accept connections" | ||
docker-compose logs | ||
|
||
docker-compose up --no-recreate cds-migrate | ||
# You should have this log: "cds_cds-migrate_1 exited with code 0" | ||
|
||
# run last API and UI | ||
docker-compose up cds-api cds-ui | ||
|
||
``` | ||
|
||
Open a browser on http://localhost:2015, then register a new user. | ||
As there is no SMTP server configured in docker-compose.yml file, | ||
run `docker-compose logs` to get URL for validate the registration. | ||
|
||
## Prepare Project, Pipeline and Application | ||
|
||
On UI: | ||
|
||
- Create a project | ||
- Create an application, with an void pipeline | ||
- Create a pipeline, with a stage and a job | ||
- Inside job, add a step of type "script" | ||
- In script content, add theses lines: | ||
```bash | ||
#!/bin/bash | ||
set -ex | ||
echo "foo" | ||
sleep 10 | ||
echo "bar" | ||
``` | ||
|
||
## Run Pipeline | ||
|
||
Run pipeline. As you can see now, you pipeline is in "waiting status". You have | ||
to run a CDS Worker or a CDS Hatchery which aims to create workers. | ||
|
||
Let's run an hatchery with docker-compose. Two ways: | ||
- a containers with a hatchery `local`. Workers will be spawn inside this container. | ||
- a containers with a hatchery `swarm`. Each worker will be in their own container. | ||
|
||
If your host expose docker API, you can run `docker-compose up cds-hatchery-swarm` | ||
|
||
Otherwise, you can run `docker-compose up cds-hatchery-local` | ||
|
||
*Running a hatchery "local" in a container is not recommanded. Use this way only for test purpose*. | ||
|
||
After running a Hatchery, your pipeline will be in "Building" status, then "Success" status. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
version: '3' | ||
|
||
services: | ||
cds-db: | ||
image: postgres:9.6.2 | ||
environment: | ||
POSTGRES_PASSWORD: cds | ||
POSTGRES_USER: cds | ||
|
||
cds-cache: | ||
image: redis:alpine | ||
command: redis-server --requirepass cds | ||
ports: | ||
- "6379:6379" | ||
|
||
cds-migrate: | ||
image: ovhcom/cds-api:latest | ||
command: /app/api-linux-amd64 database upgrade --db-host cds-db --db-user cds --db-password cds --db-name cds --db-sslmode disable --migrate-dir /app/sql | ||
links: | ||
- cds-db | ||
|
||
cds-api: | ||
image: ovhcom/cds-api:latest | ||
command: /app/api-linux-amd64 | ||
volumes: | ||
- cds-artefacts-volume:/app/artefacts | ||
environment: | ||
CDS_VCS_REPOSITORIES_GITHUB_STATUSES_URL_DISABLED: "true" | ||
CDS_VCS_REPOSITORIES_GITHUB_STATUSES_DISABLED: "true" | ||
CDS_VCS_REPOSITORIES_CACHERLOADER_DISABLED: "true" | ||
CDS_VCS_REPOSITORIES_BITBUCKET_STATUSES_DISABLED: "true" | ||
CDS_DB_HOST: cds-db | ||
CDS_DB_PASSWORD: cds | ||
CDS_DB_TIMEOUT: 10000 | ||
CDS_DB_USER: cds | ||
CDS_DB_NAME: cds | ||
CDS_DB_MAXCONN: 40 | ||
CDS_DB_PORT: 5432 | ||
CDS_DB_SSLMODE: disable | ||
CDS_URL_API: ${HOSTNAME}:8081 | ||
CDS_URL_UI: ${HOSTNAME}:8080 | ||
CDS_SMTP_DISABLE: "true" | ||
CDS_SMTP_TLS: "false" | ||
CDS_SMTP_FROM: [email protected] | ||
CDS_SMTP_HOST: smtp.foo.cds | ||
CDS_SMTP_PORT: 25 | ||
CDS_AUTH_LOCALMODE: session | ||
CDS_AUTH_LDAP_ENABLE: "false" | ||
CDS_AUTH_DEFAULTGROUP: cdsdemo | ||
CDS_LOG_LEVEL: info | ||
CDS_SERVER_HTTP_SESSIONTTL: 600 | ||
CDS_CACHE_TTL: 60 | ||
CDS_CACHE_REDIS_HOST: cds-cache:6379 | ||
CDS_CACHE_REDIS_PASSWORD: cds | ||
CDS_CACHE_MODE: redis | ||
CDS_DIRECTORIES_DOWNLOAD: /app | ||
CDS_VCS_POLLING_DISABLED: "false" | ||
CDS_SERVER_HTTP_PORT: 8081 | ||
CDS_SERVER_GRPC_PORT: 8082 | ||
CDS_SCHEDULERS_DISABLED: "false" | ||
CDS_DIRECTORIES_KEYS: /app/keys | ||
CDS_ARTIFACT_MODE: local | ||
CDS_ARTIFACT_LOCAL_BASEDIR: /app/artefacts | ||
CDS_AUTH_SHAREDINFRA_TOKEN: changeitchangeitchangeitchangeitchangeitchangeitchangeitchangeit | ||
CDS_SERVER_SECRETS_KEY: changeitchangeitchangeitchangeit | ||
ports: | ||
- "8081:8081" | ||
- "8082:8082" | ||
links: | ||
- cds-db | ||
- cds-cache | ||
|
||
cds-ui: | ||
image: ovhcom/cds-ui:latest | ||
environment: | ||
BACKEND_HOST: ${HOSTNAME}:8081 | ||
BASE_URL: / | ||
ports: | ||
- "2015:2015" | ||
links: | ||
- cds-api | ||
|
||
cds-hatchery-swarm: | ||
image: ovhcom/cds-hatchery:latest | ||
command: /app/hatchery-linux-amd64 swarm | ||
environment: | ||
CDS_LOG_LEVEL: notice | ||
CDS_RATIO_SERVICE: 50 | ||
CDS_TOKEN: changeitchangeitchangeitchangeitchangeitchangeitchangeitchangeit | ||
DOCKER_HOST: tcp://${HOSTNAME}:2375 | ||
CDS_API: http://cds-api:8081 | ||
CDS_NAME: ${HOSTNAME}-swarm | ||
CDS_MAX_WORKER: 2 | ||
CDS_MAX_CONTAINERS: 4 | ||
CDS_PROVISION: 0 | ||
CDS_REQUEST_API_TIMEOUT: 120 | ||
links: | ||
- cds-api | ||
|
||
cds-hatchery-local: | ||
image: ovhcom/cds-hatchery:latest | ||
command: /app/hatchery-linux-amd64 local | ||
environment: | ||
CDS_TOKEN: changeitchangeitchangeitchangeitchangeitchangeitchangeitchangeit | ||
CDS_API: http://cds-api:8081 | ||
CDS_NAME: ${HOSTNAME}-local | ||
links: | ||
- cds-api | ||
|
||
volumes: | ||
cds-artefacts-volume: | ||
driver: local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters