moonken / GoCD-scaffold-by-docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduction:

this tool is used to setup GoCD quickly.

Feature

  1. Fast setup a GoCD by simple command:

    go.sh
    docker-compose -f output/docker-compose.yml up -d --build --scale gocd-agent=2
  2. Go agents could share files by a shared columes

    A agent could put share file to /home/go/shared folder, then other could access them in their own path '/home/go/shared', it is useful in some scenarios.

  3. Support customlize Go agent dockerfile(manually)

  4. Provided a simple Pipeline As Code example.

Dependencies

  • docker server(local or remote, this tool support create a docker machine on AWS)
  • docker-compose
  • docker-machine
  • curl

Instructions

Before run the go.sh, you need to set some env variables:

Variable Description Default Value
GO_ADMIN_PASSWORD go admin password admin
CREATE_DOCKER_MACHINE_ON_AWS create docker machine on AWS or not, if not, will start GoCD containers on local docker server false
AWS_ACCESS_KEY_ID required if CREATE_DOCKER_MACHINE_ON_AWS = true
AWS_SECRET_ACCESS_KEY required if CREATE_DOCKER_MACHINE_ON_AWS = true

then, run

go.sh

a folder named output will be generated, include all files to start GoCD containers.

you can run

docker-compose -f output/docker-compose.yml up -d --build --scale gocd-agent=2

to start containers directly or goto output folder and change the dockerfile for go agent(usually, we need to install some tools on go agents by change the dockerfile), then start docker containers inside output.

cd output

docker-compose up -d --build --scale gocd-agent=2

GoCD will launch on your docker host's 8153 port.

FAQ

  1. Can not find command when execute job on go agent, for example: can not execute "bash -c 'npm -v'" even you isntalled nodejs on the agent.

    The reason is that go agent runs under a isolation env, it does not load the right PATH variable of user 'go', the solution is to add '-l' as the parameter of bash command, The '-l' forces bash to behave as a login shell, and read the .bashrc/.bash_profile files, refer to stackoverflow

About


Languages

Language:Shell 100.0%