2 [![Build status](https://gitlab.com/minetest/contentdb/badges/master/pipeline.svg)](https://gitlab.com/minetest/contentdb/pipelines)
4 Content database for Minetest mods, games, and more.\
5 Developed by rubenwardy, license GPLv3.0+.
7 ## Getting started (debug/dev)
9 Docker is the recommended way to develop and deploy ContentDB.
11 1. Install `docker` and `docker-compose`.
13 sudo apt install docker-ce docker-compose
15 2. Copy `config.example.cfg` to `config.cfg`.
17 3. (Optional) Set up mail in config.cfg.
18 Make sure to set `USER_ENABLE_EMAIL` to True.
20 4. (Optional) Set up GitHub integration
21 1. Make a Github OAuth Client at <https://github.com/settings/developers>:
22 2. Homepage URL - `http://localhost:5123/`
23 3. Authorization callback URL - `http://localhost:5123/user/github/callback/`
24 4. Put client id and client secret in `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` in config.cfg.
28 POSTGRES_USER=contentdb
29 POSTGRES_PASSWORD=password
33 6. Start docker images:
35 docker-compose up --build
39 ./utils/run_migrations.sh
41 8. Create initial data
43 2. Either `python setup.py -t` or `python setup.py -o`:
44 1. `-o` creates just the admin, and static data like tags, and licenses.
45 2. `-t` will do `-o` and also create test packages. (Recommended)
47 9. View at <http://localhost:5123>.
48 The admin username is `rubenwardy` and the password is `tuckfrump`.
50 In the future, starting CDB is as simple as:
52 docker-compose up --build
54 To hot/live update CDB whilst it is running, use:
58 This will only work with python code and templates, it won't update tasks or config.
64 # Hot/live reload (only works with FLASK_DEBUG=1)
67 # Cold update a running version of CDB with minimal downtime (production)
74 ./utils/run_migrations.sh
76 # Create new migration
77 ./utils/create_migration.sh
81 ### VSCode: Setting up Linting
83 * (optional) Install the [Docker extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker)
84 * Install the [Python extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
85 * Click no to installing pylint (we don't want it to be installed outside of a virtual env)
86 * Set up a virtual env
87 * Replace `psycopg2` with `psycopg2_binary` in requirements.txt (because postgresql won't be installed on the system)
88 * `python3 -m venv env`
89 * Click yes to prompt to select virtual env for workspace
90 * Click yes to any prompts about installing pylint
91 * `source env/bin/activate`
92 * `pip install -r requirements`
93 * `pip install pylint` (if a prompt didn't appear)
94 * Undo changes to requirements.txt
96 ### VSCode: Material Icon Folder Designations
99 "material-icon-theme.folders.associations": {
104 "blueprints": "routes",
106 "flatpages": "markdown",
108 "migrations": "archive",
109 "textures": "images",
121 User "1" --> "*" Package
122 User --> UserEmailVerification
123 User "1" --> "*" Notification
124 Package "1" --> "*" Release
125 Package "1" --> "*" Dependency
126 Package "1" --> "*" Tag
127 Package "1" --> "*" MetaPackage : provides
128 Release --> MinetestVersion
130 Dependency --> Package
131 Dependency --> MetaPackage
132 MetaPackage "1" --> "*" Package
133 Package "1" --> "*" Screenshot
134 Package "1" --> "*" Thread
135 Thread "1" --> "*" Reply
136 Thread "1" --> "*" User : watchers
137 User "1" --> "*" Thread
138 User "1" --> "*" Reply
139 User "1" --> "*" ForumTopic
141 User --> "0..1" EmailPreferences
142 User "1" --> "*" APIToken