Napse is an open-source investment platform, built with transparency and resilience in mind. It plugs into your personal broker account and provides you with a variety of algorithms to help invest over time.
Docker compose
Here is the docker compose file generated by Crane It.
version: "3.8"
volumes:
db_volume: {}
services:
django: &django
container_name: django
image: ghcr.io/napse-invest/napse-developer-toolkit/napse_dtk_prod_django:v1.4.30
environment:
- AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
- AWS_S3_BUCKET_URI=${CRANE_IT_S3_BUCKET_URI}/litestream
- AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
- DJANGO_SECRET_KEY=$DJANGO_SECRET_KEY
- NAPSE_API_DOMAIN=$CRANE_IT_EB_DOMAIN
volumes:
- db_volume:/app/db
command: "/start"
env_file:
- ./.envs/.django
- ./.envs/.litestream
expose:
- "8000"
labels:
- "traefik.enable=true"
- "traefik.http.routers.django.rule=Host(`$CRANE_IT_EB_DOMAIN`)"
- "traefik.http.routers.django.entrypoints=websecure"
- "traefik.http.routers.django.tls.certresolver=myresolver"
- "traefik.http.services.django.loadbalancer.server.port=8000"
ports: []
redis: &redis
container_name: redis
image: redis:6
ports: []
celeryworker: &celeryworker
<<: *django
container_name: celeryworker
restart: on-failure
depends_on:
- django
- redis
command: "/start-celeryworker"
labels:
- "traefik.enable=false"
ports: []
celerybeat: &celerybeat
<<: *django
container_name: celerybeat
restart: on-failure
depends_on:
- django
- redis
command: "/start-celerybeat"
labels:
- "traefik.enable=false"
ports: []
traefik:
image: "traefik:v2.9.5"
container_name: traefik
command:
- "--log.level=INFO"
- "--api.insecure=false"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.myresolver.acme.httpchallenge=true"
- "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.myresolver.acme.email=craneit.contact@gmail.com"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./letsencrypt:/letsencrypt"
The docker compose file slightly more complicated than the three previous ones. Traefik allow us to use HTTPS, redis for caching, and celery (beat and worker) for periodic tasks.
Napse uses litestream as a database, so everything is stored in S3. You can see the docker compose takes advantage of Crane It environment variables available on server boot, such as CRANE_IT_S3_BUCKET_URI (the AWS URI of the bucket) and CRANE_IT_EB_DOMAIN (the elastic beanstalk domain).
Useful links