Deployment

Kener can be deployed in multiple ways. You can use the pre-built docker image or build from source.

Prerequisites

Make sure you have the following installed:

NPM

npm i
npm run build #build the frontend
npm run start

PM2

npm i
npm run build #build the frontend
pm2 start main.js

Docker

Dockerhub

docker.io/rajnandan1/kener:latest

Github Packages

ghcr.io/rajnandan1/kener:latest

Volumes

  • $(pwd)/uploads You should mount one host directories to persist your image uploads.
  • $(pwd)/database If you are using sqlite, you should mount one host directory to persist your database.

Environment Variables

Environment variables can be passed with -e An example docker run command:

Make sure ./database directory is present in the root directory.

Examples

This example is for sqlite. You can also use postgres. Read more about it here

sqlite

mkdir database
docker run \
  -v $(pwd)/database:/app/database \
  -v $(pwd)/uploads:/app/uploads \
  -p 3000:3000 \
  -e "KENER_SECRET_KEY=somesecretkey" \
  -e "ORIGIN=http://localhost:3000" \
  rajnandan1/kener

.env

You can also use a .env file

docker run \
  -v $(pwd)/database:/app/database \
  -v $(pwd)/uploads:/app/uploads \
  --env-file .env \
  -p 3000:3000 \
  rajnandan1/kener

Or use Docker Compose with the example docker-compose.yaml

Base path

By default kener runs on / but you can change it to /status or any other path. Read more about it here

Postgres

docker run \
 -p 3000:3000 \
 -v $(pwd)/uploads:/app/uploads \
 -e "KENER_SECRET_KEY=somesecretkey" \
 -e "DATABASE_URL=postgresql://myuser:mypassword@localhost:5432/mydatabase" \
 -e "ORIGIN=http://localhost:3000" \
 rajnandan1/kener

MySQL

docker run \
 -p 3000:3000 \
 -v $(pwd)/uploads:/app/uploads \
 -e "KENER_SECRET_KEY=somesecretkey" \
 -e "DATABASE_URL=mysql://root:password@mysql-container-2.orb.local:3306/kener-2" \
 -e "ORIGIN=http://localhost:3000" \
 rajnandan1/kener

Base Path

Let us say you are running kener on a subpath /status. You can set the base path like this:

docker run \
 -p 3000:3000 \
 -v $(pwd)/uploads:/app/uploads \
 -e "KENER_BASE_PATH=/status" \
 -e "KENER_SECRET_KEY=somesecretkey" \
 -e "DATABASE_URL=mysql://root:password@mysql-container-2.orb.local:3306/kener-2" \
 -e "ORIGIN=https://www.example.com" \
 rajnandan1/kener