4 Commits
dev ... mail

Author SHA1 Message Date
bdea86f282 add mail support 2022-09-29 19:29:02 +02:00
46bcc974e6 change healthcheck intervals 2022-09-27 18:15:50 +02:00
9a342cdb41 Merge branch 'main' of ssh://git.coopcloud.tech:2222/coop-cloud/karrot 2022-09-27 17:38:46 +02:00
f63581a792 Dockerfile 2022-09-27 01:18:57 +02:00
7 changed files with 101 additions and 9 deletions

View File

@ -3,14 +3,19 @@ TYPE=karrot
DOMAIN=karrot.example.com
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)
MAXMIND_ACCOUNT_ID=
# License key for maxmind
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

13
backend/Dockerfile Normal file
View 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

Binary file not shown.

BIN
backend/karrot-backend.pyz Normal file

Binary file not shown.

View File

@ -12,7 +12,7 @@ services:
- DOMAIN
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/"]
interval: 10s
interval: 30s
timeout: 3s
retries: 30
networks:
@ -46,6 +46,12 @@ services:
environment:
- MAXMIND_ACCOUNT_ID
- MAXMIND_LICENSE_KEY
- EMAIL_FROM
- SMTP_PASSWORD
- SMTP_HOST
- EMAIL_BACKEND
- SMTP_PORT
- SMTP_USE_SSL
- SITE_URL=http://localhost:8000
- LISTEN_HOST=0.0.0.0
- LISTEN_SERVER=uvicorn
@ -60,7 +66,7 @@ services:
- REDIS_DB=0
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/api/"]
interval: 10s
interval: 30s
timeout: 3s
retries: 90
command: >
@ -108,7 +114,7 @@ services:
command: ["redis-server", "--appendonly", "yes"]
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 1s
interval: 10s
timeout: 3s
retries: 30
volumes:
@ -120,7 +126,7 @@ services:
image: "postgres:14-alpine"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U karrot"]
interval: 1s
interval: 10s
timeout: 3s
retries: 30
configs:
@ -135,7 +141,7 @@ services:
- POSTGRES_PASSWORD=karrot
- POSTGRES_USER=karrot
- POSTGRES_DB=karrot
secrets:
db_password:

4
frontend/Dockerfile Normal file
View 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
View 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;
}
}