Skip to content

Commit 4bbdba7

Browse files
dockerfile alternatives
1 parent 679a350 commit 4bbdba7

File tree

2 files changed

+33
-36
lines changed

2 files changed

+33
-36
lines changed

dockerfile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,15 @@ COPY ./tests /code/tests
2323
CMD ["poetry", "run", "pytest", "--headless"]
2424

2525
FROM base AS prod
26-
CMD ["poetry", "run", "gunicorn", "--workers", "1", "--bind", "0.0.0.0:8080", "app:server"]
26+
27+
28+
#=== Select Appropriate Run Command [nano dockerfile] ===
29+
30+
# For Test Server with Debug Capabilities
31+
CMD ["poetry", "run", "python", "app.py"]
32+
33+
# For Test Server with Gunicorn
34+
# CMD ["poetry", "run", "gunicorn", "--workers", "1", "--bind", "0.0.0.0:8080", "app:server"]
35+
36+
# For Production Server (needs enough RAM and CPU cores!)
37+
# CMD ["poetry", "run", "gunicorn", "--workers", "32", "--bind", "0.0.0.0:8080", "app:server"]

server_commands.txt

Lines changed: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,60 +6,46 @@ https://www.bw-cloud.org/de/bwcloud_scope/nutzen
66
Linux: ssh isas-interactive
77
Windows: Puttygen -> Putty -> username "debian"
88

9-
# Update
10-
sudo apt-get dist-upgrade
119

1210
# Install
1311
sudo apt-get update
14-
sudo apt-get install git
15-
sudo apt-get install virtualenv
16-
17-
sudo rm -r ./web-app
18-
git clone https://github.com/KIT-ISAS/web-app.git
19-
cd ./web-app
20-
virtualenv .venv
21-
source .venv/bin/activate
22-
pip install -r requirements.txt
23-
24-
# Start
25-
# Python Environment (shouldn't be used on production server, but has debug messages)
26-
nohup python app.py &
27-
28-
# Official production solution
29-
nohup gunicorn --bind 0.0.0.0:8080 --workers 32 app:server &
30-
TODO use daemon
12+
sudo apt-get dist-upgrade
3113

32-
# install docker
33-
sudo apt update
14+
# Only once: Install Docker
3415
sudo apt install -y docker.io docker-compose
3516
sudo systemctl enable --now docker
3617
sudo usermod -aG docker $USER
3718
(then exit ssh and log back in)
3819

39-
# run with docker
20+
# Only Once: Git
21+
sudo apt-get install git
22+
git clone https://github.com/KIT-ISAS/web-app.git
23+
24+
# Continue here
25+
cd ./web-app
26+
git pull
27+
28+
# Optional: Edit Dockerfile
29+
# nano dockerfile
30+
# Strg-S, Strg-X
31+
32+
# Main Command: Run with docker
4033
('docker-compose' for old docker version from debian repos, 'docker compose' for newer versions like ubuntu-latest github runner)
34+
(This command starts the app. If a previous version is already running, it also shuts it down.)
4135
docker-compose --profile default up -d --build
4236

43-
run tests:
37+
# Run tests
4438
docker compose --profile test build tests
4539
docker compose --profile test run --rm tests
4640

47-
turn server off (not needed for updating image):
41+
# Turn server off (not needed for updating image):
4842
docker compose down
4943

50-
clean up onld images:
44+
# Clean up onld images
5145
docker image prune -a -f
5246

5347
# Test in Browser
54-
http://193.196.39.120:8080
48+
Test server: http://193.196.39.84:8080
49+
Production server: http://193.196.39.120:8080
5550

56-
# Terminate old process
57-
ps
58-
pkill -9 python
59-
pkill -f gunicorn
60-
pkill -9 gunicorn
6151

62-
# Update code from GitHub
63-
ssh isas-interactive
64-
cd ./web-app
65-
git pull

0 commit comments

Comments
 (0)