Skip to content

Commit 0460245

Browse files
committed
update test deploy config
1 parent f42c45c commit 0460245

File tree

4 files changed

+81
-5
lines changed

4 files changed

+81
-5
lines changed

Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ ENV OPTIMAP_ALLOWED_HOST=*
1010

1111
ENV DEBIAN_FRONTEND="noninteractive" TZ="Europe/Berlin"
1212

13-
# TODO: see https://www.joseferben.com/posts/django-on-flyio/ for more improvements
14-
1513
# install Python
1614
RUN apt-get update && \
1715
apt-get install -y -qq python-is-python3 && \

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ A complete list of existing parameters is provided in the file `optimap/.env.exa
3232
The project is containerized using Docker, with services defined in `docker-compose.yml`. To start all services, run:
3333

3434
```bash
35-
docker-compose up
35+
docker compose up
3636
```
3737

3838
### Initial Setup
@@ -41,8 +41,9 @@ After starting the containers, apply database migrations:
4141

4242
```bash
4343
# run migrations, in the directory where docker-compose is to resolve the name "web"
44-
docker-compose run app python manage.py makemigrations # should not detect and changes, otherwise your local config might be outdated
45-
docker-compose run app python manage.py migrate
44+
docker compose run app python manage.py makemigrations # should not detect and changes, otherwise your local config might be outdated
45+
docker compose run app python manage.py migrate
46+
docker compose run app python manage.py loaddata fixtures/test_data.json
4647
```
4748

4849
Now open a browser at <http://localhost:80/>.

docker-compose.deploy.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
services:
2+
db:
3+
image: postgis/postgis:17-3.5
4+
environment:
5+
POSTGRES_DB: optimap
6+
POSTGRES_USER: optimap
7+
POSTGRES_PASSWORD: optimap
8+
#POSTGRES_PASSWORD_FILE: database_password
9+
ports:
10+
- "5434:5432"
11+
volumes:
12+
- optimap-volume:/var/lib/postgresql/data
13+
#secrets:
14+
# - database_password
15+
16+
app:
17+
build:
18+
context: .
19+
dockerfile: Dockerfile
20+
environment:
21+
#see local .env file on the server
22+
DATABASE_URL: postgis://optimap:optimap@db:5432/optimap?sslmode=disable
23+
OPTIMAP_DEBUG: "False"
24+
volumes:
25+
- ".:/code:ro"
26+
- "./fixtures:/fixtures"
27+
depends_on:
28+
- db
29+
30+
webserver:
31+
image: nginx:1.27-alpine
32+
volumes:
33+
- "./etc/nginx.deploy.conf:/etc/nginx/nginx.conf:ro"
34+
ports:
35+
- "80:80"
36+
depends_on:
37+
- app
38+
39+
volumes:
40+
optimap-volume:
41+
external: true
42+
driver: local
43+
44+
#secrets:
45+
# database_password:
46+
# file: /var/www/komet/database_password.secret

etc/nginx.deploy.conf

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
worker_processes 1;
3+
4+
events {
5+
worker_connections 1024;
6+
}
7+
8+
http {
9+
include /etc/nginx/mime.types;
10+
default_type application/octet-stream;
11+
sendfile on;
12+
keepalive_timeout 65;
13+
gzip on;
14+
15+
upstream optimap {
16+
server app:8000;
17+
}
18+
19+
server {
20+
listen 80;
21+
server_name optimap.geo.tu-dresden.de;
22+
23+
location / {
24+
proxy_pass http://optimap;
25+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
26+
proxy_set_header Host $host;
27+
proxy_redirect off;
28+
}
29+
}
30+
31+
}

0 commit comments

Comments
 (0)