Skip to content

Commit

Permalink
Merge pull request #100 from articulate/feature/cleanup
Browse files Browse the repository at this point in the history
docs(readme): update readme for rewrite
  • Loading branch information
mloberg authored Nov 10, 2022
2 parents cdd0542 + 68d9e20 commit 5044bc0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 303 deletions.
78 changes: 22 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ Load values from Consul and Vault as environment variables.

## Installing

Run `install.sh` in your Docker image. This will copy over _entrypoint.sh_, Consul
template files, and install dependencies needed to run the entrypoint. Then set
your `ENTRYPOINT`.
Download the [latest release](https://github.com/articulate/docker-consul-template-bootstrap/releases/latest),
add it to your image, and set it as your `ENTRYPOINT`.

```docker
ADD https://raw.githubusercontent.com/articulate/docker-consul-template-bootstrap/master/install.sh /tmp/consul_template_install.sh
If you are using Buildkit you can use the `TARGETARCH` arg to `ADD` the correct
architecture.

RUN bash /tmp/consul_template_install.sh && rm /tmp/consul_template_install.sh
```docker
ARG TARGETARCH
ADD --chmod=755 https://github.com/articulate/docker-consul-template-bootstrap/releases/latest/download/docker-consul-template-bootstrap_linux_${TARGETARCH} /entrypoint
ENTRYPOINT [ "/entrypoint.sh" ]
ENTRYPOINT [ "/entrypoint" ]
```

## Usage
Expand Down Expand Up @@ -42,58 +43,23 @@ ways:
* If running on AWS ECS or Lambda, use the AWS IAM auth method
* If Vault role does not match IAM role, set with `VAULT_ROLE`

## Circumventing Docker Caching

With Docker cache, if you make any changes outside of `install.sh` (e.g. the `ctmpl`
files), you also need to update `install.sh`. Update the `CACHE_VERSION` to the
current datetime.

## Development Usage

To test this locally you will need to edit the `docker-compose.override.yml` and
add the following:

```yaml
environment:
SERVICE_NAME: "your-service"
SERVICE_ENV: "dev|stage|prod|peer"
VAULT_ADDR: "https://myarticulatetest.localtunnel.me"
VAULT_TOKEN: "your-token"
```
## Development

You can run vault locally with `vault server -dev`. This command will output the
VAULT_TOKEN you need and listen on port 8200. I use [localtunnel](https://localtunnel.me)
to grab a url to use as the VAULT_ADDR. `lt --port 8200 -s myarticulatetest`
You'll need to install the following:

## Test Suite
* Go 1.19
* [golangci-lint](https://golangci-lint.run/) (`brew install golangci-lint`)
* [pre-commit](https://pre-commit.com/) (`brew install pre-commit`)
* [GoReleaser](https://goreleaser.com/) (_optional_)

The test suite is written in rspec and creates a series of containers (both vault
& consul) and runs a series of tests against those. The module used within rspec
is `https://github.com/zuazo/dockerspec` and uses serverspec behind the scenes.
Setup the build environment with `make init`. Run tests with `make test` and lint
code with `make lint`.

The tests included run through the normal cascade pattern of Global -> Product ->
Service and at the end provides output. These comprehensive tests could take 10
minutes.
When committing, you'll need to follow the [Conventional Commits](https://www.conventionalcommits.org)
format. You can install a tool like [git-cz](https://github.com/commitizen/cz-cli#conventional-commit-messages-as-a-global-utility)
or [commitizen](https://github.com/commitizen-tools/commitizen#installation).

To kick off the tests:
## Creating a Release

1. Create a branch and push that branch to GitHub.
2. Run something similar to `cp docker-compose.override.example.yml docker-compose.override.yml`

Then run:

`docker-compose run app`

If your changes are not committed and pushed it will not be picked up when the test
images build (rspec pulls in details from the git branch to create the tests).

There may be a chance that the containers created by the test suite contain cached
content. If needed you can run:

```bash
docker-compose down
docker rmi --force docker-consul-template-bootstrap_app
docker rmi --force consul_template_bootstrap_alpine
docker rmi --force consul_template_bootstrap_centos
docker rmi --force consul_template_bootstrap_debian
```
To create a release, create a tag that follows [semver](https://semver.org/) and
a GitHub Action workflow will take care of creating the release.
69 changes: 0 additions & 69 deletions install.sh

This file was deleted.

178 changes: 0 additions & 178 deletions wait-for-it.sh

This file was deleted.

0 comments on commit 5044bc0

Please sign in to comment.