Git Product home page Git Product logo

concourseci-server-boilerplate's Introduction

Status

  • Concourse Version: 7.x
  • Vault: 1.8.x
  • Postgres: 11
  • Auth: LDAP or Local
  • Artifact-Storage: Minio S3 local storage
  • Traefik as SSL-Offloader: 2.5+

WAT

A boilerplate for you to quick-start a concourse stack with most of the features you would need in production. It auto-configures Concourse CI and lets you configure most of the things using ENV variables for customization.

It starts the whole stack with a simple

docker-compose up

and lets you select the features you actually need in .env.

Use cases would be:

  • Run Concourse CI in production
  • Test concourse for or in your team
  • test-drive upgrades of your concourse
  • developing new pipelines before you deploy it to your production server, like this concourse-app-release-lifecycle-example

Usage

To just go for it:

cp .env.local.sample .env

docker-compose up

# or

./start.sh

Now you have the default setup. Access it using http://localhost (via traefik) with the user included1, password included

Customizing

Copy the .env.local.sample to .env - now customize .env.

I. The default setup includes the following aspects

  • traefik SSL offloading / reverse proxy (with disabled SSL by default)
  • vault configured (as secret store), see docker-compose-vault.yml
  • minio configured (as a s3 alike artifac storage store), see docker-compose-minio.yml
  • ldap auth (an example ldap server is included, see docker-compose-ldap-auth.yml )
  • local user auth docker-compose-local-auth.yml
  • docker based workers docker-compose-worker.yml
  • standalone workers (offsite) docker-compose-worker-standalone.yml

You can configure which aspects you want to pick by modifying COMPOSE_FILE in .env. So disable vault or minio or ldap as you please.

Please always consider to run your workers on a different machine / docker-engine then web in production.. they really kill each other. I recommend running a standalone-worker on a non-docker engine VM in production (or several).

II. For the authentication, you have to pick at least ldap or local for auth

II. This will start a concourse server right up, including your aspects. The default is vault and ldap auth

docker-compose up
# or
./start.sh

Examples

See examples including all the scripts to test your login, deploy test pipelines and pre-fill your vault for pipeline testing

Vault

See the examples/run_3_vault_test.sh script to see how consul con be setup and started with a vault based pipeline examples/vaults-based

Login / Credentials

The credentials for the first login depend on the auth type you have chose. Right now Ldap is the default

Ldap When using the LDAP, potential users are listed here: https://github.com/EugenMayer/docker-image-ldapexample

  • user: included1 / password: included1

See the Concourse LDAP AUTH docs if you want to lear more

Local

  • user:admin / password: admin

See the Concourse Local AUTH docs if you want to learn more

Access the WebUI

See "Login/Credentials" section for the login information, access the GUI :

http://localhost

Cli Configuration

Now install the cli

# MacOS
brew cask install fly

# linux, e.g. arch AUR
yay -S concourse-fly-bin

# or download from the running concourse server

# MacOS
curl -o fly http://localhost/api/v1/cli?arch=amd64&platform=darwin

# or Linux
curl -o fly http://localhost/api/v1/cli?arch=amd64&platform=linux

now login with the cli against our local server

fly -t test_main login -c http://localhost
# see "Login/Credentials" for the login information

update fly

fly -t test_main sync

Adjustments can be done by editing the .env file

Create/Deploy a pipeline

push a pipeline to the main team / pipeline from ci/pipline.yml

fly sp -t test_main configure -c ci/pipline.yml -p main --load-vars-from ../credentials.yml -n

Minio s3 based storage

Having a proper artifact storage is basically a mandatory point with concourse-ci, maybe one of the key differences to other CI solutions and for sure can be seen as a burden when you start concourse. You can dodge it but you will regret it since concourse is stubborn in this regard - it will force it. That is why Minio is included in this stack to provide an out of the box s3 storage - locally. Without the hassle of s3 keys or similar.

Be aware, Minio does not support object versioning, you will not be able to use versioned_file: myapp.tgz but only regexp

To login, connect to

You will need to create at leas one bucket to use it, obviously. See https://github.com/kw-concourse-example/concourse-app-release-lifecycle-example for an example on how to use Minio but basically its just the same as you would use AWS s3 - it's a "imitation"

Intercept into a broken / running container

fly -t test_main intercept -j <pipelinename>/<jobname>

so for example, assuming we have a job in pipeline main named builder-image-build

fly -t test_main intercept -j main/builder-image-build

Vault access and setting values

To adjust your vault or putting value into it, you should use the configurator container, which has the ability to talk to it and set new values. Its pretty easy, just do

connect into the container

docker-compose exec config bash

load credentials and server config

source /vault/server/init_vars

set a value of your desire

vault kv put secret/concourse/test value=test

or in short

docker-compose exec config bash -l -c 'source /vault/server/init_vars && vault kv put secret/concourse/main/firstvalue value=foo'

Advanced

Vault: Testing client access

since the above is all done using the server token, you can try the client token too

docker-compose exec config bash

export VAULT_CLIENT_CERT=/vault/concourse/cert.pem
export VAULT_CLIENT_KEY=/vault/concourse/key.pem
export VAULT_ADDR=https://vault:8200
export VAULT_CACERT=/vault/concourse/server.crt

vault login -method=cert
vault kv get secret/concourse/main/main/myvalue

concourseci-server-boilerplate's People

Contributors

eugenmayer avatar janpretzel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

concourseci-server-boilerplate's Issues

Concourse login error

Hi! I'm running the fly login command but I'm getting a weird error.

I'm running the default config, just ran docker-compose up and that's all.

Command:

fly -t lite login -c http://127.0.0.1:8080 -u included1 -p included1

Output:

logging in to team 'main'

error: oauth2: cannot fetch token: 400 Bad Request
Response: {"error":"invalid_request","error_description":"Requested connector does not exist."}

Expected Behavior: I would expect to get a successful connection to vault by doing this.

Tanks for the help!

5.x: vautl seems to no longer work

running run_3_vault_test.sh leads to

Cloning into '/tmp/build/get'...
fetch: Fetching reference HEAD
WARNING: 'git lfs checkout' is deprecated and will be removed in v3.0.0.
'git checkout' has been updated in upstream Git to have comparable speeds
to 'git lfs checkout'.
e0c4f7c upgrade to 4.1.3
failed to interpolate task config: Expected to find variables: nested/value
errored

5.x: db migration errors ( probably 4.x already )

during the startup

db_1          | 2019-03-10 14:04:48.880 UTC [72] ERROR:  relation "schema_migrations" does not exist at character 15
db_1          | 2019-03-10 14:04:48.880 UTC [72] STATEMENT:  SELECT * from schema_migrations
db_1          | 2019-03-10 14:04:48.884 UTC [72] ERROR:  relation "migrations_history" does not exist at character 15
db_1          | 2019-03-10 14:04:48.884 UTC [72] STATEMENT:  SELECT * from migrations_history
db_1          | 2019-03-10 14:04:50.195 UTC [74] ERROR:  relation "schema_migrations" does not exist at character 15
db_1          | 2019-03-10 14:04:50.195 UTC [74] STATEMENT:  SELECT * from schema_migrations

this is either related to the fact that we use postgresql 10.1 and i remember that 10.x was not officially supported eventhough the docs say:

https://concourse-ci.org/postgresql-node.html
PostgreSQL 9.5 or above is required, though the latest available version is recommended.

./run_2_create_extra_team.sh does no longer work

seems like probably the syntax for creating a team changed

running

fly -t test_main set-team --team-name=extrateam --ldap-user=included1

does not add included1 to the group it seems

creating team extrateam under login target test_extrateam
Team Name: extrateam

Users (owner):
- ldap:included1

Groups (owner):
- none

apply configuration? [yN]: y
team created
logged out of target: test_extrateam
logging in to team 'extrateam'

navigate to the following URL in your browser:

  http://127.0.0.1:8080/login?fly_port=62330

or enter token manually: 
error: user [included1] is not in team [extrateam]
please login yourself since http://127.0.0.1:8080 is not the right docker-machine ip for you

Or it is this new permission scheme

5.x support

Overall in the 5.x the boilerplate already seem to work, so the current 4.x configurator seems to work at the first glimps.

What works

  • ldap
  • localauth
  • vault
  • fly login
  • configurator 4.x

optional, more cosmetic issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.