Skip to content

Commit 5fa611d

Browse files
committed
add coreos deployment
1 parent 48ee2fb commit 5fa611d

32 files changed

+499
-65
lines changed

.env.dev

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ IMAGE_TAG=dev
44

55
# backend config for local development (also: see backend/dps_training_k/.env)
66
DEBUG=True
7-
SECRET_KEY=abcdefg
7+
SECRET_KEY=replace-me-with-a-long-random-secret
88
ALLOWED_HOSTS=*,
99
INTERNAL_IPS=127.0.0.1
10-
DATABASE_URL=postgres://dps:dps@K-dPS-postgres:5432/dps
10+
DATABASE_URL=postgres://dps:replace-me-with-a-db-password@K-dPS-postgres:5432/dps
1111
REDIS_URL=redis://K-dPS-redis:6379
1212
CACHE_URL=redis://K-dPS-redis:6379
1313
CHANNEL_REDIS=True
1414

1515
POSTGRES_DB=dps
1616
POSTGRES_USER=dps
17-
POSTGRES_PASSWORD=dps
17+
POSTGRES_PASSWORD=replace-me-with-a-db-password

.env.prod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ IMAGE_TAG=latest
44

55
# backend config for production
66
DEBUG=False
7-
SECRET_KEY=0Lf6rayQccUBK7GxM32HZCTj995bFij3
7+
SECRET_KEY=replace-me-with-a-long-random-secret
88
ALLOWED_HOSTS=*,
99
INTERNAL_IPS=127.0.0.1
10-
DATABASE_URL=postgres://dps:ozuCk0rrF6nzkzcR1TQMR93m3iYUzMBG@K-dPS-postgres:5432/dps
10+
DATABASE_URL=postgres://dps:replace-me-with-a-db-password@K-dPS-postgres:5432/dps
1111
REDIS_URL=redis://K-dPS-redis:6379
1212
CACHE_URL=redis://K-dPS-redis:6379
1313
CHANNEL_REDIS=True
1414

1515
POSTGRES_DB=dps
1616
POSTGRES_USER=dps
17-
POSTGRES_PASSWORD=ozuCk0rrF6nzkzcR1TQMR93m3iYUzMBG
17+
POSTGRES_PASSWORD=replace-me-with-a-db-password

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ backend/.vscode/settings.json
33
.idea/
44
.vscode/launch.json
55
backend/dps_training_k/restart_backend.sh
6+
deployment/coreos/secrets/

backend/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ docker compose --env-file .env.<prod/dev> up --build
4646
Optionally, to access the database, create a superuser account:
4747

4848
```bash
49-
docker exec -it K-dPS-django python manage.py createsuperuser
49+
docker exec -it kdps-django python manage.py createsuperuser
5050
```
5151

5252
Afterwards, you can log into the admin interface at e.g. `http://localhost:80/admin/`<br/>
@@ -58,25 +58,25 @@ Note: this is only available if DEBUG = true, which is the case in the dev envir
5858

5959
When changing models, you need to create migrations in order to update existing databases.
6060

61-
- Create new migrations: `docker exec -it K-dPS-django python manage.py makemigrations`
62-
- Optionally, if you have conflicting migrations: `docker exec -it K-dPS-django python manage.py migrate --merge`
63-
- Execute these migrations to update the database: `docker exec -it K-dPS-django python manage.py migrate`
61+
- Create new migrations: `docker exec -it kdps-django python manage.py makemigrations`
62+
- Optionally, if you have conflicting migrations: `docker exec -it kdps-django python manage.py migrate --merge`
63+
- Execute these migrations to update the database: `docker exec -it kdps-django python manage.py migrate`
6464

6565
### Running Tests
6666

6767
- start docker container with docker compose(see Running the project using Docker)
6868
- wait until Application Startup is Completed
69-
- run: `docker exec -it K-dPS-django python manage.py test`
69+
- run: `docker exec -it kdps-django python manage.py test`
7070

7171
### Working with Fixtures
7272

7373
Example given for creating the "patient_states.json" fixture containing all patientstates, statetransitions, subconditions and logicnodes.
7474

75-
- clear database of the wanted models via e.g. `docker exec -it K-dPS-django python manage.py flush`
76-
- fill database with data you want to export as fixture: `docker exec -it K-dPS-django python manage.py import_patient_states`
75+
- clear database of the wanted models via e.g. `docker exec -it kdps-django python manage.py flush`
76+
- fill database with data you want to export as fixture: `docker exec -it kdps-django python manage.py import_patient_states`
7777
- create fixture:
78-
- `docker exec -it K-dPS-django bash`
78+
- `docker exec -it kdps-django bash`
7979
- `export PYTHONIOENCODING=utf8`
8080
- `python manage.py dumpdata template.patientstate template.statetransition template.subcondition template.logicnode >
8181
data/fixtures/patient_states.json`
82-
- now you can load it: `docker exec -it K-dPS-django python manage.py loaddata patient_states.json`
82+
- now you can load it: `docker exec -it kdps-django python manage.py loaddata patient_states.json`

backend/dps_training_k/.env.dev

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
RUN_CONFIG=dev
33

44
DEBUG=True
5-
SECRET_KEY=abcdefg
5+
SECRET_KEY=replace-me-with-a-long-random-secret
66
ALLOWED_HOSTS=*,
77
INTERNAL_IPS=127.0.0.1
8-
DATABASE_URL=postgres://dps:dps@K-dPS-postgres:5432/dps
9-
REDIS_URL=redis://K-dPS-redis:6379
10-
CACHE_URL=redis://K-dPS-redis:6379
8+
DATABASE_URL=postgres://dps:replace-me-with-a-db-password@kdps-postgres:5432/dps
9+
REDIS_URL=redis://kdps-redis:6379
10+
CACHE_URL=redis://kdps-redis:6379
1111
CHANNEL_REDIS=True
1212

1313
POSTGRES_DB=dps
1414
POSTGRES_USER=dps
15-
POSTGRES_PASSWORD=dps
15+
POSTGRES_PASSWORD=replace-me-with-a-db-password

backend/dps_training_k/.env.prod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
RUN_CONFIG=prod
33

44
DEBUG=False
5-
SECRET_KEY=0Lf6rayQccUBK7GxM32HZCTj995bFij3
5+
SECRET_KEY=replace-me-with-a-long-random-secret
66
ALLOWED_HOSTS=*,
77
INTERNAL_IPS=127.0.0.1
8-
DATABASE_URL=postgres://dps:ozuCk0rrF6nzkzcR1TQMR93m3iYUzMBG@K-dPS-postgres:5432/dps
9-
REDIS_URL=redis://K-dPS-redis:6379
10-
CACHE_URL=redis://K-dPS-redis:6379
8+
DATABASE_URL=postgres://dps:replace-me-with-a-db-password@kdps-postgres:5432/dps
9+
REDIS_URL=redis://kdps-redis:6379
10+
CACHE_URL=redis://kdps-redis:6379
1111
CHANNEL_REDIS=True
1212

1313
POSTGRES_DB=dps
1414
POSTGRES_USER=dps
15-
POSTGRES_PASSWORD=ozuCk0rrF6nzkzcR1TQMR93m3iYUzMBG
15+
POSTGRES_PASSWORD=replace-me-with-a-db-password

backend/dps_training_k/configuration/settings.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
CORS_ORIGIN_ALLOW_ALL = DEBUG
3535
CORS_ALLOWED_ORIGINS = [
3636
"https://klinik-dps.de",
37-
"https://www.klinik-dps.de",
3837
"http://localhost",
3938
]
4039
RUN_CONFIG = env.str("RUN_CONFIG", default="dev")
@@ -189,6 +188,6 @@
189188
DATA_ROOT = os.path.join(BASE_DIR, "data")
190189

191190
# Redis connection settings
192-
REDIS_HOST = "K-dPS-redis"
191+
REDIS_HOST = "kdps-redis"
193192
REDIS_PORT = 6379
194193
REDIS_DB = 0

backend/dps_training_k/deployment/nginx/nginx.conf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ server {
22
listen 80;
33

44
location /api {
5-
proxy_pass http://django:8000/api;
5+
proxy_pass http://kdps-django:8000/api;
66
proxy_set_header Host $host;
77
proxy_set_header X-Real-IP $remote_addr;
88
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
99
proxy_set_header X-Forwarded-Proto $scheme;
1010
}
1111

1212
location /ws {
13-
proxy_pass http://django:8000/ws;
13+
proxy_pass http://kdps-django:8000/ws;
1414
proxy_http_version 1.1;
1515
proxy_set_header Upgrade $http_upgrade;
1616
proxy_set_header Connection "Upgrade";
@@ -22,7 +22,7 @@ server {
2222

2323
# For the admin interface
2424
location /admin {
25-
proxy_pass http://django:8000/admin;
25+
proxy_pass http://kdps-django:8000/admin;
2626
proxy_set_header Host $host;
2727
proxy_set_header X-Real-IP $remote_addr;
2828
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -31,4 +31,4 @@ server {
3131
location /static/ {
3232
alias /app/staticfiles/;
3333
}
34-
}
34+
}

backend/dps_training_k/deployment/nginx/nginx_deploy_dev.conf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ server {
22
listen 80;
33

44
location / {
5-
proxy_pass http://frontend:5173;
5+
proxy_pass http://kdps-frontend:5173;
66
proxy_set_header Host $host;
77
proxy_set_header X-Real-IP $remote_addr;
88
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
99
proxy_set_header X-Forwarded-Proto $scheme;
1010
}
1111

1212
location /api {
13-
proxy_pass http://django:8000/api;
13+
proxy_pass http://kdps-django:8000/api;
1414
proxy_set_header Host $host;
1515
proxy_set_header X-Real-IP $remote_addr;
1616
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
1717
proxy_set_header X-Forwarded-Proto $scheme;
1818
}
1919

2020
location /ws {
21-
proxy_pass http://django:8000/ws;
21+
proxy_pass http://kdps-django:8000/ws;
2222
proxy_http_version 1.1;
2323
proxy_set_header Upgrade $http_upgrade;
2424
proxy_set_header Connection "Upgrade";
@@ -30,7 +30,7 @@ server {
3030

3131
# For the admin interface
3232
location /admin {
33-
proxy_pass http://django:8000/admin;
33+
proxy_pass http://kdps-django:8000/admin;
3434
proxy_set_header Host $host;
3535
proxy_set_header X-Real-IP $remote_addr;
3636
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -39,4 +39,4 @@ server {
3939
location /static/ {
4040
alias /app/staticfiles/;
4141
}
42-
}
42+
}
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
server {
22
listen 80;
3-
server_name klinik-dps.de www.klinik-dps.de;
3+
server_name klinik-dps.de;
44
location / {
55
return 301 https://$host$request_uri;
66
}
77
}
88
server {
99
listen 443 ssl;
10-
server_name klinik-dps.de www.klinik-dps.de;
10+
server_name klinik-dps.de;
1111

12-
ssl_certificate /etc/nginx/ssl/fullchain.pem;
13-
ssl_certificate_key /etc/nginx/ssl/privkey.pem;
12+
ssl_certificate /etc/letsencrypt/live/klinik-dps.de/fullchain.pem;
13+
ssl_certificate_key /etc/letsencrypt/live/klinik-dps.de/privkey.pem;
1414

1515
location / {
16-
proxy_pass http://frontend:5173;
16+
proxy_pass http://kdps-frontend:5173;
1717
proxy_set_header Host $host;
1818
proxy_set_header X-Real-IP $remote_addr;
1919
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
2020
proxy_set_header X-Forwarded-Proto $scheme;
2121
}
2222
location /api {
23-
proxy_pass http://django:8000/api;
23+
proxy_pass http://kdps-django:8000/api;
2424
proxy_set_header Host $host;
2525
proxy_set_header X-Real-IP $remote_addr;
2626
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
2727
proxy_set_header X-Forwarded-Proto $scheme;
2828
}
2929
location /ws {
30-
proxy_pass http://django:8000/ws;
30+
proxy_pass http://kdps-django:8000/ws;
3131
proxy_http_version 1.1;
3232
proxy_set_header Upgrade $http_upgrade;
3333
proxy_set_header Connection "Upgrade";
@@ -36,4 +36,4 @@ server {
3636
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
3737
proxy_set_header X-Forwarded-Proto $scheme;
3838
}
39-
}
39+
}

0 commit comments

Comments
 (0)