Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stevebuik/docker-roll
https://github.com/stevebuik/docker-roll
ci clojure deployment devops pipelines terraform
Last synced: 17 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/stevebuik/docker-roll
- Owner: stevebuik
- Created: 2017-10-15T22:20:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-16T02:11:17.000Z (over 7 years ago)
- Last Synced: 2024-11-19T06:05:53.765Z (3 months ago)
- Topics: ci, clojure, deployment, devops, pipelines, terraform
- Size: 2.93 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Docker image for Juxt Roll deployments
Useful when running [Juxt Roll](https://github.com/juxt/roll) deployments in CI systems,
or on localhost without needing to install all the tools below.This image includes the following CLI tools
* Lumo
* Mach
* Lein
* Boot
* AWS CLI
* Terraform## Deploying using this image
Has been tested/use in Bitbucket pipelines but it can be used in any Docker environment.
This image is available on Dockerhub at https://hub.docker.com/r/steveb8n/roll
i.e. use **steveb8n/roll** as your Docker tag.
Or, alternatively, build it yourself from source and push to your own Docker repo.**AWS Profiles**
Roll uses the *default* profile when invoking the *aws* CLI.
This means that you must have a *default* profile present but this can be difficult in Docker instances because the file-system is fresh each time.
One solution is to invoke `aws configure` for the 3 required environment variables in the build steps:`aws --profile default configure set region $AWS_REGION`
`aws --profile default configure set aws_access_key_id $AWS_ACCESS_KEY_ID`
`aws --profile default configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY`
**Terraform State**
Terraform needs a way to store its plans between invocations.
In a CI environment, this state cannot be stored locally.
This is fixed by using a [*remote backend*](https://www.terraform.io/docs/backends/index.html) for Terraform.
There are many backend types but AWS S3 is best suited for a Roll deployment.
This can be added by a function in the Mach *produce* thread-first macro:
produce (-> config
(roll.core/preprocess)
(roll.core/deployment->tf)
(assoc-in [:terraform :backend "s3"] {:bucket "some-bucket-name"
:key "some/key"
:region "some-aws-region"})
(roll.core/->tf-json))**Terraform Commands**
You must run [terraform init](https://www.terraform.io/docs/commands/init.html) before `terraform plan` so that the providers and backends are correctly prepared.
In other words, the commands for an automated roll deploy using this image are:`mach upload`
`mach tfjson`
`terraform init`
`terraform plan`
`terraform apply`
## Bitbucket Pipelines Usage
The example Machfile uses `git describe` to generate a unique artifact name for the uberjar.
This can fail if the `git clone` performed by the CI service is *shallow* i.e. not a full clone.
This can be fixed in the bitbucket-pipelines.yml file by configuring a full clone.
image: steveb8n/roll
clone:
depth: full