Skip to content

Commit

Permalink
finished adding nginx
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Nov 23, 2016
1 parent 81611ab commit ab0e5e0
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 8 deletions.
2 changes: 1 addition & 1 deletion data/model_cm.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
5.600000000000000000e+01,1.200000000000000000e+01,0.000000000000000000e+00
5.700000000000000000e+01,1.200000000000000000e+01,0.000000000000000000e+00
1.600000000000000000e+01,3.700000000000000000e+01,0.000000000000000000e+00
1.000000000000000000e+00,0.000000000000000000e+00,1.300000000000000000e+01
2 changes: 1 addition & 1 deletion data/user_cm.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
5.100000000000000000e+01,1.500000000000000000e+01,2.000000000000000000e+00
5.100000000000000000e+01,1.600000000000000000e+01,2.000000000000000000e+00
1.700000000000000000e+01,3.600000000000000000e+01,0.000000000000000000e+00
0.000000000000000000e+00,1.000000000000000000e+00,1.300000000000000000e+01
2 changes: 1 addition & 1 deletion nfl.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[uwsgi]
module = wsgi
module = wsgi:nfl

master = true
processes = 5
Expand Down
12 changes: 12 additions & 0 deletions nfl.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=Job that runs the nfl app

[Service]
Environment=PATH=/home/user/nfl/nflenv/bin
WorkingDirectory=/home/ubuntu/nfl
ExecStart=/usr/local/bin/uwsgi --ini nfl.ini
User=ubuntu
Group=www-data

[Install]
WantedBy=multi-user.target
2 changes: 1 addition & 1 deletion nfl_nginx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
server {
listen 80;
server_name 127.0.0.1;
server_name _;

location / {
include uwsgi_params;
Expand Down
2 changes: 1 addition & 1 deletion src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,4 @@ def guess():
if __name__ == '__main__':

# run the app
nfl.run(host='0.0.0.0', port=80, debug=False)
nfl.run(host='0.0.0.0', port=8000, debug=False)
16 changes: 13 additions & 3 deletions src/install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# from the nfl directory
# from the nfl directory, install some resources
sudo apt-get update
sudo apt-get install python-setuptools python-dev build-essential
sudo apt-get install python-pip
Expand All @@ -14,12 +14,22 @@ sudo pip install uwsgi
sudo pip install virtualenv
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

# setup a virgual env and install what we need
virtualenv nflenv
source nflenv/bin/activate
pip install scipy scikit-learn pandas numpy requests Flask
pip install scipy scikit-learn pandas numpy requests Flask uwsgi

# you can test uwsgi and the app with:
# uwsgi --socket 0.0.0.0:8000 --protocol=http -w wsgi:nfl

deactivate

# put some files where they need to be for nginx
sudo cp nfl.conf /etc/init/.
sudo cp nfl_nginx /etc/nginx/sites-available/nfl
sudo ln -s /etc/nginx/sites-available/nfl /etc/nginx/sites-enabled
sudo ln -s /etc/nginx/sites-available/nfl /etc/nginx/sites-enabled

# start up the server
sudo cp nfl.service /etc/systemd/system/.
sudo service nfl start
sudo service nginx restart

0 comments on commit ab0e5e0

Please sign in to comment.