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

Issues/111: GH Action CICD #113

Merged
merged 16 commits into from
Jun 12, 2024
Merged

Conversation

frankinspace
Copy link
Contributor

@frankinspace frankinspace commented May 3, 2024

I think I've got this working through deployment now in my fork. Here is an example run: https://github.com/frankinspace/maap-api-nasa/actions/runs/9393328409

The deploy step is failing at the moment because I don't have the self-hosted runner setup in my fork. So once we merge this I may still need to open up a follow-up PR for a bit more troubleshooting.

Work completed:

  • Convert to poetry based project for better dependency management
  • Migrate to docker multi-stage build to reduce image size and decrease build time
  • Updates to readme file
  • Build docker image and tag it with 3 tags: the semver, the deploy environment (dit, uat, or ops), and latest
  • Push docker image to both ghcr and gitlab container registrt
  • Deployment via docker-compose

@frankinspace frankinspace changed the base branch from main to develop May 8, 2024 23:34
deploy:
name: Deploy
needs: [ build, docker ]
# runs-on: [${{ needs.build.outputs.deploy_env }}, self-hosted]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once merged to the proper repo this will be un-commented so I can test the self-hosted runner deployment

@frankinspace frankinspace marked this pull request as ready for review June 6, 2024 01:12
@frankinspace frankinspace requested review from bsatoriu, grallewellyn, sujen1412, anilnatha and a team and removed request for anilnatha, sujen1412, bsatoriu and grallewellyn June 6, 2024 01:12
@sujen1412
Copy link
Collaborator

Were you able to verify that the new docker container (with poetry) works as expected locally ?
For example you can provide the values for the settings and start up locally to test to make sure the basic GET endpoints are working.

@sujen1412
Copy link
Collaborator

Also, will the deploy step run on every push to a branch ?
We would want the deploy step (which runs on the self-hosted runner) to only run on merge to devel or main.

@frankinspace
Copy link
Contributor Author

frankinspace commented Jun 6, 2024

@sujen1412

Were you able to verify that the new docker container (with poetry) works as expected locally ?
For example you can provide the values for the settings and start up locally to test to make sure the basic GET endpoints are working.

I was able to start the web service and bring up the swagger ui. I also verified it connected to my local db (which comes from the settings). But I don't have any local data or anything to verify application functionality; I would need some help to walk through that process.

Also, will the deploy step run on every push to a branch ? We would want the deploy step (which runs on the self-hosted runner) to only run on merge to devel or main.

Deploy will run automatically on every push to:

  • develop (target DIT env)
  • release/* (target UAT env)
  • main (targe OPS env)

Build will run on every push to any tracked branch.

Deploy can be manually triggered via workflow dispatch where you select the branch to deploy and which environment to deploy to. This allows a developer to deploy a feature branch they are working on to DIT for example.

Additionally, there are restrictions setup in the repo settings which limit what branches can be deployed to which environment. Currently, DIT has no branch restrictions, UAT will only accept builds from develop, release/* or main, ops only main and must be approved.

@frankinspace frankinspace merged commit 2e2d01d into MAAP-Project:develop Jun 12, 2024
@frankinspace frankinspace mentioned this pull request Jun 13, 2024
@frankinspace frankinspace linked an issue Jun 19, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Develop github actions to deploy api to different environments
3 participants