USACE / cumulus-api

REST API for Meteorology Data
2 stars 2 forks source link

Cumulus API Docker Image Support #472

Open adamkorynta opened 1 month ago

adamkorynta commented 1 month ago

I would like to write integration tests for the CWMS client software against Cumulus, I see there are docker-compose files an instructions, but the main Cumulus REST API image is not deployed anywhere. While I could clone the repository and run the docker-compose within the automated build, that's a lot of overhead.

Can the Cumulus API be deployed to GitHub Packages? Or do you recommend that I write a job that checks to see if the stable branch is updated and build and push a new image in HEC's Nexus docker registry?

adamscarberry commented 1 month ago

@adamkorynta

Cumulus contains multiple services (containers) as you can see in the docker-compose file. The "api" is just one of those services. Without the database, the api will not function, without the packager the downloads are not created.

This may not be exactly what you're looking for, but we stand up the db (including flyway) and api in a github workflow when changes are made to the api: https://github.com/USACE/cumulus-api/blob/b005c4ebd29d8d9951032b1442ba6720666eecbc/.github/workflows/api-stable.yml#L23

Just the db and api -> https://github.com/USACE/cumulus-api/blob/stable/docker-compose.tests.yml test_and_report.sh runs newman (a headless postman runner)

image

Currently we avoid changes that would break the CAVI integrations, so you should be able to test against the dev and stable (preferably dev) instance.

I'm not familiar with Github packages and probably wouldn't be able to research that anytime soon.

cc @FHanbali

adamkorynta commented 1 month ago

Thanks, Adam.

I should have included the sql directory image in my request as well. I would be able to stand up this docker environment on my local dev system after cloning this repository, but I'd prefer not to be cloning extra repositories on HEC's TeamCity as part of CAVI's pipeline as that adds lots of extra overhead. We'd also need extra logic to determine when to prune/rebuild the image based on when updates are made here in this repository rather than always grabbing the latest deployed docker image.

Using testcontainers within the CAVI integration test runs, I would probably use your exact same docker-compose.tests.yml, but giving the lack of context for the api/sql directories I would have to fall back on cloning the repository.