Portal uses GitHub action to deploy the portal on staging server.
Staging builds are configured using GitHub Actions. The file .github/workflows/deploy-staging.yml
contains the commands to deploy the portal. Production builds happen when code is pushed to master
branch.
To set up the deployment workflow, follow the steps below.
- Generate an SSH key pair.
ssh-keygen -f `staging.pem`
- It will ask you the passphrase. Keep it empty.
- Once the keys are created, update the key permissions.
chmod 400 staging.pem
- Use the commands below to get the
Public key
andPrivate key
content. These values will be used later.ssh-keygen -y -f staging.pem # to get the public key content vi staging.pem # to get the private key content
- Log in to the staging server as the root user.
- Make a new user using the following commands (works for Ubuntu/Debian):
# sudo sudo su # add user named `githubaction` without password adduser githubaction --disabled-password # create .ssh directory for the user mkdir -p /home/githubaction/.ssh # create authorized_keys and enter the public key content for the user vim /home/githubaction/.ssh/authorized_keys # grant all permissions to user chown -R githubaction:githubaction .ssh/
- Go to GitHub repo settings and switch to environment tab.
- Create a new environment named
staging
. - Add the following environment variables within that environment:
SSH_HOST
: The IP of the staging server.SSH_USERNAME
: The username of the staging server. If you have followed the user creation steps above, it would begithubaction
.SSH_PRIVATE_KEY
: Paste the private key content from step 4.SSH_BUILD_DIRECTORY
: The directory where the project is located.
For more information, check out staging-deployment.yml.
Production builds are configured using GitHub Actions. The file .github/workflows/deploy-staging.yml
contains the commands to deploy the portal. Production builds happen when new releases are published. For example v1.1.2
.
To set up the production deployment workflow, follow the same steps as staging. Make sure to update the keys and environment variables accordingly.
For more information, check out production-deployment.yml.
Pre-requisites: You need to have permission to deploy on the staging Environment. If you don't have the required access, please reach out to the Infra team for your deployment approval access
- Raise the PR against the
master
branch. - Get the PR reviewed and merged into the
master
branch. - Go to Staging Deployment GitHub action
- Approve the deployment.
Pre-requisites: You need to have permission to deploy on the staging Environment. If you don't have the required access, please reach out to the Infra team for your deployment approval access
- Raise the PR against the
release
branch. - Get the PR reviewed and merged into the
release
branch. - Go to Production Deployment GitHub action
- Approve the deployment.