huge documentation and setup restructure

This commit is contained in:
vabene1111
2021-01-05 10:38:18 +01:00
parent bcf50f30bc
commit b90c70b2a3
26 changed files with 530 additions and 447 deletions

View File

@@ -1,64 +0,0 @@
**This is the recommended setup to run django recipes with traefik.**
----
Please refer to the traefik documentation on how to setup a docker service in traefik. Since treafik can be a little
confusing at times, the following are examples of my traefik configuration.
You need to create a network called `traefik` using `docker network create traefik`.
## docker-compose.yml
```
version: "3.3"
services:
traefik:
image: "traefik:v2.1"
container_name: "traefik"
ports:
- "443:443"
- "80:80"
- "8080:8080"
volumes:
- "./letsencrypt:/letsencrypt"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./config:/etc/traefik/"
networks:
default:
external:
name: traefik
```
## traefik.toml
Place this in a directory called `config` as this is mounted into the traefik container (see docer compose).
**Change the email address accordingly**.
```
[api]
insecure=true
[providers.docker]
endpoint = "unix:///var/run/docker.sock"
exposedByDefault = false
network = "traefik"
#[log]
# level = "DEBUG"
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.web_secure]
address = ":443"
[certificatesResolvers.le_resolver.acme]
email = "you_email@mail.com"
storage = "/letsencrypt/acme.json"
tlsChallenge=true
```

View File

@@ -16,8 +16,9 @@ services:
env_file:
- ./.env
volumes:
- ./staticfiles:/opt/recipes/staticfiles
- ./mediafiles:/opt/recipes/mediafiles
- staticfiles:/opt/recipes/staticfiles
- mediafiles:/opt/recipes/mediafiles
- nginx_config:/opt/recipes/nginx/conf.d
depends_on:
- db_recipes
networks:
@@ -29,13 +30,14 @@ services:
env_file:
- ./.env
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d
- ./mediafiles:/media
- nginx_config:/etc/nginx/conf.d:ro
- staticfiles:/static
- mediafiles:/media
labels: # traefik example labels
- "traefik.enable=true"
- "traefik.http.routers.recipes.rule=Host(`recipes.mydomain.com`, `recipes.myotherdomain.com`)"
- "traefik.http.routers.recipes.entrypoints=web_secure"
- "traefik.http.routers.recipes.tls.certresolver=le_resolver"
- "traefik.http.routers.recipes.entrypoints=web_secure" # your https endpoint
- "traefik.http.routers.recipes.tls.certresolver=le_resolver" # your cert resolver
networks:
- default
- traefik
@@ -43,4 +45,14 @@ services:
networks:
default:
traefik: # This is you external traefik network
external: true
external: true
volumes:
nginx
staticfiles
mediafiles:
driver: local
driver_opts:
type: 'none'
o: 'bind'
device: './mediafiles'

View File

@@ -1,16 +0,0 @@
server {
listen 80;
server_name localhost;
client_max_body_size 16M;
# serve media files
location /media/ {
alias /media/;
}
# pass requests for dynamic content to gunicorn
location / {
proxy_set_header Host $host;
proxy_pass http://web_recipes:8080;
}
}