Skip to content

jonm/vagrant-concourse-local

Repository files navigation

Running Concourse locally via Vagrant

This project is the result of quite a bit of experimentation trying to get Concourse running locally on a Windows PC, to support some hobby projects I wanted to work on. Presumably this would also work on other platforms that support a VirtualBox provider, although its considerably easier to get Concourse working on Mac OS X and Linux just by using Docker directly.

TL;DR

  1. Set the environment variable CONCOURSE_ADD_LOCAL_USER to a string that looks like user:pass. On Windows, you can do this from a cmd prompt that is running as Adminstrator with:

    C:\> setx -m CONCOURSE_ADD_LOCAL_USER "myuser:mypassword"
    

    You will be able to log into the Concourse UI with this username and password.

  2. Same deal, but for VAULT_ADMIN_USERPASS, which is a username/password you can use for logging into the Vault instance this spins up.

  3. Clone this repository into a subdirectory of your Windows home directory. I put it at C:\Users\Jon\Documents\src\concourse.

  4. Make sure you have the native Windows version of Vagrant installed, as well as VirtualBox (I had VirtualBox installed as part of installing Docker Toolbox on Windows Home edition).

  5. vagrant plugin install vagrant-disksize. This allows us to modify the size of the disk that gets configured; the default 10GB disk can run out of space quickly.

  6. vagrant up. This must also be run from a cmd prompt that is running as Administrator so that the permissions and symlinks work properly.

More details

I eventually settled on this after exhausting a few other possibilities trying to get this run from the Windows Subsystem for Linux (WSL):

  • Concourse had trouble launching containers for build when trying to run this on Docker Toolbox directly.
  • Vagrant wouldn't successfully come up if I tried to launch from a WSL directory (like my WSL ~) or if I tried to run the Linux version of Vagrant from WSL.

A few notes on the configuration:

  • Because I am just using this locally, the shared keys generated by vault init are stored locally on the box! This is really not how Vault is intended to be used, and is arguably not at all secure, but I wanted something convenient for local dev and I was already used to Vault as a credential manager for Concourse. However, ports are forwarded properly so you should be able to vault login against http://127.0.0.1:8200 from a WSL bash prompt (yay!).

  • Everything should restart if you vagrant halt and vagrant up.

  • You can use the default http://127.0.0.1:8080/ Concourse URL.

  • Two directories will be created on the host (Windows) machine in this directory: concourse-data and vault-data. These are, respectively, where the data for the Concourse Postgres database and the Vault instance are ultimately mounted. concourse-data is mounted via SMB so that symlinks work properly; this will require you to enter your Windows credentials when the VM is booting.

    The main advantages of having these filesystems external to the VM are:

    1. Not running out of disk space as easily.
    2. Being able to vagrant destroy and vagrant up without losing your configured pipelines or stored credentials.

About

Vagrant environment for running concourse locally

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published