Getting Started With Concourse on macOS
If you haven’t checked out Concourse yet, you definitely should! Simple primitives (Resources, Jobs, Tasks), a heavy emphasis on continuous workflows defined by YAML, and an active & growing community are just some reasons why it’s worth taking a look. This is a quick guide to getting an instance running on your machine in minutes.
My Setup:
- Docker (docker version 18.04.0-ce, build 3d479c0)
- Docker Machine (docker-machine version 0.14.0, build 89b8332)
- Docker Compose (docker-compose version 1.21.0, build unknown)
As you can tell, I’m using Docker and its tools to handle all the heavy lifting.
Concourse has a Github repository dedicated to compatibility with Docker, so all that’s needed is to grab the right bits and let it do its thing! 🙌
Note: Due to my lifestyle, I keep a few docker hosts active so I use Docker Machine. I’ve noted the difference that will occur with the newer Docker implementation so you should be fine either way.
Preflight Check
Opening up the terminal and running docker info
will make sure that Docker is ready and waiting.
Note: If you get an error or timeout, take a gander at the Docker Machine docs.
Setup Concourse
Grab the quickstart Docker Compose file provided by Concourse and save it as docker-compose.yml
.
Run docker-compose up -d
(The -d flag will run the containers in the background. If you’re interested in seeing the logs, feel free to omit.)
By running docker ps
, you can see that Docker Compose has conveniently setup two Docker containers; one for Concourse and another for Postgres. All the ports, permissions, and credentials have been taken care of for us.
Note: If there is something already occupying the default port, adjust the docker-compose.yml
file and try again.
That’s a fully functional local Concourse installation in two commands! Not bad so far. Now comes the fun part.
Accessing Concourse
Docker Machine will let you know the address of the host by running docker-machine env | grep HOST
. Copy it and add the correct port for glory (ex. http://192.168.99.100:8080/).
Note: If you’re using the newer Docker installation method for macOS, you should be able to go to http://127.0.0.1:8080/.
Now you should be able to see your first glimpse of Concourse!
To install the Concourse CLI (fly
) on your system, click on the Apple logo to download, and run the following commands…
Last step is to login. Using the fly login
command will help accomplish this.
Note: The -t
flag is a target alias and is required for almost every command. This alias comes in very handy when you’re targeting multiple concourse installations.
Setting up a Pipeline
Grabbing a bare bones Concourse pipeline is a good way to start kicking the tires. Luckily, there are lots of examples to choose from in the Concourse repos.
You can now use fly set-pipeline
to upload this pipeline to Concourse.
Once completed, the output will let you know where to view the new pipeline. You’ll be prompted to login in the Web Interface (GUI), but since this is a local instance the no authentication option is on by default. So you can just click through.
You’ll see a single job pipeline called “simple” and the top navigation will be blue. This color confirms that you’re pipeline is paused.
At this point, we’re able to do conduct actions like unpause-pipeline
and trigger-pipeline
via the web interface or fly
. For the sake of continuity, we’ll stick to fly
. It’s also cool to see how the GUI reacts to your terminal commands. 😬
The navigation bar should lose its blue colouring at this point. Indicating that it’s ready to run jobs. This pipeline doesn’t have any Resources that can trigger the “simple” job, so we’ll use fly trigger-job
to do it manually.
Concourse will schedule and run your job. Once complete, it ends with a mighty green box which is a developer’s universal sign for victory.
Clicking on this job will give you a more detailed view.
Done
That’s all it takes to start from scratch with Concourse. This is just the start, there is lots more the explore to take full advantage of the opportunities it presents. Hope this helps and thanks for reading! 😊🙇♂️
P.S.
If you fly -t hello destroy-pipeline -p hello-world
and refresh your browser, you can check out its cool 404 page. 😎
Updates
Concourse 4.0 is out and comes with a handy test user in the Docker image so I’ve updated the login command.