Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
bdea86f282
|
|||
|
46bcc974e6
|
|||
|
9a342cdb41
|
|||
| f63581a792 |
13
.env.sample
13
.env.sample
@ -3,14 +3,19 @@ TYPE=karrot
|
|||||||
DOMAIN=karrot.example.com
|
DOMAIN=karrot.example.com
|
||||||
LETS_ENCRYPT_ENV=production
|
LETS_ENCRYPT_ENV=production
|
||||||
|
|
||||||
|
# postal,smtp,sonsole
|
||||||
|
EMAIL_BACKEND=console
|
||||||
|
# only set those when using SMTP
|
||||||
|
#EMAIL_FROM=
|
||||||
|
#EMAIL_PASSWORD=
|
||||||
|
#SMTP_HOST=
|
||||||
|
#SMTP_USE_SSL=true
|
||||||
|
#SMTP_PORT=465
|
||||||
|
|
||||||
# account id for maxmind (for GeoIP)
|
# account id for maxmind (for GeoIP)
|
||||||
MAXMIND_ACCOUNT_ID=
|
MAXMIND_ACCOUNT_ID=
|
||||||
# License key for maxmind
|
# License key for maxmind
|
||||||
MAXMIND_LICENSE_KEY=
|
MAXMIND_LICENSE_KEY=
|
||||||
|
|
||||||
# if I set this it fails with:
|
|
||||||
# TypeError: SelectorEventLoop required, instead got: <uvloop.Loop running=False closed=False debug=False>
|
|
||||||
#LISTEN_CONCURRENCY=4
|
|
||||||
|
|
||||||
|
|
||||||
SECRET_DB_PASSWORD_VERSION=v1
|
SECRET_DB_PASSWORD_VERSION=v1
|
||||||
|
|||||||
13
backend/Dockerfile
Normal file
13
backend/Dockerfile
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
FROM python:3.7-buster
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y gdal-bin
|
||||||
|
|
||||||
|
COPY ./karrot-backend.pyz /app/karrot-backend.pyz
|
||||||
|
|
||||||
|
RUN sed -i -e's/ main/ main contrib non-free/g' /etc/apt/sources.list && \
|
||||||
|
apt-get update && \
|
||||||
|
apt-get install -y libmaxminddb0 libmaxminddb-dev geoipupdate
|
||||||
|
|
||||||
BIN
backend/backend.pyz
Normal file
BIN
backend/backend.pyz
Normal file
Binary file not shown.
BIN
backend/karrot-backend.pyz
Normal file
BIN
backend/karrot-backend.pyz
Normal file
Binary file not shown.
16
compose.yml
16
compose.yml
@ -12,7 +12,7 @@ services:
|
|||||||
- DOMAIN
|
- DOMAIN
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost/"]
|
test: ["CMD", "curl", "-f", "http://localhost/"]
|
||||||
interval: 10s
|
interval: 30s
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
retries: 30
|
retries: 30
|
||||||
networks:
|
networks:
|
||||||
@ -46,6 +46,12 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- MAXMIND_ACCOUNT_ID
|
- MAXMIND_ACCOUNT_ID
|
||||||
- MAXMIND_LICENSE_KEY
|
- MAXMIND_LICENSE_KEY
|
||||||
|
- EMAIL_FROM
|
||||||
|
- SMTP_PASSWORD
|
||||||
|
- SMTP_HOST
|
||||||
|
- EMAIL_BACKEND
|
||||||
|
- SMTP_PORT
|
||||||
|
- SMTP_USE_SSL
|
||||||
- SITE_URL=http://localhost:8000
|
- SITE_URL=http://localhost:8000
|
||||||
- LISTEN_HOST=0.0.0.0
|
- LISTEN_HOST=0.0.0.0
|
||||||
- LISTEN_SERVER=uvicorn
|
- LISTEN_SERVER=uvicorn
|
||||||
@ -60,7 +66,7 @@ services:
|
|||||||
- REDIS_DB=0
|
- REDIS_DB=0
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:8000/api/"]
|
test: ["CMD", "curl", "-f", "http://localhost:8000/api/"]
|
||||||
interval: 10s
|
interval: 30s
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
retries: 90
|
retries: 90
|
||||||
command: >
|
command: >
|
||||||
@ -108,7 +114,7 @@ services:
|
|||||||
command: ["redis-server", "--appendonly", "yes"]
|
command: ["redis-server", "--appendonly", "yes"]
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "redis-cli", "ping"]
|
test: ["CMD", "redis-cli", "ping"]
|
||||||
interval: 1s
|
interval: 10s
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
retries: 30
|
retries: 30
|
||||||
volumes:
|
volumes:
|
||||||
@ -120,7 +126,7 @@ services:
|
|||||||
image: "postgres:14-alpine"
|
image: "postgres:14-alpine"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U karrot"]
|
test: ["CMD-SHELL", "pg_isready -U karrot"]
|
||||||
interval: 1s
|
interval: 10s
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
retries: 30
|
retries: 30
|
||||||
configs:
|
configs:
|
||||||
@ -135,7 +141,7 @@ services:
|
|||||||
- POSTGRES_PASSWORD=karrot
|
- POSTGRES_PASSWORD=karrot
|
||||||
- POSTGRES_USER=karrot
|
- POSTGRES_USER=karrot
|
||||||
- POSTGRES_DB=karrot
|
- POSTGRES_DB=karrot
|
||||||
|
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
db_password:
|
db_password:
|
||||||
|
|||||||
4
frontend/Dockerfile
Normal file
4
frontend/Dockerfile
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
FROM nginx:1.20.1-alpine
|
||||||
|
|
||||||
|
RUN curl https://download.karrot.world/karrot-frontend-production.zip -o karrot-frontend.zip && \
|
||||||
|
unzip -o karrot-frontend.zip -d /usr/share/nginx/html
|
||||||
64
frontend/nginx.conf
Normal file
64
frontend/nginx.conf
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
map $http_upgrade $connection_upgrade {
|
||||||
|
default upgrade;
|
||||||
|
'' close;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name web;
|
||||||
|
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri /index.html;
|
||||||
|
if_modified_since off;
|
||||||
|
expires off;
|
||||||
|
etag off;
|
||||||
|
# TODO: csp headers
|
||||||
|
}
|
||||||
|
|
||||||
|
location /css {
|
||||||
|
expires max;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /js {
|
||||||
|
expires max;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /img {
|
||||||
|
expires max;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /fonts {
|
||||||
|
expires max;
|
||||||
|
}
|
||||||
|
|
||||||
|
# /app/uploads
|
||||||
|
|
||||||
|
location /media/ {
|
||||||
|
alias /app/uploads/;
|
||||||
|
expires max;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /community_proxy/ {
|
||||||
|
proxy_pass https://community.foodsaving.world/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ^\/(api(\-auth)?|docs|silk)\/ {
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
# this port is whatever port 80 is mapped to outside the container
|
||||||
|
proxy_set_header Host $host:8080;
|
||||||
|
proxy_pass http://app:8000;
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection $connection_upgrade;
|
||||||
|
proxy_set_header Sec-WebSocket-Extensions $http_sec_websocket_extensions;
|
||||||
|
proxy_set_header Sec-WebSocket-Key $http_sec_websocket_key;
|
||||||
|
proxy_set_header Sec-WebSocket-Protocol $http_sec_websocket_protocol;
|
||||||
|
proxy_set_header Sec-WebSocket-Version $http_sec_websocket_version;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user