COJ
This project is to build a web app that people can add their coding problems and edit the code on the same page just like google doc.
Click here to see the demo.
You can share the problem url with others so that everyone who has the link can editor on the same page.
Content
- Setup AWS EC2 ubuntu 16.04
- Config Linux environment
- Write a shell script to automate a build and deployment
1. Setup AWS EC2 ubuntu 16.04
Read AWS EC2 linux instance carefully!!!
- figure out the def. of instance, IAM, security group etc
- read the Doc recursively until you understanding depends
Some key points
- inbound rules security group
- open 2 IAM for backup
- open 2 Linux instance for backup
2. Config Linux environment
- AWS Linux 16.04
- (optioinal)Local Linux
3. Write a shell script to automate a build and deployment
shell script
If not familar with shell, read ref just 1~2 hour, making you life easy.
Then Try to writing or imitating on some business shell, like /bin under JetBrain
Get repo from github
git clone https://github.com/mwangxx0129/COJ.git
Run on background
$ [sudo] npm install forever -g
forever start app.js
Set up environment on Linux 16.04
How do I get set up?
update
sudo apt-get update
Install Terminator
sudo apt-get install terminator
Install NodeJs: (root)
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs
Install Nodemon
sudo npm install -g nodemon
Install git
sudo apt-get install git
Install angular/cli
sudo npm install -g @angular/cli
Install Redis
wget http://download.redis.io/releases/redis-3.2.6.tar.gz
tar xzf redis-3.2.6.tar.gz
cd redis-3.2.6
make
sudo make install
cd utils
sudo ./install_server.sh
Install python 2.7: This is installed already in Ubuntu
Install pip:
(sudo apt-get update)
sudo apt install python-pip
sudo pip install Flask
Install Docker:
curl -fsSL https://get.docker.com/ | sh
Setup docker permission:
sudo usermod -aG docker $(whoami)
(you need to logout and login again after set permission)
To start docker when the system boots: sudo systemctl enable docker
Install Nginx
(For ubuntu 16.04) Add following two lines into /etc/apt/sources.list
deb http://nginx.org/packages/ubuntu/ xenial nginx
deb-src http://nginx.org/packages/ubuntu/ xenial nginx
Then run:
sudo apt-get update
sudo apt-get install nginx
Trouble shooting
redis
sudo apt-get install make
sudo apt-get install build-essential
TODO
-
deploy again on both aws and local
-
add config for ip port
-
search bar on UI
-
count of session on UI
网友评论