7 Commits

3 changed files with 75 additions and 22 deletions

View File

@ -1,16 +1,26 @@
TYPE=karrot
DOMAIN=karrot.example.com
LETS_ENCRYPT_ENV=production
# 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
SITE_NAME=karrot dev
SITE_LOGO=https://user-images.githubusercontent.com/31616/36565633-517373a4-1821-11e8-9948-5bf6887c667e.png
# postal,smtp,console
EMAIL_BACKEND=console
# only set those when using SMTP
#EMAIL_FROM=
# SMTP USER and EMAIL_FROM are usually the same
#SMTP_USER=
#SMTP_PASSWORD=
#SMTP_HOST=
#SMTP_USE_SLL=
#SMTP_USE_TLS=true
#SMTP_PORT=587
SECRET_DB_PASSWORD_VERSION=v1
SITE_URL=https://${DOMAIN}
LETS_ENCRYPT_ENV=production

29
README.md Normal file
View File

@ -0,0 +1,29 @@
# karrot
Karrot is a free and open-source tool for grassroots initiatives and groups of people that want to coordinate face-to-face activities on a local, autonomous and voluntary basis.
<!-- metadata -->
* **Category**: Utilities
* **Status**: 3, stable
* **Image**: [`karrot-backend`](https://hub.docker.com/r/vlafvlaf/karrot_backend),4,upstream
* **Healthcheck**: Yes
* **Backups**: No
* **Email**: Yes
* **Tests**: No
* **SSO**: No
<!-- endmetadata -->
## Basic usage
1. Set up Docker Swarm and [`abra`]
2. `abra app new karrot`
3. `abra app config <karrot app name>`
4. `abra app deploy <karrot app name>`
## Configuration options
`MAXMIND_ACCOUNT_ID` and `MAXMIND_ACCOUNT_KEY` are API credentials from maxmind.com. You need an account there to get GeoIP data for Karrot.
[`abra`]: https://git.coopcloud.tech/coop-cloud/abra

View File

@ -2,7 +2,7 @@ version: "3.8"
services:
web:
image: "vlafvlaf/karrot_frontend:0.0.3"
image: "vlafvlaf/karrot_frontend:0.1.0"
configs:
- source: nginx_config
target: /etc/nginx/conf.d/default.conf
@ -11,10 +11,11 @@ services:
environment:
- DOMAIN
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/"]
interval: 10s
test: ["CMD", "curl", "-f", "http://localhost/api/bootstrap"]
interval: 15s
timeout: 3s
retries: 30
retries: 2
start_period: 45s
networks:
- internal
- proxy
@ -30,10 +31,9 @@ services:
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
- "coop-cloud.${STACK_NAME}.version=0.0.1+testing"
app:
image: "vlafvlaf/karrot_backend:test"
image: "vlafvlaf/karrot_backend:0.1.0"
networks:
- internal
depends_on:
@ -46,7 +46,17 @@ services:
environment:
- MAXMIND_ACCOUNT_ID
- MAXMIND_LICENSE_KEY
- SITE_URL=http://localhost:8000
- EMAIL_BACKEND
- EMAIL_FROM
- SMTP_USER
- SMTP_PASSWORD
- SMTP_HOST
- SMTP_USE_SLL
- SMTP_USE_TLS
- SMTP_PORT
- SITE_URL
- SITE_NAME
- SITE_LOGO
- LISTEN_HOST=0.0.0.0
- LISTEN_SERVER=uvicorn
- SECRET_KEY=foobar
@ -60,9 +70,13 @@ services:
- REDIS_DB=0
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/api/"]
interval: 10s
interval: 15s
timeout: 3s
retries: 90
retries: 2
start_period: 45s
deploy:
labels:
- "coop-cloud.${STACK_NAME}.version=0.1.0+0.1.0"
command: >
sh -c "
echo 'EditionIDs GeoLite2-City GeoLite2-Country' > /etc/GeoIP.conf &&
@ -75,7 +89,7 @@ services:
python karrot-backend.pyz server
"
worker:
image: "vlafvlaf/karrot_backend:test"
image: "vlafvlaf/karrot_backend:0.1.0"
depends_on:
# shiv + geoip data gets loaded on the first run of the app
# so to ensure it's available in the worker too, we need to wait
@ -86,7 +100,7 @@ services:
networks:
- internal
environment:
- SITE_URL=http://localhost:8000
- SITE_URL
- LISTEN_HOST=0.0.0.0
- LISTEN_SERVER=uvicorn
- SECRET_KEY=foobar
@ -108,7 +122,7 @@ services:
command: ["redis-server", "--appendonly", "yes"]
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 1s
interval: 10s
timeout: 3s
retries: 30
volumes:
@ -120,7 +134,7 @@ services:
image: "postgres:14-alpine"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U karrot"]
interval: 1s
interval: 10s
timeout: 3s
retries: 30
configs:
@ -137,10 +151,10 @@ services:
- POSTGRES_DB=karrot
secrets:
db_password:
external: true
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
#secrets:
# db_password:
# external: true
# name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
configs:
nginx_config: