add osmtile and remove nginx

This commit is contained in:
Daniel afx 2022-02-04 01:27:40 +02:00
parent 24a92139eb
commit 2c26a62844
3 changed files with 49 additions and 45 deletions

View file

@ -1,37 +1,69 @@
version: '3.8' version: '3.8'
services: services:
lb:
image: haproxy:latest
ports:
- "80:80"
- "443:443"
volumes:
- "./data/certificates:/certificates"
- "./config/lb:/usr/local/etc/haproxy"
depends_on:
- "certbot"
restart: always
networks:
- internal
labels:
- meta.role=lb
certbot:
image: "certbot/certbot"
hostname: certbot
volumes:
- "./data/certificates:/certificates"
- "./data/certbot/etc:/etc/letsencrypt"
- "./data/certbot/var:/var/lib/letsencrypt"
- "./logs/certbot:/var/log/letsencrypt"
restart: on-failure
networks:
- internal
labels:
- meta.role=certbot
#entrypoint: sh -c 'while true; do sleep 1; done'
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 15d & wait $${!}; done;'"
flask: flask:
build: build:
context: ./flask context: ./flask
dockerfile: Dockerfile.prod dockerfile: Dockerfile.prod
command: gunicorn --bind 0.0.0.0:5000 manage:app command: gunicorn --bind 0.0.0.0:5000 manage:app
volumes:
- static_volume:/home/app/web/forest/static
- media_volume:/home/app/web/forest/media
expose: expose:
- 5000 - 5000
env_file: env_file:
- ./.env.prod - ./.env.prod
networks:
- internal
depends_on: depends_on:
- db - db
db: db:
image: postgres:13-alpine image: postgres:13-alpine
volumes: volumes:
- postgres_data_prod:/var/lib/postgresql/data/ - "./data/db/pgdata:/var/lib/postgresql/data/"
env_file: env_file:
- ./.env.prod - ./.env.prod
nginx: networks:
build: ./nginx - internal
osmtile:
image: "overv/openstreetmap-tile-server:latest"
hostname: osmtile
environment:
- "DOWNLOAD_PBF=https://download.geofabrik.de/europe/bulgaria-latest.osm.pbf"
- "DOWNLOAD_POLY=https://download.geofabrik.de/europe/bulgaria.poly"
volumes: volumes:
- static_volume:/home/app/web/forest/static - "./data/osmtile/pgdata:/var/lib/postgresql/12/main"
- media_volume:/home/app/web/forest/media networks:
ports: - internal
- 1337:80 #entrypoint: "/run.sh import"
depends_on: entrypoint: "/run.sh run"
- web restart: always
networks:
volumes: internal: {}
postgres_data_prod:
static_volume:
media_volume:

View file

@ -1,4 +0,0 @@
FROM nginx:1.19-alpine
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d

View file

@ -1,24 +0,0 @@
upstream forest {
server flask:5000;
}
server {
listen 80;
location / {
proxy_pass http://forest;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
}
location /static/ {
alias /home/app/web/project/static/;
}
location /media/ {
alias /home/app/web/project/media/;
}
}