Skip to content

Latest commit

 

History

History
93 lines (70 loc) · 1.83 KB

DEPLOY.md

File metadata and controls

93 lines (70 loc) · 1.83 KB

Proccess to follow while deploy to new EC2 Instance

  1. Start new EC-3 instance and downlod the key file in your computer
  2. Select your instance from deshboard and click security group
  3. Add inbound rule to allow All Traffic(ipv4)
  4. Open your terminal and navigate where you have downloaded your pem file and run
ssh -i your_file_name.pem ec2-user@<-- YOUR INSTANCE PUBLIC IP -->
# Example
ssh -i Ec_2_secret.pem ec2-user@3.110.130.198
# If it throws error try running
chmod 400 Eather_Server_3.pem

By now you should have connection with your instance

Configure your instance

  1. Install git
sudo yum install git -y
  1. Clone your repo
git clone https://github.com/----YOUR_REPO_LOCATION---.git
  1. Install NVM and configure (run the commands)
# Install NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
# Export nvm path
. ~/.nvm/nvm.sh
  1. Install Node (for avoiding node issues make sure you install node version that you used in local development )
 nvm install v16.13.0
  1. Now(if you have) you need to add your .env or secret files (that are need to run the server)
touch .env
# open using vim
vim .env
# vim insert mode
i
# copy and paste from your local file in terminal
:x
# vim save and exit
  1. Start your server
# Install packages 
yarn install
# Start your server
yarn (or) npm start

Firewall configuration (for http access)

  1. Install package
# System config
sudo yum install system-config-firewall
# httpd
sudo yum install httpd
# start the service
sudo service httpd start

Common Errors

  1. Reached heap limit Allocation failed - JavaScript heap out of memory
export NODE_OPTIONS="--max-old-space-size=8192"
  1. Access the server on http port
http://3.110.130.198:4000/graphql