The docker-compose.yml contains:
Docker compose is very convenient to launch CDS for testing it. But this is not recommended for a Production Installation.
$ mkdir /tmp/cdstest && cd /tmp/cdstest && mkdir -p tools/smtpmock $ curl https://raw.githubusercontent.com/ovh/cds/0.49.0/docker-compose.yml -o docker-compose.yml $ export HOSTNAME=$(hostname) $ export CDS_DOCKER_IMAGE=ovhcom/cds-engine:0.49.0 # Get the latest version $ docker pull ovhcom/cds-engine:0.49.0 # Create PostgreSQL database, redis and elasticsearch $ docker-compose up --no-recreate -d cds-db cds-cache elasticsearch dockerhost # check if database is up, the logs must contain "LOG: database system is ready to accept connections" $ docker-compose logs| grep 'database system is ready to accept connections' # you should have this line after few seconds: cds-db_1 | LOG: database system is ready to accept connections $ docker-compose up --no-recreate cds-db-init $ docker-compose up --no-recreate cds-migrate # You should have this log: "cdstest_cds-migrate_1 exited with code 0" # prepare initial configuration. $ docker-compose up cds-prepare # disable the smtp server $ export CDS_EDIT_CONFIG="api.smtp.disable=true" $ docker-compose up cds-edit-config # run API $ docker-compose up -d cds-api # the INIT_TOKEN variable will be used by cdsctl to create first admin user $ TOKEN_CMD=$(docker logs cdstest_cds-prepare_1|grep TOKEN) && $TOKEN_CMD # if you have this error: "command too long: export INIT_TOKEN=....", # you can manually execute the command "export INIT_TOKEN=...." # create user $ curl 'http://localhost:8081/download/cdsctl/linux/amd64?variant=nokeychain' -o cdsctl # on OSX: $ curl 'http://localhost:8081/download/cdsctl/darwin/amd64?variant=nokeychain' -o cdsctl $ chmod +x cdsctl $ ./cdsctl signup --api-url http://localhost:8081 --email email@example.com --username admin --fullname admin # enter a strong password # verify the user $ VERIFY_CMD=$(docker-compose logs cds-api|grep 'cdsctl signup verify'|cut -d '$' -f2|xargs) && ./$VERIFY_CMD # if you have this error: "such file or directory: ./cdsctl signup verify --api-url...", # you can manually execute the command "./cdsctl signup verify --api-url..." # run cdsctl $ ./cdsctl user me # should returns something like: #./cdsctl user me #created 2019-12-18 14:25:53.089718 +0000 UTC #fullname admin #id vvvvv-dddd-eeee-dddd-fffffffff #ring ADMIN #username admin # run others services $ docker-compose up -d cds-ui cds-cdn cds-hooks cds-elasticsearch cds-hatchery-swarm # create first worker model $ ./cdsctl worker model import https://raw.githubusercontent.com/ovh/cds/0.49.0/contrib/worker-models/go-official-1.13.yml # import Import a workflow template $ ./cdsctl template push https://raw.githubusercontent.com/ovh/cds/0.49.0/contrib/workflow-templates/demo-workflow-hello-world/demo-workflow-hello-world.yml Workflow template shared.infra/demo-workflow-hello-world has been created Template successfully pushed ! # create project, then create a workflow from template $ ./cdsctl project create DEMO FirstProject $ ./cdsctl template apply DEMO MyFirstWorkflow shared.infra/demo-workflow-hello-world --force --import-push --quiet # run CDS Workflow! $ ./cdsctl workflow run DEMO MyFirstWorkflow Workflow MyFirstWorkflow #1 has been launched http://localhost:8080/project/DEMO/workflow/MyFirstWorkflow/run/1
Open a browser on http://localhost:8080/account/signup, then login with the user
on http://localhost:8080/project/DEMO/workflow/MyFirstWorkflow/run/1 you will have
You see that the pipeline deploy in production was not launched automatically.
There is a Run Condition on it
cds.manual = true:
The build pipeline contains two stages, with only one job in each stage
# READ THE section https://ovh.github.io/cds/docs/integrations/github/github_repository_manager/#create-a-cds-application-on-github to generate the clientId and clientSecret. # Short version: # go on https://github.com/settings/applications/new # Application name: cds-test-docker-compose # Homepage URL: http://localhost:8080 # Authorization callback: http://localhost:8080/cdsapi/repositories_manager/oauth2/callback # send click on register application. $ export CDS_EDIT_CONFIG="vcs.servers.github.github.clientId=xxxxx vcs.servers.github.github.clientSecret=xxxxx " $ docker-compose up cds-edit-config $ docker-compose up -d cds-vcs cds-repositories
Notice that here, you have the VCS and Repositories services up and running.
vcs: The aim of this µService is to communicate with Repository Manager as GitHub, GitLab, Bitbucket… But, as your CDS is not probably public, GitHub won’t be able to call your CDS to automatically run your workflow on each git push.
repositories: this µService is used to enable the as-code feature. Users can store CDS Files on their repositories. This service clones user repositories on local filesystem.
$ ./cdsctl action import https://raw.githubusercontent.com/ovh/cds/0.49.0/contrib/actions/cds-docker-package.yml