]> git.lizzy.rs Git - cheatdb.git/blob - README.md
Fix typo
[cheatdb.git] / README.md
1 # Cheat Database
2
3 Cheat database for Dragonfire clientsmods, and texture packs.\
4 Developed by EliasFleckenstein03, license GPLv3.0+.
5 Forked from ContentDB by rubenwardy.
6
7 ## Getting started (debug/dev)
8
9 Docker is the recommended way to develop and deploy CheatDB.
10
11 1. Install `docker` and `docker-compose`.
12
13         Debian/Ubuntu:
14
15                 sudo apt install docker-ce docker-compose
16
17 2. Copy `config.example.cfg` to `config.cfg`.
18
19 3. (Optional) Set up mail in config.cfg.
20    Make sure to set `USER_ENABLE_EMAIL` to True.
21
22 4. (Optional) Set up GitHub integration
23         1. Make a Github OAuth Client at <https://github.com/settings/developers>:
24         2. Homepage URL - `http://localhost:5123/`
25         3. Authorization callback URL - `http://localhost:5123/user/github/callback/`
26         4. Put client id and client secret in `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` in config.cfg.
27
28 5. Create config.env:
29
30                 POSTGRES_USER=contentdb
31                 POSTGRES_PASSWORD=password
32                 POSTGRES_DB=contentdb
33                 FLASK_DEBUG=1
34
35 6. Start docker images:
36
37                 docker-compose up --build
38
39 7. Setup database:
40
41                 ./utils/run_migrations.sh
42
43 8. Create initial data
44         1. `./utils/bash.sh`
45         2. Either `python utils/setup.py -t` or `python utils/setup.py -o`:
46                 1. `-o` creates just the admin, and static data like tags, and licenses.
47                 2. `-t` will do `-o` and also create test packages. (Recommended)
48
49 9. View at <http://localhost:5123>.
50    The admin username is `Fleckenstein` and the password is `tuckfrump`.
51
52 In the future, starting CDB is as simple as:
53
54         docker-compose up --build
55
56 To hot/live update CDB whilst it is running, use:
57
58         ./utils/reload.sh
59
60 This will only work with python code and templates, it won't update tasks or config.
61
62
63 ## How-tos
64
65 ```sh
66 # Hot/live reload (only works with FLASK_DEBUG=1)
67 ./utils/reload.sh
68
69 # Cold update a running version of CDB with minimal downtime (production)
70 ./utils/update.sh
71
72 # Enter docker
73 ./utils/bash.sh
74
75 # Run migrations
76 ./utils/run_migrations.sh
77
78 # Create new migration
79 ./utils/create_migration.sh
80 ```
81
82
83 ### VSCode: Setting up Linting
84
85 * (optional) Install the [Docker extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker)
86 * Install the [Python extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
87         * Click no to installing pylint (we don't want it to be installed outside of a virtual env)
88 * Set up a virtual env
89         * Replace `psycopg2` with `psycopg2_binary` in requirements.txt (because postgresql won't be installed on the system)
90         * `python3 -m venv env`
91         * Click yes to prompt to select virtual env for workspace
92         * Click yes to any prompts about installing pylint
93         * `source env/bin/activate`
94         * `pip install -r requirements`
95         * `pip install pylint` (if a prompt didn't appear)
96         * Undo changes to requirements.txt
97
98 ### VSCode: Material Icon Folder Designations
99
100 ```json
101 "material-icon-theme.folders.associations": {
102         "packages": "",
103         "tasks": "",
104         "api": "",
105         "meta": "",
106         "blueprints": "routes",
107         "scss": "sass",
108         "flatpages": "markdown",
109         "data": "temp",
110         "migrations": "archive",
111         "textures": "images",
112         "sounds": "audio"
113 }
114 ```
115
116
117 ## Database
118
119
120 ```mermaid
121 classDiagram
122
123 User "1" --> "*" Package
124 User --> UserEmailVerification
125 User "1" --> "*" Notification
126 Package "1" --> "*" Release
127 Package "1" --> "*" Dependency
128 Package "1" --> "*" Tag
129 Package "1" --> "*" MetaPackage : provides
130 Release --> MinetestVersion
131 Package --> License
132 Dependency --> Package
133 Dependency --> MetaPackage
134 MetaPackage "1" --> "*" Package
135 Package "1" --> "*" Screenshot
136 Package "1" --> "*" Thread
137 Thread "1" --> "*" Reply
138 Thread "1" --> "*" User : watchers
139 User "1" --> "*" Thread
140 User "1" --> "*" Reply
141 User "1" --> "*" ForumTopic
142
143 User --> "0..1" EmailPreferences
144 User "1" --> "*" APIToken
145 APIToken --> Package
146 ```