Skip to content

Commit 2fe9e75

Browse files
committed
moving to production server
1 parent 4fcf5d2 commit 2fe9e75

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ Install Postgres and configure `SQLALCHEMY_DATABASE_URI` in `core/settings.py`
88

99
```
1010
pip3 install -r requirements.txt
11-
python3 migrate.py // once to create database entries required
12-
python3 app.py
11+
python3 migrate.py # Run once to create database entries required
12+
python3 app.py # Testing Environment
13+
gunicorn -b 0.0.0.0:9090 app:app # Production Environment
1314
```
1415

1516
This will run NodeJsScan on `http://0.0.0.0:9090`

migrate.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,7 @@ def __repr__(self):
5555
"""repr"""
5656
return '<Results %r>' % self.scan_hash
5757

58-
Base.metadata.create_all(bind=engine)
59-
print("[INFO] Table entries created!")
58+
59+
if __name__ == '__main__':
60+
Base.metadata.create_all(bind=engine)
61+
print("[INFO] Table entries created!")

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ jinja2==2.10
33
jsbeautifier==1.7.5
44
psycopg2-binary==2.7.5
55
sqlalchemy==1.2.10
6+
gunicorn==19.9.0

start.sh

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ setsid docker-entrypoint.sh postgres >/dev/fd/1 2>&1 < /dev/fd/1 &
33

44
sleep 10
55
python3 migrate.py
6-
python3 app.py
6+
gunicorn -b 0.0.0.0:9090 app:app

0 commit comments

Comments
 (0)