Sign inSign up

abduzzy/rustatsu-sync

By abduzzy

Updated 6 months ago

Image
0

2.5K

abduzzy/rustatsu-sync repository overview

Rustatsu Sync Server

A Rust-based port of the Kotatsu sync server, originally written in Kotlin. This project serves as a personal deep dive into the Axum framework and the Rust ecosystem, with implementing Clean Architecture principles.

kotatsu-syncserver: https://github.com/KotatsuApp/kotatsu-syncserver

Repository

https://github.com/kido1611/rustatsu-sync-server/

Tech Stack

  • Language: Rust
  • Web Framework: Axum
  • Database: PostgreSQL
  • Security: Argon2id for password hashing
  • Architecture: Clean Architecture (Domain, Usecase, Infrastructure layers)

Changes

Warning

Incompatible with the original Kotatsu configuration.
  1. Database migration: switched to PostgreSQL (Kotatsu uses MySQL/MariadB).
  2. Security update: user password are hashed using Argon2id (Kotatsu uses MD5).
  3. Performance optimization: refactored the manga saving logic to reduce database overhead. Used HashMaps and HashSets to deduplicate data before execution, the system significantly reduces query usage and improves overall query time.

Usage

The easiest way to run Rustatsu is using Docker. You can pull the image directly from Docker Hub:

docker pull abduzzy/rustatsu-sync:latest

then run with:

docker run -d \
  --name rustatsu-sync \
  -p 8080:8080 \
  -e DATABASE__HOST=your_db_host \
  -e DATABASE__PORT=5432 \
  -e DATABASE__USERNAME=postgres \
  -e DATABASE__PASSWORD=password \
  -e DATABASE__DATABASE_NAME=rustatsu \
  -e APPLICATION__RUN_MIGRATION=true \
  -e RUST_LOG=info \
  abduzzy/rustatsu-sync:latest
Use Docker Compose

You can use the provided docker-compose.yaml file to start using rustatsu.

services:
  rustatsu:
    image: abduzzy/rustatsu-sync:latest
    ports:
      - "8000:8000"
    environment:
      - DATABASE__HOST=postgresql
      - DATABASE__PORT=5432
      - DATABASE__USERNAME=postgres
      - DATABASE__PASSWORD=password
      - DATABASE__DATABASE_NAME=rustatsu
      # - APPLICATION__PORT=8080
      # - APPLICATION__HOST=0.0.0.0
      # - APPLICATION__ALLOW_REGISTRATION=true
      # - APPLICATION__RUN_MIGRATION=TRUE
      # - JWT__SECRET=my-secret-key
      # - JWT__ISS=rustatsu
      # - JWT__AUD=rustatsu
      - RUST_LOG=warn
    restart: always
    depends_on:
      - postgresql
  postgresql:
    image: postgres:17.3-alpine3.20
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: password
      POSTGRES_DB: rustatsu
    restart: unless-stopped
    volumes:
      - "pgdata:/var/lib/postgresql/data"
volumes:
  pgdata:
Configuration

The following environment variables can be used to configure the app.

VariableDescription
DATABASE__HOSTPostgreSQL host address
DATABASE__PORTPostgreSQL port (Default: 5432)
DATABASE__USERNAMEDatabase user
DATABASE__PASSWORDDatabase password
DATABASE__DATABASE_NAMEName of the database
APPLICATION__PORTServer port (Default: 8080)
APPLICATION__HOSTServer host (Default: 0.0.0.0)
APPLICATION__ALLOW_REGISTRATIONToggle user registration (true/false)
APPLICATION__RUN_MIGRATIONAutomatically run migrations on start (required on first run or after upgrade to setup database)
JWT__SECRETSecret key for JWT signing
RUST_LOGLogging level (error, warn, info, debug)

License

This project is licensed under the GNU General Public License v3.0.

Tag summary

Content type

Image

Digest

sha256:a14b19e91

Size

5.5 MB

Last updated

6 months ago

docker pull abduzzy/rustatsu-sync