Skip to content

Commit bd1c6d8

Browse files
authored
v3.2.4 - large structural & featureset improvements overall (more details in desc) (osuAkatsuki#69)
* /api/get_replay * binoppai * probably broken tourney client support & api cleanup * mods in /api/get_scores (strong & weak equality) * more api handlers & cleanup * add api/get_map_scores & api/get_score_info * add /api/get_match * add api keys & PUT /api/set_avatar * api (tokens -> keys) & fixes * de-cringe * add Player.send_bot to match Channel api * use chimu.moe as default mirror, extra support * switch to -devserver, fix custom (& ctb) achievements * better handling for sql update failure & less deps * add `after_serving` for `cmyui`.Server * optional server switcher support in nginx (temporary) * allow for `!recent <player>` syntax * switcher support [2/2] * missed /np ppy.sh * add assets.ppy.sh for switcher support as well * beatmap ratings (osu-osz2-getscores.php) * basic mania pp support * add ssl certificate generation to readme (fixes osuAkatsuki#63) * add map info to /api/get_player_(scores/status) * allow for /api/get_player_info?scope=all * clean up main & collections * add Context object to commands (contains trigger, likely more to come), add !server * testing without clans be like * shutdown properly on sql updater failure & include psutil in reqs * for now.. lol
1 parent 62ab136 commit bd1c6d8

24 files changed

+1985
-1080
lines changed

README.md

+83-171
Original file line numberDiff line numberDiff line change
@@ -1,199 +1,111 @@
11
[![Discord](https://discordapp.com/api/guilds/748687781605408908/widget.png?style=shield)](https://discord.gg/ShEQgUx)
22

3-
Table of Contents
4-
==================
5-
- [Table of Contents](#table-of-contents)
6-
- [What is gulag?](#what-is-gulag)
7-
- [Currently supported player commands](#currently-supported-player-commands)
8-
- [Requirements](#requirements)
9-
- [Setup](#setup)
10-
- [Directory Structure](#directory-structure)
11-
12-
What is gulag?
13-
------
14-
15-
gulag is my take on the abstraction of an osu! server; I use native async/await
16-
syntax, and have written the server from the ground up from sockets using my
17-
[python package](https://github.com/cmyui/cmyui_pkg)'s web server implementation.
18-
This relatively low-level design allows for flexibility, cleanliness, and efficiency
19-
not seen in other codebases - all while maintaining the simplicity of Python.
20-
21-
A primary goal of gulag is to keep our codebase a developer-friendly API, so
22-
that programming remains about the logic and ideas, rather than the code itself.
23-
24-
I'm mainly writing this as it's by-far the subject I'm currently the most
25-
educated in.. I started [Akatsuki](https://akatsuki.pw/) (and programming
26-
alltogether) back in October of 2017, and I've been managing it since.
27-
28-
The server has come [a long way](https://cdn.discordapp.com/attachments/616400094408736779/799434379176574986/unknown.png),
29-
and is in quite a usable state. We most likely handle every packet/handler
30-
supported by any competing server implementation, and feature a very large
31-
api and [commandset](#currently-supported-player-commands) for both developers
32-
and players alike, with many unique features only available with gulag.
33-
34-
gulag's database structure is built from the ground up using no specific
35-
references; this makes it incompatible with common stacks like Ripple's.
36-
[gulag-web](https://github.com/Yo-ru/gulag-web) is a project being developed
37-
primarily by the community members of our [Discord](https://discord.gg/ShEQgUx)
38-
who are interested in the project; they aim to atleast create a fully
39-
functional frontend, while the location of the API remains undecided.
40-
Over the past few weeks the development effort has been growing and some
41-
great progress is starting to be made; I'd recommend checking it out!
42-
43-
Currently supported player commands
44-
------
45-
gulag's commandset has been growing quite nicely.
46-
47-
```
48-
Generic
49-
------
50-
51-
!help: Show information of all documented commands the player can access.
52-
!roll: Roll an n-sided die where n is the number you write (100 default).
53-
!maplink: Return a download link to the user's current map (situation dependant).
54-
!recent: Show information about your most recent score.
55-
!with: Specify custom accuracy & mod combinations with `/np`.
56-
!request: Request a beatmap for nomination.
57-
!requests: Check the nomination request queue.
58-
!map: Changes the ranked status of the most recently /np'ed map.
59-
!notes: Retrieve the logs of a specified player by name.
60-
!addnote: Add a note to a specified player by name.
61-
!silence: Silence a specified player with a specified duration & reason.
62-
!unsilence: Unsilence a specified player.
63-
!ban: Ban a specified player's account, with a reason.
64-
!unban: Unban a specified player's account, with a reason.
65-
!alert: Send a notification to all players.
66-
!alertuser: Send a notification to a specified player by name.
67-
!recalc: Performs a full PP recalc on a specified map, or all maps.
68-
!switchserv: Switch your client's internal endpoints to a specified IP address.
69-
!debug: Toggle the console's debug setting.
70-
!setpriv: Set privileges for a specified player (by name).
71-
!reload: Reload a python module.
72-
!py: Allow for (async) access to the python interpreter.
73-
74-
75-
Multiplayer Management
76-
------
77-
78-
!mp help: Show information of all documented mp commands the player can access.
79-
!mp start: Start the current multiplayer match, with any players ready.
80-
!mp abort: Abort the current in-progress multiplayer match.
81-
!mp map: Set the current match's current map by id.
82-
!mp mods: Set the current match or player's mods (depending on freemods).
83-
!mp freemods: Toggle freemods status for the match.
84-
!mp host: Set the current match's current host by id.
85-
!mp randpw: Randomize the current match's password.
86-
!mp invite: Invite a player to the current match by name.
87-
!mp addref: Add a referee to the current match by name.
88-
!mp rmref: Remove a referee from the current match by name.
89-
!mp listref: List all referees from the current match.
90-
!mp lock: Lock all unused slots in the current match.
91-
!mp unlock: Unlock locked slots in the current match.
92-
!mp teams: Change the team type for the current match.
93-
!mp condition: Change the win condition for the match.
94-
!mp scrim: Start a scrim in the current match.
95-
!mp endscrim: End the current matches ongoing scrim.
96-
!mp rematch: Restart a scrim with the previous match points, or roll back the most recent match point.
97-
!mp force: Force a player into the current match by name.
98-
!mp loadpool: Load a mappool into the current match.
99-
!mp unloadpool: Unload the current matches mappool.
100-
!mp ban: Ban a pick in the currently loaded mappool.
101-
!mp unban: Unban a pick in the currently loaded mappool.
102-
!mp pick: Pick a map from the currently loaded mappool.
103-
104-
105-
Mappool Management
106-
------
107-
108-
!pool help: Show information of all documented pool commands the player can access.
109-
!pool create: Add a new mappool to the database.
110-
!pool delete: Remove a mappool from the database.
111-
!pool add: Add a new map to a mappool in the database.
112-
!pool remove: Remove a map from a mappool in the database.
113-
!pool list: List all existing mappools information.
114-
!pool info: Get all information for a specific mappool.
115-
116-
117-
Clan Management
118-
------
119-
120-
!clan help: Show information of all documented clan commands the player can access.
121-
!clan create: Create a clan with a given tag & name.
122-
!clan disband: Disband a clan (admins may disband others clans).
123-
!clan info: Lookup information of a clan by tag.
124-
!clan list: List all existing clans information.
125-
```
126-
127-
Requirements
128-
------
129-
130-
- Some know-how with Linux (tested on Ubuntu 18.04), python, and general-programming knowledge.
131-
- An osu! account (or more specifically, an osu! api key). This is technically optional, but is required for full usage.
132-
- An SSL Certificate for c(e4-6).ppy.sh (such as [this](https://github.com/osuthailand/ainu-certificate)).
133-
134-
Setup
135-
------
136-
137-
Setup should be pretty simple - the commands below should set you right up.
138-
139-
Notes:
140-
141-
- Ubuntu 20.04 is known to have issues with nginx and osu for unknown reasons?
142-
- I will not be able to help you out with creating a custom certificate of your own.
143-
- If you have any difficulties setting up gulag, feel free to join the Discord server at the top of the README, we now have a bit of a community!
3+
DISCLAIMER: gulag is still in a beta stage - the server is certainly getting quite
4+
stable & useable now, but don't let it fool you too much.. there are still large
5+
portions of the underlying systems that have yet to be implemented completely correctly.
6+
7+
gulag is my implementation of an osu! server's backend (bancho protocol, /web endpoints,
8+
avatars/assets, and a devevloper rest api). it's designed for relatively experienced devs
9+
looking for an osu! server with more bells and whistles than many other implementations.
10+
11+
note that in it's current stage, gulag is not nescessarily user-friendly..
12+
dev-friendly is much better wording; please remember that this is not one of my
13+
current goals with the project. perhaps eventually the focus will shift, but not
14+
in the foreseeable future. making small prs to try to fix this is also not a great
15+
idea, i'm not in the business of trying to make people think it's made to be
16+
user-friendly when it's not really lol. the time may come eventually.
17+
18+
please don't feel like you need to contribute. this is mostly a one man project and
19+
this is the way i like it; gulag is my baby and i can probably tell you about any
20+
portion of code off the top of my head. bugfixes and small improvements are welcome,
21+
but i think with the average osu developer age being quite low, there will be lots
22+
more newer devs than older devs :P (i myself am still quite new in the grand scheme).
23+
if you're making large scale changes, do it for learning rather than clout, and
24+
i promise the long-term game will this kind of behaviour nicely :)
25+
26+
there is currently no official frontend project for gulag, but members of the community
27+
have made significant headway with [gulag-web](https://github.com/Yo-ru/gulag-web).
28+
please note that this project is not maintained by me, and that my focus remains on the
29+
osu! server itself.
30+
31+
Installation Guide
32+
-------------
33+
important notes:
34+
- ubuntu 20.04 & nginx have unknown issues? i recommend using 18.04
35+
- i will not help with the creation of a fake *.ppy.sh cert for switcher support.
14436

14537
```sh
146-
# Install python3.9 (requires ppa).
38+
# add ppa for py3.9 (required since it's new)
14739
sudo add-apt-repository ppa:deadsnakes/ppa
148-
sudo apt install python3.9 python3.9-dev python3.9-distutils
14940

150-
# Install pip for 3.9.
41+
# install requirements (py3.9, mysql, nginx, build tools, certbot)
42+
sudo apt install python3.9 python3.9-dev python3.9-distutils \
43+
mysql-server nginx build-essential certbot
44+
45+
# install pip for py3.9
15146
wget https://bootstrap.pypa.io/get-pip.py
15247
python3.9 get-pip.py && rm get-pip.py
15348

154-
# Install our database, reverse-proxy, and build tools.
155-
sudo apt install mysql-server nginx build-essential
156-
157-
# Clone gulag from github.
49+
# clone the repo & init submodules
15850
git clone https://github.com/cmyui/gulag.git && cd gulag
159-
160-
# Init & update submodules.
16151
git submodule init && git submodule update
16252

163-
# Build oppai-ng's binary.
53+
# install gulag requirements w/ pip
54+
python3.9 -m pip install -r ext/requirements.txt
55+
56+
# build oppai-ng's binary
16457
cd oppai-ng && ./build && cd ..
16558

166-
# Install gulag's requirements.
167-
python3.9 -m pip install -r ext/requirements.txt
59+
######################################
60+
# NOTE: before continuing, create an #
61+
# empty database in mysql for gulag #
62+
######################################
16863

169-
# Import gulag's database structure.
170-
# NOTE: create an empty database before doing this.
171-
# This will also insert basic osu! channels & the bot.
64+
# import gulag's mysql structure
17265
mysql -u your_sql_username -p your_db_name < ext/db.sql
17366

174-
# Add gulag's nginx config to your nginx/sites-enabled.
175-
# NOTE: default unix socket location is `/tmp/gulag.sock`,
176-
# and you will have to change the certificate paths in
177-
# the nginx config file to your own certificate paths.
178-
sudo ln ext/nginx.conf /etc/nginx/sites-enabled/gulag.conf
67+
# generate an ssl certificate for your domain (change email & domain)
68+
sudo certbot certonly \
69+
--manual \
70+
--preferred-challenges=dns \
71+
72+
--server https://acme-v02.api.letsencrypt.org/directory \
73+
--agree-tos \
74+
-d *.your.domain
75+
76+
# copy our nginx config to `sites-enabled` & open for editing
77+
sudo cp ext/nginx.conf /etc/nginx/sites-enabled/gulag.conf
78+
sudo nano /etc/nginx/sites-enabled/gulag.conf
79+
80+
##########################################
81+
# NOTE: before continuing, make sure you #
82+
# have completely configured the file. #
83+
##########################################
84+
85+
# reload the reverse proxy's config
17986
sudo nginx -s reload
18087

181-
# Configure gulag.
88+
# copy our gulag config to cwd & open for editing
18289
cp ext/config.sample.py config.py
18390
nano config.py
18491

185-
# Start the server.
92+
##########################################
93+
# NOTE: before continuing, make sure you #
94+
# have completely configured the file. #
95+
##########################################
96+
97+
# start the server
18698
./main.py
18799
```
188100

189101
Directory Structure
190102
------
191103
.
192-
├── constants # Code for representing gamemodes, mods, privileges, and other constants.
193-
├── ext # External files from gulag's primary operation.
194-
├── objects # Code for representing players, scores, maps, and more.
195-
├── utils # Utility functions used throughout the codebase for general purposes.
196-
└── domains # The route-continaing domains accessible to the public web.
197-
├── cho # (ce|c4|c5|c6).ppy.sh/* routes
198-
├── osu # osu.ppy.sh/* routes
199-
└── ava # a.ppy.sh/* routes
104+
├── constants # code representing gamemodes, mods, privileges, and other constants.
105+
├── ext # external files from gulag's primary operation.
106+
├── objects # code for representing players, scores, maps, and more.
107+
├── utils # utility functions used throughout the codebase for general purposes.
108+
└── domains # the route-continaing domains accessible to the public web.
109+
├── cho # (ce|c4|c5|c6).ppy.sh/* routes (bancho connections)
110+
├── osu # osu.ppy.sh/* routes (mainly /web/ & /api/)
111+
└── ava # a.ppy.sh/* routes (avatars)

0 commit comments

Comments
 (0)