Skip to content

Commit 1e8421a

Browse files
committed
Update config
1 parent fb48e68 commit 1e8421a

File tree

5 files changed

+75
-90
lines changed

5 files changed

+75
-90
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ _A logical, reasonably standardized, but flexible project structure for doing an
1414

1515
cookiecutter https://github.com/sampathweb/cc-iris-api
1616

17+
1718
### Credits:
1819
------
1920

cookiecutter.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"project_name": "project_name",
2+
"project_name": "iris-api",
33
"repo_name": "{{ cookiecutter.project_name|replace(' ', '_') }}",
44
"author_name": "Your name (or your organization/company/team)",
55
"description": "A short description of the project.",

{{cookiecutter.repo_name}}/README.md

Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Sample IRIS API Application
22

3-
Build IRIS Machine Learning Model using Scikit-Learn and deploy using Tornado Web Framework on AWS.
3+
Build IRIS Machine Learning Model using Scikit-Learn and deploy using Tornado Web Framework.
44

55
## Setup Environment on Local Machine
66

@@ -40,94 +40,8 @@ Open new terminal navigate to the new folder `iris-api`. Start `jupyter noteboo
4040
4141
Api works!
4242
43-
### Push code to your own git repo. (Optional - We will not do in tutorial)
4443
4544
46-
```
47-
# These git Steps are Optional for Pydata Tutorial.
48-
git init
49-
git add --all
50-
git commit -m "first commit"
51-
git remote add origin https://github.com/<your github username>/<remote repo name>.git
52-
git push --set-upstream origin master
53-
54-
```
55-
56-
57-
## Deploy Steps for AWS Ubuntu 14.04 LTS EC2 Instance
58-
59-
### Login to AWS Instance:
60-
61-
`ssh -i <your AWS Pem key file> ubuntu@<aws ip>`
62-
63-
64-
### Install Python / Git
65-
66-
```
67-
sudo apt-get update
68-
sudo apt-get upgrade
69-
70-
# Install GIT
71-
sudo apt-get install git
72-
73-
# Install Anaconda (Miniconda)
74-
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
75-
76-
bash Miniconda3-latest-Linux-x86_64.sh
77-
78-
# To update the path (Make sure you said Yes when it asked to update path in the Miniconda install steps)
79-
source ~/.bashrc
80-
```
81-
82-
### Download App Source Code:
83-
84-
```
85-
git clone https://github.com/sampathweb/iris-api.git
86-
87-
88-
cd iris-api-app
89-
python env/create_env.py
90-
source activate env/venv
91-
python env/install_packages.py
92-
93-
python ml_src/build_model.py
94-
python run.py (Confirm that App is running)
95-
96-
97-
sudo apt-get install supervisor
98-
sudo vi /etc/supervisor/conf.d/iris-api.conf
99-
<press i insert mode>
100-
101-
[program:iris-api]
102-
autorestart = true
103-
command = /home/ubuntu/iris-api/env/venv/bin/python /home/ubuntu/iris-api/run.py --debug=False --port=80
104-
numprocs = 2
105-
startsecs = 10
106-
stderr_logfile = /var/log/supervisor/iris-api.log
107-
stdout_logfile = /var/log/supervisor/iris-api.log
108-
# stderr_logfile = syslog
109-
# stdout_logfile = syslog
110-
environment = PYTHONPATH="/home/ubuntu/iris-api/env/bin/"
111-
112-
<escape :wq>
113-
114-
sudo supervisorctl reload
115-
116-
<Your APP is live now>
117-
```
118-
119-
### Test the App
120-
121-
1. Open Browser: `http://<AWS IP>` (App is Live!)
122-
123-
2. Test in Command Line (Optional):
124-
125-
```
126-
curl -i http://<aws ip address>/api/iris/predict -X POST -d '{ "sepal_length": 2, "sepal_width": 5, "petal_length": 3, "petal_width": 4}'
127-
```
128-
129-
Congratulations you have deployed your App
130-
13145
## Credits:
13246
13347
Template from https://github.com/sampathweb/cc-iris-api

{{cookiecutter.repo_name}}/app/settings.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# !/usr/bin/env python
2-
# -*- coding: utf-8 -*-
31
"""
42
Appliction configuration settings
53
"""
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
## Deploy Steps for AWS Ubuntu 14.04 LTS EC2 Instance
2+
3+
### Login to AWS Instance:
4+
5+
`ssh -i <your AWS Pem key file> ubuntu@<aws ip>`
6+
7+
8+
### Install Python / Git
9+
10+
```
11+
sudo apt-get update
12+
sudo apt-get upgrade
13+
14+
# Install GIT
15+
sudo apt-get install git
16+
17+
# Install Anaconda (Miniconda)
18+
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
19+
20+
bash Miniconda3-latest-Linux-x86_64.sh
21+
22+
# To update the path (Make sure you said Yes when it asked to update path in the Miniconda install steps)
23+
source ~/.bashrc
24+
```
25+
26+
### Download App Source Code:
27+
28+
```
29+
git clone https://github.com/sampathweb/iris-api.git
30+
31+
32+
cd iris-api-app
33+
python env/create_env.py
34+
source activate env/venv
35+
python env/install_packages.py
36+
37+
python ml_src/build_model.py
38+
python run.py (Confirm that App is running)
39+
40+
41+
sudo apt-get install supervisor
42+
sudo vi /etc/supervisor/conf.d/iris-api.conf
43+
<press i insert mode>
44+
45+
[program:iris-api]
46+
autorestart = true
47+
command = /home/ubuntu/iris-api/env/venv/bin/python /home/ubuntu/iris-api/run.py --debug=False --port=80
48+
numprocs = 1
49+
startsecs = 10
50+
stderr_logfile = /var/log/supervisor/iris-api.log
51+
stdout_logfile = /var/log/supervisor/iris-api.log
52+
environment = PYTHONPATH="/home/ubuntu/iris-api/env/bin/"
53+
54+
<escape :wq>
55+
56+
sudo supervisorctl reload
57+
58+
<Your APP is live now>
59+
```
60+
61+
### Test the App
62+
63+
1. Open Browser: `http://<AWS IP>` (App is Live!)
64+
65+
2. Test in Command Line (Optional):
66+
67+
```
68+
curl -i http://<aws ip address>/api/iris/predict -X POST -d '{ "sepal_length": 2, "sepal_width": 5, "petal_length": 3, "petal_width": 4}'
69+
```
70+
71+
Congratulations you have deployed your App
72+

0 commit comments

Comments
 (0)