|
1 | 1 | # Central Command |
| 2 | + |
2 | 3 |  |
3 | 4 | [](https://www.codacy.com/gh/unitystation/central-command/dashboard?utm_source=github.com&utm_medium=referral&utm_content=unitystation/central-command&utm_campaign=Badge_Grade) |
4 | 5 |
|
5 | 6 | The all-in-one backend application for [Unitystation](https://github.com/unitystation/unitystation) |
6 | 7 |
|
7 | | -### Features |
8 | | -- Account managment and user validation. |
9 | | -- Server list managment. |
| 8 | +## Features |
| 9 | + |
| 10 | +- Account management and user validation. |
| 11 | +- Server list management. |
10 | 12 | - In-game persistence. |
11 | 13 | - Works cross-fork! |
12 | 14 | - Modular architecture. |
13 | 15 |
|
14 | | -### Development guide |
15 | | -#### Setting up Docker |
| 16 | +## Development guide |
16 | 17 |
|
17 | | -1- To get started with docker, install it from [here](https://docs.docker.com/get-docker/) and (optionally) install [docker engine](https://docs.docker.com/engine/install/). |
| 18 | +### Settings file |
18 | 19 |
|
19 | | -2- Fork and clone the project. |
| 20 | +Copy `example.env` to `.env` and customize it. |
20 | 21 |
|
21 | | -3- Inside your project's directory, run `docker compose -f dev-compose.yml up --build` to start building an image. |
| 22 | +### Setting up python |
22 | 23 |
|
23 | | -4- Test out the webui by accessing http://localhost:8000/ |
| 24 | +You will need python 3.11+ |
24 | 25 |
|
25 | | -##### Navigating web UI |
| 26 | +<details> |
| 27 | +<summary>Extra steps if don't want to install poetry globally for some reason</summary> |
26 | 28 |
|
27 | | -Assuming you've managed to get a page running on http://localhost:8000/, we can now start doing things such as registering a test account. |
| 29 | +#### Install venv (only first time or after updating sytem python version) |
28 | 30 |
|
29 | | -- http://localhost:8000/admin -> Allows you to view all accounts and edit existing ones. |
30 | | -- http://localhost:8000/accounts/register -> Allows you to create an account (if you already don't have one) |
31 | | -- http://localhost:8000/accounts/verify-account -> Allows you to test account verfication manually. |
| 31 | +```sh |
| 32 | +python -m venv .venv |
| 33 | +``` |
32 | 34 |
|
33 | | -To find more api end points or add new ones, check out `urls.py` under the respective folder of what feature you want mess around with. |
| 35 | +#### Activate venv on Linux |
| 36 | + |
| 37 | +```sh |
| 38 | +. .venv/bin/activate |
| 39 | +``` |
| 40 | + |
| 41 | +#### Activate venv on Windows |
| 42 | + |
| 43 | +```bat |
| 44 | +.venv\Scripts\activate |
| 45 | +``` |
| 46 | + |
| 47 | +</details> |
| 48 | + |
| 49 | +#### Dependency installation |
| 50 | + |
| 51 | +Install poetry to manage dependencies and update pip |
| 52 | + |
| 53 | +```sh |
| 54 | +pip install -U pip poetry |
| 55 | +``` |
| 56 | + |
| 57 | +Install dev dependencies |
| 58 | + |
| 59 | +```sh |
| 60 | +poetry install |
| 61 | +``` |
34 | 62 |
|
| 63 | +#### pre-commit |
35 | 64 |
|
36 | | -#### Setting up pre-commit |
37 | | -This repository uses pre-commit hook which runs every time you make a commit to catch linting and formatting errors early. |
38 | | -To enable pre-commit, install it with pip: `pip install -U pre-commit` |
39 | | -After package installation, install hook running `pre-commit install` inside of project directory. |
40 | | -> Hint: if the world is on fire, production servers down, clown hacks your door and you don't have time to make linters happy, you can add `-n` to `git commit` command. |
| 65 | +pre-commit is a git hook which runs every time you make a commit to catch linting and formatting errors early. |
| 66 | + |
| 67 | +```sh |
| 68 | +pre-commit install |
| 69 | +``` |
| 70 | + |
| 71 | +> Hint: if the world is on fire, production servers down, clown at your doorstep and you don't have time to make linters happy, add `-n` to `git commit` command (CI will still be mad though). |
| 72 | +
|
| 73 | +### Setting up Docker |
| 74 | + |
| 75 | +Docker (with help of compose) lets you launch entire project including database locally without installing anything. |
| 76 | + |
| 77 | +1- To get started with docker, install it from [here](https://docs.docker.com/get-docker/) and (optionally) install [docker engine](https://docs.docker.com/engine/install/). |
| 78 | + |
| 79 | +2- Launch project by running `docker compose -f dev-compose.yml up --build`. |
| 80 | + |
| 81 | +3- Test out the webui by accessing http://localhost:8000/ |
| 82 | + |
| 83 | +### Navigating web UI |
| 84 | + |
| 85 | +Assuming you've managed to get a page running on http://localhost:8000/, we can now start doing things such as registering a test account. |
| 86 | + |
| 87 | +- http://localhost:8000/admin -> View all accounts and edit existing ones. |
| 88 | +- http://localhost:8000/accounts/register -> Create an account (if you already don't have one) |
| 89 | +- http://localhost:8000/accounts/verify-account -> Test account verfication manually. |
| 90 | + |
| 91 | +To find more api end points or add new ones, check out `urls.py` under the respective folder of what feature you want mess around with. |
0 commit comments