Deploying Operational Tools to Private Staging

Since currently we don't have Jenkins pipeline and playbook to deploy this things, we will stick to do it manually by request.

Step 1: Change local NODE_ENV value to staging.

NODE_ENV=staging

Step 2: Build and archive.

yarn run build
tar -czf payod-fe.tar.gz .next/ config/ static/ node_modules/ package.json

Step 3: Upload the archive.
There is a ~/payod-installer directory in the server. Using your shared staging key, upload the archive to our private staging machine:

scp -i <path to shared staging key> payod-fe.tar.gz ubuntu@pay-test-stg-01.test.tvlk.cloud:/home/ubuntu/payod-installer

It's possible that this operation failed because of already existing files. If this happens, do this in our private staging machine:

pm2 delete all
cd ~/payod-installer
rm -rf payod-web # if exists
rm -rf payod-fe # if exists
rm *.tar.gz

Step 4: Extract and run.
Assuming that the archive is ready in the mentioned directory, do the following steps to run payod-fe in our private staging machine.

cd ~/payod-installer
mkdir payod-fe
tar -C payod-fe -zxvf payod-fe.tar.gz
cd payod-fe
NODE_ENV=staging pm2 start ./node_modules/soya-next-server/index.js

Step 5: Check and recheck.
Ensure that the process is running and no problem is occurred during application start.

# See currently running pm2 process.
pm2 list

# See last logs from our application.
pm2 logs

Try to login to the following address and ensure that we can login successfully and the API call address is right:
https://pay-payod-fe-stg.test.tvlk.cloud/