Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store the Docker Compose configuration in this project #31

Merged
merged 2 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions files/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
version: "3.2"

secrets:
aws_config:
file: secrets/aws_config
scraper_config:
file: secrets/scraper.json

services:
update:
command:
- "[email protected]"
- "[email protected]"
- "--html=body.html"
- "--json=code.json"
- "--log-level=info"
- "[email protected]"
- "--subject=\"Latest code.gov JSON file\""
- "--text=body.txt"
- "[email protected]"
environment:
- AWS_CONFIG_FILE=/run/secrets/aws_config
- AWS_PROFILE=default
image: dhsncats/code-gov-update:0.0.2
secrets:
- source: aws_config
target: aws_config
- source: scraper_config
target: scraper_config.json
11 changes: 7 additions & 4 deletions molecule/default/tests/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ def test_packages(host, directory):
assert oct(host.file(directory["path"]).mode) == directory["mode"]


@pytest.mark.parametrize("f", ["/var/cyhy/code-gov-update/docker-compose.yml"])
def test_command(host, f):
@pytest.mark.parametrize(
"file", [{"path": "/var/cyhy/code-gov-update/docker-compose.yml", "mode": "0o644"}]
)
def test_command(host, file):
"""Test that appropriate files exist."""
assert host.file(f).exists
assert host.file(f).is_file
assert host.file(file["path"]).exists
assert host.file(file["path"]).is_file
assert oct(host.file(file["path"]).mode) == file["mode"]
10 changes: 4 additions & 6 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
path: /var/cyhy/code-gov-update
state: directory

- name: Download and untar the code-gov-update tarball
ansible.builtin.unarchive:
- name: Install the Docker Compose configuration
ansible.builtin.copy:
dest: /var/cyhy/code-gov-update
extra_opts:
- "--strip-components=1"
remote_src: yes
src: https://api.github.com/repos/cisagov/code-gov-update/tarball/develop
mode: 0644
src: docker-compose.yml