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

chore(CI): Add Github actions workflow for production deployment with manual approval #732

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

YeagerAI-Bulat
Copy link
Collaborator

@YeagerAI-Bulat YeagerAI-Bulat commented Dec 11, 2024

Fixes #731

What

  • Added a GitHub Actions workflow for deploying to production using Ansible on GCP VM: https://github.com/yeagerai/genlayer-simulator-infra/blob/main/.github/workflows/deploy-prod.yml
  • Implemented a manual approval step with approver validation.
  • Configured the workflow to utilize secrets for sensitive operations (e.g., SSH keys, SSL certificates, and API tokens).
  • Ensured concurrency control to prevent overlapping deployments.
  • Cleaned up sensitive data post-deployment for security.

Why

  • To enable controlled and secure production deployments with a manual review step to mitigate risks.
  • To improve the deployment process by automating setup and cleanup tasks.
  • To ensure proper usage of secrets for security-sensitive operations.

Testing done

  • Validated workflow syntax using the GitHub Actions linter.
  • Confirmed the presence of all required secrets in the repository.
  • Manually tested Ansible playbook execution in a development and staging environment.

Decisions made

  • Decided to include a manual approval step to enforce deployment reviews.
  • Used a confirmation input (I confirm) in the workflow to prevent accidental deployments.
  • Chose to clean up sensitive files (e.g., credentials and certificates) post-deployment for enhanced security.

Checks

  • I have tested this code
  • I have reviewed my own PR
  • I have created an issue for this PR
  • I have set a descriptive PR title compliant with conventional commits

Reviewing tips

  • Review the secrets usage carefully to ensure no sensitive information is exposed.
  • Verify the manual approval mechanism for usability and security.
  • Check that the Ansible playbook handles production deployment correctly.

User facing release notes

  • Added a new production deployment workflow with a manual approval process.
  • Ensures secure handling of deployment credentials, SSH keys, and SSL certificates.
  • Prevents overlapping deployments with concurrency control.

@YeagerAI-Bulat YeagerAI-Bulat linked an issue Dec 11, 2024 that may be closed by this pull request
@YeagerAI-Bulat YeagerAI-Bulat self-assigned this Dec 11, 2024
@YeagerAI-Bulat YeagerAI-Bulat changed the title CI chore(CI): Add Github actions workflow for production deployment with manual approval Dec 11, 2024
@YeagerAI-Bulat YeagerAI-Bulat marked this pull request as ready for review December 11, 2024 06:40
Copy link
Contributor

@AgustinRamiroDiaz AgustinRamiroDiaz left a comment

Choose a reason for hiding this comment

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

@YeagerAI-Bulat Have you tested the curl request? I'm searching docs for this and I've found:

And none of them have the same syntax as the command you've pasted

Nit: could we use the gh cli as in https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#providing-inputs? I think it's easier to understand than curl commands

gh workflow run run-tests.yml -f logLevel=warning -f tags=false -f environment=staging

-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.DEPLOYMENT_PAT }}" \
-H "Content-Type: application/json" \
https://api.github.com/repos/yeagerai/genlayer-studio/dispatches \
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this point to the infra repo? like

Suggested change
https://api.github.com/repos/yeagerai/genlayer-studio/dispatches \
https://api.github.com/repos/yeagerai/genlayer-simulator-infra/dispatches \

@AgustinRamiroDiaz
Copy link
Contributor

@YeagerAI-Bulat do we have a staging environment to also add the trigger for it?

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.

Add GitHub actions workflow for production deployment
2 participants