-
Clone repo and switch to the repo folder:
git clone --recurse-submodules https://github.com/OpenYiff/Kemono2.git kemono-2 cd kemono-2
-
Set up configs:
cp kitsune.py.example kitsune.py # archiver config cp .env.example .env # open .env and configure cp redis_map.py.example redis_map.py # open redis_map.py and configure cp flask.cfg.example flask.cfg # open flask.cfg and set 'SECRET_KEY' value
For now Docker is a primary way of working on the repo.
-
Create a virtual environment:
pip install virtualenv # install the package if it's not installed virtualenv --upgrade-embed-wheels # makes it easier to manage python versions virtualenv --python 3.8 venv
-
Activate the virtual environment:
source venv/bin/activate # venv\Scripts\activate on Windows
-
Install python packages:
pip install --requirement requirements.txt
-
Install
pre-commit
hooks:pre-commit install --install-hooks
Copy .code-workspace
file:
cp configs/workspace.code-workspace.example kemono-2.code-workspace
And install recommended extensions.
docker-compose --file docker-compose.dev.yml build
docker-compose --file docker-compose.dev.yml up
Open http://localhost:5000/
in the browser.
- Register an account.
- Visit
http://localhost:5000/development
. - Click either seeded or random generation.
- This will start a mock import process, which will also populate the database.
TBD
docker-compose build
docker-compose up --detach
Open http://localhost:8000/
in the browser.
TODO: write installation and setup instructions
This assumes you have Python 3.8+ Node 12+ installed and a running PostgreSQL server.
# make sure your database is initialized
# cd to kemono directory
pip install virtualenv
virtualenv venv
source venv/bin/activate # venv\Scripts\activate on Windows
pip install --requirement requirements.txt
cd client && npm install && npm run build && cd ..
cp .env.example .env # open .env and configure
cp flask.cfg.example flask.cfg # open flask.cfg and configure
set FLASK_APP=server.py
set FLASK_ENV=development
flask run
Assuming the running setup:
- Enter into database container:
docker exec --interactive --tty kemono-db psql --username=nano kemonodb
- Check the contents of the
posts
table:Most likely it has 0 rows.SELECT * FROM posts;
- Move contents of
booru_posts
toposts
:INSERT INTO posts SELECT * FROM booru_posts ON CONFLICT DO NOTHING;
- Restart the archiver:
If you see a bunch of log entries from
docker restart kemono-archiver
kemono-db
, then it means archiver is doing the job. - In case the frontend still doesn't show the artists/posts, clear redis cache:
docker exec kemono-redis redis-cli FLUSHALL
Assuming you haven't cloned the repo recursively for whatever reason:
- Initiate the submodules
git submodule init git submodule update --init --recursive
- Switch to archiver folder and add your fork to the remotes list:
cd archiver git remote add <remote_name> <your_fork_link>
- Now you can interact with Kitsune repo the same way you do as if it was outside of project folder.
- Retrieve a database dump.
- Run this command in the folder of said dump:
cat db-filename.dump | gunzip | docker exec --interactive kemono-db psql --username=nano kemonodb
- Restart the archiver to trigger migrations:
If that didn't start the migrations, refer to FAQ section for manual instructions.
docker restart kemono-archiver
- Retrieve the files in required folder structure.
- Copy them into nginx image:
docker cp ./ kemono-nginx:/storage
- Add required permissions to that folder:
docker exec kemono-nginx chown --recursive nginx /storage