ScholarX deployment and setting up CI/CD

Previously we tried using an AWS EC2 instance to deploy the ScholarX backend and frontend, but due to the CPU overloading issue we migrated it to heroku to deploy as a single app until we come up with a proper solution.

So what we have now is a single heroku instance integrated with github to deploy the ScholarX backend(which is with frontend static resources). It deploys automatically when a Pull Request to backend is merged. But everytime when the frontend updates, we have to sent a pull request to the backend with the updated static resources. To prevent this, we have to configure CI/CD to automatically build the frontend and deploy the backend with static files.

What I have done:
I have already updated the travis CI configuration to do the above task when a backend pr is merged and tested it in my private repository.

Next Steps:
Configuring the frontend to trigger a build in backend when a frontend pr is merged.

3 Likes

In the frontend, I updated the travis configuration to use a script (https://github.com/plume-lib/trigger-travis) to trigger a build in backend. So it calls the travis API to trigger the backend build.

The backend travis configuration is updated to do the following things:
Get a pull from frontend → Build the frontend → Copy the static files to the backend resources → Delete the remaining frontend files → Build the backend → Deploy to heroku

Sent both PRs.
Frontend PR: https://github.com/sef-global/scholarx-frontend/pull/129 (Merged)
Backend PR: https://github.com/sef-global/scholarx/pull/141

PS: For heroku deployment, we should add the TRAVIS_ACCESS_TOKEN (api key) to the backend travis configurations. It can be taken by using the Travis CLI. Already added that.

1 Like

There’s a permission problem with the TRAVIS_ACCESS_TOKEN. I’ll fix to soon

1 Like

Fixed it. I had used the wrong key for the TRAVIS_ACCESS_TOKEN.

In here the TRAVIS_ACCESS_TOKEN (which is used to authenticate the travis api) is added to the frontend, and the API_KEY (which is used to authenticate Heroku deployment) is added to the backend

TRAVIS_ACCESS_TOKEN - taken using Travis CLI
API_KEY - taken from heroku dashboard

2 Likes

It was suggested to use the master branch for the deployments in scholarx backend and frontend. So is it ok if I just create a pull request to master branch from deploy branch? (Since there’re no conflicts)
@YohanAvishke @Gravewalker
Draft PR link: https://github.com/sef-global/scholarx/pull/147

3 Likes

After releasing the minor version, the deployment fails because we haven’t provided the Gmail app authentication details. Can someone log into heroku and add the app password and email.
@anjisvj @Gravewalker @Gimhan_minion