Code Monkey home page Code Monkey logo

lila-db-seed's Introduction

Database data for development on lichess-org/lila

Note

If you use lila-gitpod or lila-docker for your dev environment, this repo is already included and you can configure it during setup.

This will get you the bare minimum of puzzles and game data:

mongorestore dump

Or...

Use spamdb to fully populate your database:

python3.9+ is required. If you don't have python3, use your package manager or the downloads page to install it, then install the necessary packages:

python -m ensurepip --upgrade
# not strictly necessary but recommended, use a virtual environment
python3 -m venv venv --upgrade-deps && source venv/bin/activate
# install required packages
pip3 install -r spamdb/requirements.txt

The lila-db-seed/spamdb/spamdb.py script will generate semi-realistic dummy data that is useful for testing and makes your dev instance a lot more colorful. Usage help:

spamdb/spamdb.py --help

Usually, the script will generate a new set of data from inputs in the provided arguments as well as the spamdb/data directory. This data will be merged into your running mongodb instance at 127.0.0.1:27071/lichess by default. To customize connection details use the --uri argument. Set the password for your users with the --password flag (otherwise they will default to "password"). Set the default background in user prefs with --user-bg (default is dark mode, use 400 for transparency). For other options see spamdb.py --help.

Use --su-password to give the special (admin) users different passwords than the default if your dev instance will be exposed to others.

Creating lichess database indexes

lila-db-seed/spamdb/spamdb.py does not create the indexes in lichess database. In case you need them, you can use https://github.com/lichess-org/lila/blob/master/bin/mongodb/indexes.js

mongosh --quiet lichess indexes.js

Seed Elasticsearch

To push this data to elasticsearch, you can use the CLI tools from lila-search. See the CLI commands in the lila-search README.

Special users:

  • superadmin - ROLE_SUPER_ADMIN # check out the mod UI if you haven't seen it, very cool!
  • admin - ROLE_ADMIN
  • shusher - ROLE_SHUSHER
  • hunter - ROLE_CHEAT_HUNTER
  • puzzler - ROLE_PUZZLE_CURATOR
  • api - ROLE_API_HOG (this guy is useful for api testing, both server and clients)
  • troll - marked as troll
  • bot0 thru bot9 - marked as bot
  • kid - they're just children, how could you checkmate children?
  • wwwwwwwwwwwwwwwwwwww - 20 W's in visible username, WGM title, and a patron to test ui for extremely wide usernames.

Normal users:

The normal users have all the data. This includes notifications, ratings, follows, game histories, activity, timelines, blogs, forums, teams, tournaments. See the full list in spamdb/data/uids.txt

lila-db-seed's People

Contributors

schlawg avatar fitztrev avatar ornicar avatar yafred avatar tontsa28 avatar carbrex avatar trevorbayless avatar niklasf avatar sergioglorias avatar kraktus avatar ronfromhp avatar

Stargazers

 avatar Panagiotis avatar Thanh Tran avatar  avatar  avatar Juan Alberto Regalado Galvan avatar Steven Janssens avatar Andrew avatar  avatar Subhayu Kumar Bala avatar Vincent Velociter avatar YoungChief avatar  avatar Virinas-code avatar  avatar emreyildiz avatar Siphosethu Nongwe avatar Vishwa Phansal avatar Daniel Dugovic avatar  avatar

Watchers

 avatar Lakin Wecker avatar  avatar  avatar James Cloos avatar Benedikt Werner avatar  avatar  avatar

lila-db-seed's Issues

Adding the cached cloud evaluation positions to lila-db-seed

Since I noticed that calling /api/cloud-evalendpoint always returns an error saying "no cloud evaluation available for that position", I began to wonder if the position cache data should be added to lila-db-seed in order to make it work. But to implement this I would need to know what the name of the collection that stores this data is in the MongoDB database? Or is this data present in Redis only? I tried some collections that could have worked for this (like analysis_request and fishnet_analysis) but they turned out not to be the right ones. So my general question is: how can we populate the position cache such that this cloud eval endpoint would work?

(I was instructed to open this issue by Toadofsky on Discord)

Update email address of test records

Test users get created with an email address in format lichess.waste.basket+{username}@gmail.com. When Lichess normalizes email addresses for certain operations, anything after the + is excluded. In the case of these test users, that's the identifying part.

After changing the format, you should be able to use the "sign in with link" functionality and lila should send an email to the test user's address.

Seed daily feed

Seed the daily_feed collection in the database with sample content for the feed (https://lichess.org/feed)

> db.daily_feed.find()
{ "_id" : "TA0ekf", "content" : "sample content here", "public" : true, "at" : ISODate("2023-12-17T17:00:00Z") }

fide rating need change

the FIDE rating is now 1400
Numbers smaller than 1400 will cause problems when editing the profile

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.