Developer Instructions
This page will teach you as a developer how to run our application. We go over running the app locally and running it in the production environment.
Running the Server Locally
This section shows how to get the server running on a local environment We use this primarily for testing
Open a terminal on your computer
Clone this project
cd Lucky7-Capstone
Follow the steps outlined in 'Starting the server' below
Go to http://localhost:3000
Starting the Server
npm install
npm run dev (or "npm run start" in a different terminal to have the changes incorporate live
If you did npm run start, open a new terminal
pip3 install -r requirements.txt
python3 server.py
Use 'CTRL+SHIFT+R' to reload the page after making any changes.
(Thanks https://github.com/jwkvam/minimal-flask-react)
Running the Production Server
Our production website is running on an EC2 instance This section outlines how to get the EC2 instance running and how to connect to it
Connecting to an existing instance
Once you are in the AWS console you can see the EC2 instances that exist in your account
If there are no running instances, you will need to set one up follow the 'Creating an EC2 Instance' below
If there is already an instance, ask Adam for the private key file follow the instructions 'What to do with a Key Pair'
You can now connect to the server with ssh: ssh -i "~/.ssh/CapstoneEC2.pem" ubuntu@ec2-52-55-161-116.compute-1.amazonaws.com
Starting the Production Server
After you have followed the instructions to connect to the instance you can run our server
clone this git repository if it does not yet exist
cd into the repo
git pull
follow the instructions "Starting the Server" above
When you close the terminal, the server will shut down. If you do not want this behavior, simply run the servers in a persistant window like tmux
HELP IT WON'T START! I keep an instance of the server running in the background and you cannot have two servers running at once. Simply kill the old version of the server with the command:
tmux kill-server
Creating an EC2 Instance
Follow the steps in 'Accessing the AWS Console'
In the 'Find Services' search bar, search for EC2
In the EC2 console, click the 'Running Instances' link
Click the 'Launch Instance' button at the top of the screen
Select 'Ubuntu Server'
Select t2.micro general purpose instance type
Click 'Review and Launch'
Launch the instance
Select 'Create a new key pair'
Name the key pair CapstoneEC2
Download the Private Key
Follow the below instructions 'What to do with a Private Key'
Launch the instance
Follow the steps above 'Connecting to and Existing Instance'
Once you have connected clone this repository
Run sudo apt update
Run sudo apt install npm
Run sudo apt install python3-pip
go back to the EC2 console in the AWS console in your browser
In order to connect to this server on the internet, you need to allow inbound http access on port 3000
Select your running instance
In the description tab, you should find a section named 'Security Groups'
Click the attached security group (should be something like 'launch-wizard-5'
Click edit
Add a rule
Select 'Custome TCP Rule' under type
Select 'anywhere' for the source
Type 3000 for the port range
Accessing the AWS Console
Open a web browser and navigate to https://aws.amazon.com/education/awseducate/
Click 'Login to AWS Educate'
Ask Adam for login credentials and log in
Click the hamburger menu in the upper right and click AWS Account
Click the orange 'AWS Educate Starter Account'
Click the orange 'AWS Console'
What to do with a Private Key
When you have a private key, you should put it in the folder ~/.ssh/ ex: mv ~/downloads/CapstoneEC2.pem ~/.ssh/
Don't share the private key with any one
Last updated
Was this helpful?