Skip to content

Commit

Permalink
Merge pull request #346 from mozilla-it/docker-compose
Browse files Browse the repository at this point in the history
fix: migrate to Compose V2
  • Loading branch information
ahoneiser authored Aug 27, 2024
2 parents 882e8b8 + 2b4ad22 commit ea10e00
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions SRE_INFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Refractr, the application, involves the following parts:

- refractr DSL, schema & python code to validate, translate YAML to Nginx configurations and a Kubernetes Ingress manifest;
- doit DSL (dodo.py) to run meta-tasks for this pipeline as part of CD & the entrypoint of the generated Docker Image (used to either run Nginx or, for the job, run kubectl apply -f new-ingress.yaml);
- docker & docker-compose files for creating refractr entrypoint-modified nginx image as well as running the testing suite (only run in local or throwaway environments);
- docker & docker compose files for creating refractr entrypoint-modified nginx image as well as running the testing suite (only run in local or throwaway environments);
- generated nginx configurations & kubernetes yaml (shipped via being copied into the Docker image, generated by doit commands);

## Doit (dodo.py)
Expand All @@ -19,10 +19,10 @@ Doit is a Python framework meant to replace Makefiles and similar tools. The fol
1. doit refracts (generate refracts.json from dev|prod-refractr.yaml - uncertain what these are used for ever)
1. doit deployed (generate deployed file from environment)
1. doit version (generate version file from environment)
1. doit drun (run everything below for docker-compose build, run, checks & tests)
1. doit build (builds refractr/Dockerfile Image via docker-compose commands)
1. doit check (runs nginx -t against nginx configurations served via docker-compose & generated from dev|prod-refractr.yaml above)
1. doit test (run pytest tests against docker image running via docker-compose)
1. doit drun (run everything below for docker compose build, run, checks & tests)
1. doit build (builds refractr/Dockerfile Image via docker compose commands)
1. doit check (runs nginx -t against nginx configurations served via docker compose & generated from dev|prod-refractr.yaml above)
1. doit test (run pytest tests against docker image running via docker compose)
1. doit publish (pushes image generated above to ECR)

## Infra Access
Expand Down
10 changes: 5 additions & 5 deletions docs/refractr-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ This allows the SRE to promote the commit that has been deployed to stage to pro
The **mozilla-it/refractr** repository has a **dodo.py** ([doit](https://pydoit.org/)) that defines the list of tasks that can be performed. This approach was chosen to allow the developer to run the same automation at their desk as what is run during CI. This promotes tight feedback loops for the developers and confidence that once the changes are pushed they are most likely to succeed because they have already run them locally. Below is the output of the **doit list** command. Note: this requires to be logged into the correct AWS account via **maws**.
```
~/repos/mozilla-it/version > doit list
build run docker-compose build for refractr
build run docker compose build for refractr
check run nginx -t test on refractr nginx config
deployed write refractr/deployed json file
drun run refractr container via docker-compose up -d
drun run refractr container via docker compose up -d
ingress create ingress.yaml from refractr.yml,ingress.yaml.template
nginx generate nginx.conf files from refractr.yml
publish publish docker image to aws ECR
Expand Down Expand Up @@ -94,18 +94,18 @@ This task runs the **bin/refractr ingress** command to generate the **ingress.ya
* schema

### build
This task runs **docker-compose build refractr**. The Refractr Docker image that is produced has the refractr name and is tagged with the **git describe** output. This task requires the following tasks to be completed successfully first:
This task runs **docker compose build refractr**. The Refractr Docker image that is produced has the refractr name and is tagged with the **git describe** output. This task requires the following tasks to be completed successfully first:
* deployed
* version
* nginx
* ingress

### check
This task runs **docker-compose run refractr check (nginx -t)** to validate the veracity of the provided Nginx Configuration file ( **refractr.conf** ). This task requires the following tasks to be completed successfully first:
This task runs **docker compose run refractr check (nginx -t)** to validate the veracity of the provided Nginx Configuration file ( **refractr.conf** ). This task requires the following tasks to be completed successfully first:
* build

### drun
This task runs **docker-compose up** to get a local Refractr Docker container running, required for testing. This is designed to work locally on the dev system as well in Github Actions. This task requires the following tasks to be complete successfully first:
This task runs **docker compose up** to get a local Refractr Docker container running, required for testing. This is designed to work locally on the dev system as well in Github Actions. This task requires the following tasks to be complete successfully first:
* check

### show
Expand Down
12 changes: 6 additions & 6 deletions dodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def task_refracts():

def task_build():
"""
run docker-compose build for refractr
run docker compose build for refractr
"""
return {
"task_dep": [
Expand All @@ -158,7 +158,7 @@ def task_build():
"refracts",
],
"actions": [
f"env {envs()} docker-compose build refractr",
f"env {envs()} docker compose build refractr",
],
}

Expand All @@ -172,24 +172,24 @@ def task_check():
"build",
],
"actions": [
f"env {envs()} docker-compose run refractr check",
f"env {envs()} docker compose run refractr check",
],
}


def task_drun():
"""
run refractr container via docker-compose up -d
run refractr container via docker compose up -d
"""
return {
"task_dep": [
"check",
],
"actions": [
# https://github.com/docker/compose/issues/1113#issuecomment-185466449
f"env {envs()} docker-compose rm --force refractr",
f"env {envs()} docker compose rm --force refractr",
LongRunning(
f"nohup env {envs()} docker-compose up -d --remove-orphans refractr >/dev/null &"
f"nohup env {envs()} docker compose up -d --remove-orphans refractr >/dev/null &"
),
],
}
Expand Down

0 comments on commit ea10e00

Please sign in to comment.