Skip to content

Latest commit

 

History

History
109 lines (72 loc) · 3.56 KB

INSTALLATION_AWS.md

File metadata and controls

109 lines (72 loc) · 3.56 KB

How to install the Open Event Web App Generator on AWS

Phase 1

This phase involves creating the EC2 instance which will hold your app.

  • Go to Amazon Web Services console and select EC2.

  • Click on the create button to create an instance. Select Ubuntu 14 x64 as the linux distribution.

  • Follow the other steps till you reach the 6th step which is about configuring Security groups. There add a rule to accept all HTTP connections. See the screenshot on how it should look like.

ec2_security_grp

  • Click Launch in the 7th step and you will be presented with a dialog to create a key. Create a new key and give it a name. In this tutorial, I will use the name 'mykey'. Then download the key. Keep it safe because if you lose it, you will lose access to the server.

ec2_create_key

  • Once the instance is created, you will be forwarded to the instances list. Select the newly created instance and click on Connect button. You will see a dialog with instructions on how to connect to it using ssh.

connect_ssh_ec2

  • In the above case, the command is as follows. So open the terminal in your Downloads directory (which has the downloaded key file) and then run the command you got from the previous step. In my case, it was -
chmod 400 mykey.pem
ssh -i "mykey.pem" ubuntu@ec2-52-41-207-116.us-west-2.compute.amazonaws.com
  • You will be into the server's shell. You will notice a text message stating to install the language pack. So run the following command.
sudo apt-get install language-pack-en

Phase 2

Now we need to install the requirements needed to run it on the server.

First, update and upgrade all packages to ensure we are up-to-date on everything

sudo apt-get update
sudo apt-get upgrade

Next we need to install Nodejs to our system. For this project, we recommend you use Nodejs v6.x

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - 
sudo apt-get install -y nodejs

Also, additionally, install build tools

sudo apt-get install -y build-essential

Phase 3

Now you should clone this repository to a folder

git clone https://github.com/fossasia/open-event-webapp -b development

(Leave use branch master for stable release, development for latest source)

After that we need to install the dependencies

cd open-event-webapp
npm install 

Run the app

npm run start

or

npm run server.generator

The app will be running on http://localhost:5000

If you want the app to run on port 80, use the following command instead

sudo PORT=80 npm run start

Note

You'd like to keep the server running persistently, without having to keep ssh connection open. For that case,

Next install PM2 (a package manager for Node)

sudo npm install -g pm2

Run the app using pm start npm -- start

To make the server automatically run on startup, use this command pm2 startup systemd

For a detailed tutorial on how to set up Node.js Apps for production usage, checkout https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04