kemono2/docs/develop-linux.md
2025-04-11 00:58:59 +02:00

2.8 KiB

Develop

For now Docker is a primary way of working on the repo. However dependencies are still needed to installed locally for the IDE setup.

Requirements:

Python: 3.12+ NodeJS: 22.14+ PostgreSQL: 16+ Redis: 6+

Installation

  1. Check if node 22.14 or 22.13 is installed in the system:

    node --version
    

    If fails, follow installation instructions

  2. Check if python 3.12 is installed in the system:

    which python 3.12
    

    If no path returned, follow installation instructions

  3. Install virtualenv package if it's not installed.

    pip install --user virtualenv
    
  4. Create a virtual environment:

    virtualenv python=3.12 venv
    
  5. Activate the virtual environment.

    #   Windows ➞ venv\Scripts\activate
    source venv/bin/activate
    
  6. Install python packages.

    pip install --requirement requirements.txt
    
  7. Install pre-commit hooks.

    pre-commit install --install-hooks
    

Database Setup

  1. Install PostgreSQL if not already installed.

  2. Create a database and user for the application.

  3. Write in the config.json the credentials

Redis Setup

  1. Install Redis if not already installed.

  2. Verify Redis is running.

  3. Write in the config.json the credentials

File Paths Configuration

The application requires several directories for storing and serving files:

  1. Make sure you have the directories with files, /data, /thumbnails, /icons:

  2. Serve them with nginx or what is of your choice:

  3. Configure the base url to serve from that file server by setting the following env variables:

     ICONS_PREPEND
     BANNERS_PREPEND
     THUMBNAILS_PREPEND
    

RUN

  1. Run the API dev server:

    python -m src web
    
  2. Run frontend dev server:

    python -m src webpack
    

Git

Configure git to store credentials:

git config credential.helper store

After the next time creds are accepted, they will be saved on hard drive as per rules listed in man git-credential-storeand won't be asked again.

Alternatively they can be stored temporarily in memory:

git config credential.helper cache

The creds are stored as per rules in man git-credential-cache.

IDE

IDE specific instructions.

VSCode

  1. Copy .code-workspace file.

    cp                                              \
        configs/workspace.code-workspace.example    \
        kemono-2.code-workspace
    
  2. Install the recommended extensions.