-
Notifications
You must be signed in to change notification settings - Fork 6
Deployment
Sam Ping edited this page Apr 21, 2021
·
3 revisions
Sledge is currently in the process of being deployed on AWS EC2. As of now, the dev server is hosted on a t2.micro instance with 8GB of storage space.
- Create EC2 instance and connect to it. Keep the .pem key somewhere safe!
- Create instance:
- OS: Ubuntu 20.04 LTS x64
- Instance Type: t2.micro (vCPUs: 1, Memory: 1GiB)
- Storage Space: 8GB SSD
- Tags (optional):
- Name: sledge-dev/prod
- env: dev/prod
- Inbound rules:
- Allow HTTP and HTTPS. Expose port 5000 (which the server uses).
- Create instance:
- Update and install dependencies:
sudo apt update # updates repositories
sudo apt install git # installs Git
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs # installs NodeJS and NPM
- By now, you should have Git, NodeJS, and NPM installed.
- Now you can install PM2 with
npm i pm2 -g
. This will be used later in deploying the Express server. If you get an error, try running the same command usingsudo
. - Install MongoDB (instructions taken from https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/):
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add - # should return OK
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org # installs MongoDB
- Now MongoDB should be installed. To start the service, run
sudo systemctl start mongod
.
- Now deploy the server:
- Clone the Sledge repository with
git clone https://github.com/HackRU/sledge.git # clones over HTTPS, may have to be updated
cd sledge/server # go into the server directory
npm i # installs Sledge server dependencies
- Now if you run
node server.js
, you'll see that the server is up and running. However, if you close the terminal, the server will also stop running. Thus, we will be using PM2 (which we installed in the dependencies section) to keep the server running. - If you haven't already, close the current Node.js process with CTRL-C. Now run the Express server using PM2 by running
pm2 start server.js
, and you're good to go!
- Clone the Sledge repository with
Welcome
Using Sledge
Development
Archive