Git Product home page Git Product logo

drf-nuxt3-docker-tpl's Introduction

Fullstack template with Django (DRF) + Nuxt3 (SSR/SPA) in Docker

  • Traefik 2.10 - https for local development and Let's Encrypt in prod
  • Django, Postgres - with custom User model and registration/authentication endpoints (Djoser + SimpleJWT)
  • DRF - with swagger (drf-spectacular), django-filter
  • Celery - with celery-beat and flower
  • Redis - for cache and broker
  • Nuxt 3 - with SSR or SPA in prod
  • Nginx - for django media and SPA

Local development

As separate front and back on custom ports without https

  1. Set the variables in .env:
    COMPOSE_FILE=local.yml
    DOMAIN=localhost  # or your custom domain from etc/hosts
  2. Run docker compose build and docker compose up -d

As stack with Traefik on one domain without https

  1. Set the variables in .env:
    COMPOSE_FILE=local.yml:local.traefik.yml
    DOMAIN=localhost  # or your custom domain from etc/hosts
  2. Run docker compose build and docker compose up -d

Traefik dashboard: http://localhost:8080/dashboard/#/

As stack with Traefik on one domain with https

  1. Add local domain + subdomain for dashboard in /etc/hosts:
    127.0.0.1 localhost tpl.local tr.tpl.local
  2. Apply changes:
    sudo killall -HUP mDNSResponder
  3. Install mkcert (or another tolls for local certificates)
  4. Go to ./compose/local-ssl/traefik/cert/
  5. Generate a wildcard certificate for a local domain:
    mkcert -cert-file tpl.local.pem -key-file tpl.local-key.pem tpl.local "*.tpl.local"  # * for wildcard
  6. Install local CA certificate with the command:
    mkcert -install
  7. Go to ./compose/local-ssl/traefik/dynamic/ and edit tls.yml. Change the files names to your own
  8. Set the variables in .env:
    COMPOSE_FILE=local.yml:local.traefik.yml:local.traefik.ssl.yml
    DOMAIN=tpl.local  # or your custom domain from etc/hosts
  9. Run docker compose build and docker compose up -d

Traefik dashboard: https://tr.tpl.local/dashboard/#/

Deploy

SSR-mode

  1. Set variables in .env:
    • COMPOSE_FILE=production.yml:production.ssr.yml
    • DOMAIN=your_domain.com - same as your production domain
    • generate new login:password for dashboard: DASHBOARD_LOG_PSW=test:$$apr1$$ozzsQDHl$$wBwHPFJtpA9UQkIE4mXh2/
  2. Run docker compose build and docker compose up -d
  3. If the domain is correctly bound to the server, the certificate will be issued automatically with Let's Encrypt

SPA-mode with Nginx

...soon

Traefik dashboard: https://tr.your_domain.com/dashboard/#/

All stack in separate repos:

  1. Traefik 2.10 as revers-proxy in Docker (SSL in dev and prod)
  2. Nuxt 3 production-ready template in Docker (SPA/SSR)
  3. Django/DRF backend in Docker (based on django-cookiecutter)

drf-nuxt3-docker-tpl's People

Contributors

baikov avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.