PESolut / leaf-me

new and final mono repo for the leaf me system: Leaf-Me is a full-stack Uber Eats-style delivery platform designed for dispensaries. The app streamlines the process of placing, preparing, and delivering orders through multiple role-based interfaces
0 stars 0 forks source link

setup pipeline for backend #3

Open PESolut opened 1 month ago

PESolut commented 1 month ago

setup CI/CD pipeline for Leaf-Me Backend

Image

Implement a robust CI/CD pipeline using GitHub Actions to automate the build, test, and deployment processes for the Leaf-Me backend application. This pipeline will streamline our development workflow, ensure code quality, and facilitate efficient deployments.

Workflow Overview

1. Source Control Management (SCM)

2. Continuous Integration (CI)

3. Continuous Deployment (CD)

Technologies to be Used

Acceptance Criteria

Benefits

Additional Notes


PESolut commented 1 month ago

completed tasks:

1) create a backend workflow

2) Configure the workflow to trigger on pushes to dev

3) Set up a job to install dependencies and run tests.

blocker

time to test to see if changes run the workflow....

edit:

it seems that we forgot to change our biild from react build to just a node build and we dont have any test script so lets just create a basic test suite and correct our build for our env.

PESolut commented 1 month ago

blocker: Update Backend CI/CD Pipeline to fix our basic pipeline

  1. Update build step

    • [x] Replace React build with Node.js build
    • [x] Update the npm run build command to match backend build process
  2. Add basic test suite

    • [x] Create a new test file (e.g., backend.test.js)
    • [ ] Write simple test cases for core backend functionality
    • [x] Update package.json to include a test script
  3. Update CI/CD workflow

    • [x] Modify .github/workflows/backend-ci-cd.yml
    • [x] Update the build step to use the correct build command
    • [x] Ensure the test step is correctly configured
  4. Test and verify

    • [x] Push changes to dev branch
    • [x] Monitor CI/CD pipeline execution
    • [x] Verify successful build and test runs
  5. Documentation

    • [ ] Update README or relevant documentation with new build and test instructions

PESolut commented 1 month ago

task one completed ,testing:

needed to remove the test script within our package.json...

new blocker: push to main;

output from github actions fail:

Switched to a new branch 'main'
branch 'main' set up to track 'origin/main'.
Updating b33a916..55ac857
Fast-forward
 backend/app.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
remote: Permission to PESolut/leaf-me.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/PESolut/leaf-me/': The requested URL returned error: 403

solution:

changed workflow permissions. https://github.com/PESolut/leaf-me/settings/actions

testing...

PESolut commented 1 month ago

task 3: Implement a deployment job that runs only on pushes to main

This will require three prerequisite task done before I can start to implement it

BLOCKERS AND ACTION ITEMS

1) install docker onto the backends ec2 instance 2) create a dockerhub repo for leafme's backend 3) in the Leafme repo share all the secrets ( reference portfolio project page for the needed secrets ) including but not limited to: GitHub PAT, backend address, leaf-me-masterkey.pem, and three other values ( that I can't remember or reference atm ) 4) all above task items that has not been completed should be completed before we finalize the pipeline and start development on the frontend

PESolut commented 1 month ago

install docker onto the backends ec2 instance

As part of our CI/CD pipeline setup, we need to install Docker on our backend EC2 instance. This will allow us to deploy and run our containerized backend application.

Tasks:

  1. Connect to the backend EC2 instance via SSH.
  2. Update the package manager.
  3. Install Docker.
  4. Start Docker service.
  5. Enable Docker to start on boot.
  6. Document the Docker version and any specific configuration in our project documentation.

Acceptance Criteria:

PESolut commented 1 month ago

i created a new workflow for Deploying, instlalled docker onto our backend and created the dockerhub repo. Now to add necc. secrets to our github repo. (DOCKERHUB_USER, DOCKERHUB_TOKEN, EC2_SSH_PRIVATE_KEY, EC2_HOST, and EC2_USER)

PESolut commented 1 month ago

test pushing to test deployment

PESolut commented 1 month ago

success with no test cases