Skip to content

Latest commit

 

History

History
81 lines (56 loc) · 2.29 KB

Docker.md

File metadata and controls

81 lines (56 loc) · 2.29 KB

Run Tiddi in Docker

Prerequisites

  • Docker (20.10.22 or higher recommended)
  • Sqlite3 (3.37.2 or higher recommended)
  • LibSQL An SQLite3 Fork

Steps

  1. Pull the image from Docker Hub
docker pull ghcr.io/kunalsin9h/tiddi-container:latest

✔️ This image is very small in size (only 10.5 MB)

  1. Create a database folder in the root directory
# This is not required if using libsql
mkdir database

Database is stored in host machine (using Bind Mounts), to make it persistent between container runs and to avoid data loss.

  1. Create a sqlite3 database file in the database folder
# This is not required if using libsql
touch database/dev.db
  1. Run the server
docker run \
    -d -p 5656:5656 --name tiddi --rm \
    --mount type=bind,source="$(pwd)"/database/dev.db,target=/tiddi/database/dev.db \
    ghcr.io/kunalsin9h/tiddi-container:latest
  1. Open the browser and go to http://localhost:5656

Environment Variables

  • PORT - Port number on which the server will run (default: 5656)
  • DB - URL to the database file (default: file:./database/dev.db)
  • HOST - Host name (default: http://localhost)

You can see more info about environment variables in Tiddi: Here

Full Command using Environment Variables

docker run \
    -d --name tiddi --rm \
    -p 5656:5656 \
    -e PORT=5656 \
    -e DB=file:./database/dev.db \
    # or for libsql
    # -e DB=libsql://my-db.tarso.io?authToken=autotoken \
    -e HOST=https://tiddi.kunalsin9h.com \
    --mount type=bind,source="$(pwd)"/database/dev.db,target=/tiddi/database/dev.db \
    ghcr.io/kunalsin9h/tiddi-container:latest

Now open the browser and go to http://localhost:5656

⚠️ Make sure the HOST domain name is same as the one you are using to access the server

Notes

  • The server will be running in the background, to stop the server, run the following command
docker stop tiddi
  • To run the server in the foreground, remove the -d flag from the above command