0% found this document useful (0 votes)
22 views3 pages

Staging Document

Uploaded by

omer_k
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views3 pages

Staging Document

Uploaded by

omer_k
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

● Locally merge all code of develop into staging

● Sync changes made in dev db with staging db


● Test it by running locally
● Push it into staging branch
● SSH server
ssh [email protected]

● Go to directory of relevant directory of staging env of api server


○ cd /directory_name
○ Locker Api server
/opt/intelparcel/smartlocker_main/cloud-api-server/staging
○ Warehouse API Server
Staging env
Directory: /opt/intelparcel/smartlocker_main/warehouse-api-server/staging
Branch: staging
Dev env
/opt/intelparcel/smartlocker_main/warehouse-api-server/dev
○ VM Api Server
● Pull the code
○ Git pull origin branch_name
● Restart the service
○ pm2 restart staging_instance_of_pm2

● Services and Ports

Dev Staging
InstanceName & Port InstanceName & Port

users_dev 4001 users_staging 8001

charge-plans_dev 4006 charge-plans_staging 8006

contracts_dev 4005 contracts_staging 8005

locations_dev 4004 locations_staging 8004

lockers_dev 4003 lockers_staging 8003

notifications_dev 4012 notifications_staging 8012

orders_dev 4002 orders_staging 8002

packages_dev 4009 packages_staging 8009

payments_dev 4008 payments_staging 8008


subscriptions_dev 4007 subscriptions_staging 8007

system_dev 4011 system_staging 8011

vm_dev 4010 vm_staging 8010

warehouses_dev 4013 warehouses_staging 8013

locker-api-server-dev 6001/tcp at 7070 Locker-api-server-staging 6000/tcp at 7080

vm_api_server_dev 4022 vm_api_server_staging 8022

Warehouse-api-server-dev 9001 Warehouse-api-server-staging 9000

HOW TO START NEW PM2 INSTANCE

● Clone single branch (e.g develop) in folder (e.g /develop)


● sudo git clone https://gitlab.com/IntelParcel/warehouse-api-server.git --branch develop
--single-branch develop
● Navigate to directory
● Run npm install
● Make changes to env file like change staging port and db name etc
● pm2 start index.js --name "was_dev"
● pm2 save

Restart instance command


● If you want to restart any instance type
pm2 restart was_dev

commands to expose port publicly

● sudo firewall-cmd --zone=public --permanent --add-port=xxxx/tcp


○ Xxxx can be your staging port eg 8090
● sudo firewall-cmd --reload

For listing all ports use this command


sudo firewall-cmd --zone=public --list-ports
Commands for renaming DB

Alter database {dbName} allow_connections false;

Select pg_terminate_backend(pid) from pg_stat_activity where datname='{dbName}';

Alter database {oldDbName} rename to {newDbName} ;

Alter database {newDbName} allow_connections true;

You might also like