KANNA
Web based Markdown editor and publish system
Stack
- Django 3 + DRF + Celery + Channels
- Vue.js 2 + Axios + Element UI
- Nginx + Let’s Encrypt
- Postgresql 11
- Redis
- Docker, docker-compose
Note
- restart nginx container if changed nginx conf file(nginx/conf.d/*)
- ENV variables in docker-compose file overwrites .env file.
backend/.env
is loaded when run docker-compose up
Requirements
- OS: Mac or Linux
- Docker, docker-compose
Third party
Sentry(option but recommended)
Quick start(development)
-
run cp backend/.env.example backend/.env
.
-
edit backend/.env
- if use sentry, change DJANGO_SENTRY_DSN to your dsn
-
run cp frontend/.env.example frontend/.env
.
-
edit frontend/.env
-
run make build
-
run make up
-
confirm backend container is running, then:
- run
make migrate
- run
make createsuperuser
- email:
admin@example.com
- password:
password
-
confirm frontend container is running and webpack build is completed, then:
If failed make up
with these errors, then run make up
again.
ERROR: for knn.frontend UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)
ERROR: for frontend UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)
ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information.
Swagger/OpenAPI 2.0 specifications(to be)
Testing
Django Unittest
Code Formatter
Black(for backend)
- require Black on your system
- run
black --exclude /migrations/ ./backend
Deploy
- edit backend/.env and frontend/.env
- edit init-letsencrypt: domain, email
- make prod-build
- make prod-up
- ./init-letsencrypt.sh
Make commands
refers to Makefile
development
- build: docker-compose build
- up: docker-compose up
- createsuperuser: create superuser
- restart: docker-compose restart
- create-dummy-books:
make create-dummy-books TOTAL=10
Deploy
- prod-build: docker-compose build
- prod-up: docker-compose up
View log
- log-backend: show backend log
- log-asgi: show asgi(daphne) log
- log-worker: show celery log
- log-nginx: show nginx log
- log-frontend: show frontend(development only)
- log-db: show db log
Shell
- sh-backend: run bash in backend container
- sh-nginx: run bash in nginx container
Download Details:
Author: b1tk3y
Source Code: https://github.com/b1tk3y/open-kanna
#vue #vuejs #javascript