Skip to content

A rewrite of koreader-sync-server using Ktor and Exposed. Adding support for different databases.

Notifications You must be signed in to change notification settings

mcmacker4/koreader-sync

Repository files navigation

koreader-sync-server

A rewrite of koreader-sync-server in Kotlin using Ktor and Exposed.

By using Exposed, it adds support for a few different DBMS like MySQL, PostgreSQL and SQLite.

It uses SQLite by default.

Building

./gradlew buildFatJar

This generates the file build/libs/koreader-sync-ktor-all.jar.

Running

java -jar koreader-sync-ktor-all.jar

Environment variables

PORT=8080 # The port to listen to http calls

# The URL to the database
DB_URL="jdbc:sqlite:koreader.db" # SQLite example. This is the default if not specified
DB_URL="jdbc:mariadb://localhost:3306/koreader-sync" # MariaDB Example

# The fully qualified name of the JDBC Driver. If not declared, SQLite driver is used by default.
DB_DRIVER="org.mariadb.jdbc.Driver" # Example for mariadb

DB_USER="koreader" # The database user, not needed when using SQLite
DB_PASSWORD="readerko" # The password for the database user, not needed when using SQLite

Adding support for other databases

You need to download the appropiate JDBC driver for the database you are going to use. Then add it to the classpath when running the server, like this:

java -cp "<path-to-jdbc-driver-jar>:koreader-sync-ktor-all.jar" es.hgg.koreader.sync.ApplicationKt

Using Docker

To build the docker image just run:

docker build -t koreader-sync-server .

To run the docker image:

docker run -d --rm koreader-sync-server

Docker noteworthy paths

  • /app/data: When using sqlite, the database is stored in this folder by default (unless overriden with the DB_URL variable). Mount a volume to this path to persist the database across containers.
  • /app/drivers: This folder is scanned for extra Jar files. This is where you need to mount the JDBC driver for the database you are going to use. The name of the jar file inside the volume is unimportant.

About

A rewrite of koreader-sync-server using Ktor and Exposed. Adding support for different databases.

Resources

Stars

Watchers

Forks

Packages