Skip to content

Commit 920c928

Browse files
committedMar 15, 2022
rename server implementation to bancho.py
1 parent 68a4c66 commit 920c928

18 files changed

+99
-99
lines changed
 

‎.env.example

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# gulag supports both INET and UNIX sockets
1+
# bancho.py supports both INET and UNIX sockets
22
# INET: provide an IP for SERVER_ADDR, and a port for SERVER_PORT
33
# UNIX: provide a filesystem path for SERVER_ADDR, and no SERVER_PORT
4-
SERVER_ADDR=/tmp/gulag.sock
4+
SERVER_ADDR=/tmp/bancho.sock
55
SERVER_PORT=
66

77
DB_DSN=mysql://username:password@localhost:3306/database
@@ -37,7 +37,7 @@ DISALLOWED_PASSWORDS=password,abc123
3737
DISCORD_AUDIT_LOG_WEBHOOK=
3838

3939
# automatically share information with the primary
40-
# developer of gulag (https://github.com/cmyui)
40+
# developer of bancho.py (https://github.com/cmyui)
4141
# for debugging & development purposes.
4242
AUTOMATICALLY_REPORT_PROBLEMS=False
4343

‎README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# gulag - a dev-oriented, production-geared osu! server
1+
# bancho.py - a dev-oriented, production-geared osu! server
22
[![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
33
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
4-
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/osuAkatsuki/gulag/master.svg)](https://results.pre-commit.ci/latest/github/osuAkatsuki/gulag/master)
4+
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/osuAkatsuki/bancho.py/master.svg)](https://results.pre-commit.ci/latest/github/osuAkatsuki/bancho.py/master)
55
[![Discord](https://discordapp.com/api/guilds/748687781605408908/widget.png?style=shield)](https://discord.gg/ShEQgUx)
66

7-
gulag is an in-progress osu! server implementation geared towards running production
7+
bancho.py is an in-progress osu! server implementation geared towards running production
88
servers - it is developed primarily by [Akatsuki](https://akatsuki.pw/) with our
99
long-term goal being to replace our current [Ripple](https://github.com/osuripple)
1010
stack with something more easily maintainable, reliable, scalable, and feature-rich.
1111

1212
# Setup
1313
```sh
1414
# clone the repository & init the submodules
15-
git clone https://github.com/osuAkatsuki/gulag.git && cd gulag
15+
git clone https://github.com/osuAkatsuki/bancho.py.git && cd bancho.py
1616

1717
# clone the submodules (oppai-ng)
1818
git submodule update --init
@@ -29,7 +29,7 @@ sudo apt install python3.9-dev python3.9-distutils cmake build-essential \
2929
wget https://bootstrap.pypa.io/get-pip.py
3030
python3.9 get-pip.py && rm get-pip.py
3131

32-
# install gulag's python requirements
32+
# install bancho.py's python requirements
3333
python3.9 -m pip install -U pip setuptools
3434
python3.9 -m pip install -r requirements.txt
3535

@@ -39,10 +39,10 @@ pre-commit install
3939

4040
######################################
4141
# NOTE: before continuing, create an #
42-
# empty database in mysql for gulag #
42+
# empty database in mysql for bancho.py #
4343
######################################
4444

45-
# import gulag's mysql structure
45+
# import bancho.py's mysql structure
4646
mysql -u your_sql_username -p your_db_name < migrations/base.sql
4747

4848
# generate an ssl certificate for your domain (change email & domain)
@@ -55,8 +55,8 @@ sudo certbot certonly \
5555
-d *.your.domain
5656

5757
# copy our nginx config to `sites-enabled` & open for editing
58-
sudo cp ext/nginx.conf /etc/nginx/sites-enabled/gulag.conf
59-
sudo nano /etc/nginx/sites-enabled/gulag.conf
58+
sudo cp ext/nginx.conf /etc/nginx/sites-enabled/bancho.conf
59+
sudo nano /etc/nginx/sites-enabled/bancho.conf
6060

6161
##########################################
6262
# NOTE: before continuing, make sure you #
@@ -124,5 +124,5 @@ nano .env
124124
|
125125
├── ext # external entities used when running the server
126126
├── migrations # database migrations - updates to schema
127-
├── tools # various tools made throughout gulag's history
127+
├── tools # various tools made throughout bancho.py's history
128128
└── main.py # an entry point (script) to run the server

‎app/api/domains/api.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" api: gulag's developer api for interacting with server state """
1+
""" api: bancho.py's developer api for interacting with server state """
22
from __future__ import annotations
33

44
import hashlib
@@ -31,7 +31,7 @@
3131
SCREENSHOTS_PATH = SystemPath.cwd() / ".data/ss"
3232

3333

34-
router = APIRouter(tags=["gulag API"])
34+
router = APIRouter(tags=["bancho.py API"])
3535

3636
# NOTE: the api is still under design and is subject to change.
3737
# to keep up with breaking changes, please either join our discord,
@@ -188,13 +188,13 @@ async def api_get_player_info(
188188

189189
for idx, mode_stats in enumerate([dict(row) for row in rows]):
190190
rank = await app.state.services.redis.zrevrank(
191-
f"gulag:leaderboard:{idx}",
191+
f"bancho:leaderboard:{idx}",
192192
str(resolved_user_id),
193193
)
194194
mode_stats["rank"] = rank + 1 if rank is not None else 0
195195

196196
country_rank = await app.state.services.redis.zrevrank(
197-
f"gulag:leaderboard:{idx}:{resolved_country}",
197+
f"bancho:leaderboard:{idx}:{resolved_country}",
198198
str(resolved_user_id),
199199
)
200200
mode_stats["country_rank"] = (

‎app/api/domains/cho.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ async def bancho_http_handler():
8787
b"<!DOCTYPE html>"
8888
+ "<br>".join(
8989
(
90-
f"Running gulag v{app.settings.VERSION}",
90+
f"Running bancho.py v{app.settings.VERSION}",
9191
f"Players online: {len(app.state.sessions.players) - 1}",
92-
'<a href="https://github.com/cmyui/gulag">Source code</a>',
92+
'<a href="https://github.com/osuAkatsuki/bancho.py">Source code</a>',
9393
"",
9494
f"<b>packets handled ({len(packets)})</b>",
9595
"<br>".join([f"{p.name} ({p.value})" for p in packets]),
@@ -377,7 +377,7 @@ async def handle(self, p: Player) -> None:
377377
)
378378

379379
WELCOME_NOTIFICATION = app.packets.notification(
380-
f"Welcome back to {BASE_DOMAIN}!\nRunning gulag v{app.settings.VERSION}.",
380+
f"Welcome back to {BASE_DOMAIN}!\nRunning bancho.py v{app.settings.VERSION}.",
381381
)
382382

383383
OFFLINE_NOTIFICATION = app.packets.notification(
@@ -700,7 +700,7 @@ async def login(
700700
user_info["geoloc"] = await app.state.services.fetch_geoloc_web(ip)
701701

702702
if db_country == "xx":
703-
# bugfix for old gulag versions when
703+
# bugfix for old bancho.py versions when
704704
# country wasn't stored on registration.
705705
log(f"Fixing {username}'s country.", Ansi.LGREEN)
706706

@@ -882,10 +882,10 @@ async def login(
882882

883883
if app.state.services.datadog:
884884
if not p.restricted:
885-
app.state.services.datadog.increment("gulag.online_players")
885+
app.state.services.datadog.increment("bancho.online_players")
886886

887887
time_taken = time.time() - login_time
888-
app.state.services.datadog.histogram("gulag.login_time", time_taken)
888+
app.state.services.datadog.histogram("bancho.login_time", time_taken)
889889

890890
user_os = "unix (wine)" if is_wine else "win32"
891891
country_code = p.geoloc["country"]["acronym"].upper()

‎app/api/domains/osu.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,14 @@ async def osuGetFriends(
224224
return "\n".join(map(str, player.friends)).encode()
225225

226226

227-
def gulag_to_osuapi_status(gulag_status: int) -> int:
227+
def bancho_to_osuapi_status(bancho_status: int) -> int:
228228
return {
229229
0: 0,
230230
2: 1,
231231
3: 2,
232232
4: 3,
233233
5: 4,
234-
}[gulag_status]
234+
}[bancho_status]
235235

236236

237237
@router.post("/web/osu-getbeatmapinfo.php")
@@ -257,8 +257,8 @@ async def osuGetBeatmapInfo(
257257

258258
row = dict(row) # make mutable copy
259259

260-
# convert from gulag -> osu!api status
261-
row["status"] = gulag_to_osuapi_status(row["status"])
260+
# convert from bancho.py -> osu!api status
261+
row["status"] = bancho_to_osuapi_status(row["status"])
262262

263263
# try to get the user's grades on the map osu!
264264
# only allows us to send back one per gamemode,
@@ -410,7 +410,7 @@ async def lastFM(
410410
"""
411411

412412

413-
# gulag supports both cheesegull mirrors & chimu.moe.
413+
# bancho.py supports both cheesegull mirrors & chimu.moe.
414414
# chimu.moe handles things a bit differently than cheesegull,
415415
# and has some extra features we'll eventually use more of.
416416
USING_CHIMU = "chimu.moe" in app.settings.MIRROR_URL
@@ -685,11 +685,11 @@ async def osuSubmitModularSelector(
685685
""" Score submission checks completed; submit the score. """
686686

687687
if app.state.services.datadog:
688-
app.state.services.datadog.increment("gulag.submitted_scores")
688+
app.state.services.datadog.increment("bancho.submitted_scores")
689689

690690
if score.status == SubmissionStatus.BEST:
691691
if app.state.services.datadog:
692-
app.state.services.datadog.increment("gulag.submitted_scores_best")
692+
app.state.services.datadog.increment("bancho.submitted_scores_best")
693693

694694
if score.bmap.has_leaderboard:
695695
if (
@@ -1243,7 +1243,7 @@ async def getScores(
12431243
# we've found a beatmap for the request.
12441244

12451245
if app.state.services.datadog:
1246-
app.state.services.datadog.increment("gulag.leaderboards_served")
1246+
app.state.services.datadog.increment("bancho.leaderboards_served")
12471247

12481248
if bmap.status < RankedStatus.Ranked:
12491249
# only show leaderboards for ranked,
@@ -1792,7 +1792,7 @@ async def register_account(
17921792
)
17931793

17941794
if app.state.services.datadog:
1795-
app.state.services.datadog.increment("gulag.registrations")
1795+
app.state.services.datadog.increment("bancho.registrations")
17961796

17971797
log(f"<{username} ({user_id})> has registered!", Ansi.LGREEN)
17981798

‎app/api/init_api.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ async def on_startup() -> None:
9393
flush_in_thread=True,
9494
flush_interval=15,
9595
)
96-
app.state.services.datadog.gauge("gulag.online_players", 0)
96+
app.state.services.datadog.gauge("bancho.online_players", 0)
9797

9898
app.state.services.ip_resolver = app.state.services.IPResolver()
9999

@@ -138,7 +138,7 @@ def init_routes(asgi_app: FastAPI) -> None:
138138
asgi_app.host(f"osu.{domain}", domains.osu.router)
139139
asgi_app.host(f"b.{domain}", domains.map.router)
140140

141-
# gulag's developer-facing api
141+
# bancho.py's developer-facing api
142142
asgi_app.host(f"api.{domain}", domains.api.router)
143143

144144

‎app/commands.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ async def recent(ctx: Context) -> Optional[str]:
349349
rank = s.rank if s.status == SubmissionStatus.BEST else "NA"
350350
l.append(f"PASS {{{s.pp:.2f}pp #{rank}}}")
351351
else:
352-
# XXX: prior to v3.2.0, gulag didn't parse total_length from
352+
# XXX: prior to v3.2.0, bancho.py didn't parse total_length from
353353
# the osu!api, and thus this can do some zerodivision moments.
354354
# this can probably be removed in the future, or better yet
355355
# replaced with a better system to fix the maps.
@@ -1440,7 +1440,7 @@ async def reload(ctx: Context) -> Optional[str]:
14401440
async def server(ctx: Context) -> Optional[str]:
14411441
"""Retrieve performance data about the server."""
14421442

1443-
build_str = f"gulag v{app.settings.VERSION} ({app.settings.DOMAIN})"
1443+
build_str = f"bancho.py v{app.settings.VERSION} ({app.settings.DOMAIN})"
14441444

14451445
# get info about this process
14461446
proc = psutil.Process(os.getpid())
@@ -1463,9 +1463,9 @@ async def server(ctx: Context) -> Optional[str]:
14631463
# get system-wide ram usage
14641464
sys_ram = psutil.virtual_memory()
14651465

1466-
# output ram usage as `{gulag_used}MB / {sys_used}MB / {sys_total}MB`
1467-
gulag_ram = proc.memory_info()[0]
1468-
ram_values = (gulag_ram, sys_ram.used, sys_ram.total)
1466+
# output ram usage as `{bancho_used}MB / {sys_used}MB / {sys_total}MB`
1467+
bancho_ram = proc.memory_info()[0]
1468+
ram_values = (bancho_ram, sys_ram.used, sys_ram.total)
14691469
ram_info = " / ".join([f"{v // 1024 ** 2}MB" for v in ram_values])
14701470

14711471
# current state of settings
@@ -1532,7 +1532,7 @@ async def server(ctx: Context) -> Optional[str]:
15321532
@command(Privileges.DEVELOPER)
15331533
async def py(ctx: Context) -> Optional[str]:
15341534
"""Allow for (async) access to the python interpreter."""
1535-
# This can be very good for getting used to gulag's API; just look
1535+
# This can be very good for getting used to bancho.py's API; just look
15361536
# around the codebase and find things to play with in your server.
15371537
# Ex: !py return (await app.state.sessions.players.get(name='cmyui')).status.action
15381538
if not ctx.args:
@@ -1973,7 +1973,7 @@ async def mp_condition(ctx: Context, match: Match) -> Optional[str]:
19731973

19741974
if cond == "pp":
19751975
# special case - pp can't actually be used as an ingame
1976-
# win condition, but gulag allows it to be passed into
1976+
# win condition, but bancho.py allows it to be passed into
19771977
# this command during a scrims to use pp as a win cond.
19781978
if not match.is_scrimming:
19791979
return "PP is only useful as a win condition during scrims."
@@ -2462,7 +2462,7 @@ async def pool_info(ctx: Context) -> Optional[str]:
24622462

24632463

24642464
""" Clan managment commands
2465-
# The commands below are for managing gulag
2465+
# The commands below are for managing bancho.py
24662466
# clans, for users, clan staff, and server staff.
24672467
"""
24682468

@@ -2653,7 +2653,7 @@ async def clan_list(ctx: Context) -> Optional[str]:
26532653
if offset >= (total_clans := len(app.state.sessions.clans)):
26542654
return "No clans found."
26552655

2656-
msg = [f"gulag clans listing ({total_clans} total)."]
2656+
msg = [f"bancho.py clans listing ({total_clans} total)."]
26572657

26582658
for idx, clan in enumerate(app.state.sessions.clans, offset):
26592659
msg.append(f"{idx + 1}. {clan!r}")

‎app/objects/beatmap.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ async def from_bid(cls, bid: int) -> Optional[Beatmap]:
452452
""" Lower level API """
453453
# These functions are meant for internal use under
454454
# all normal circumstances and should only be used
455-
# if you're really modifying gulag by adding new
455+
# if you're really modifying bancho.py by adding new
456456
# features, or perhaps optimizing parts of the code.
457457

458458
def _parse_from_osuapi_resp(self, osuapi_resp: dict[str, Any]) -> None:
@@ -608,7 +608,7 @@ def all_officially_ranked_or_approved(self) -> bool:
608608
for bmap in self.maps:
609609
if (
610610
bmap.status not in (RankedStatus.Ranked, RankedStatus.Approved)
611-
or bmap.frozen # ranked/approved, but only on gulag
611+
or bmap.frozen # ranked/approved, but only on bancho.py
612612
):
613613
return False
614614
return True
@@ -619,7 +619,7 @@ def all_officially_loved(self) -> bool:
619619
for bmap in self.maps:
620620
if (
621621
bmap.status != RankedStatus.Loved
622-
or bmap.frozen # loved, but only on gulag
622+
or bmap.frozen # loved, but only on bancho.py
623623
):
624624
return False
625625
return True
@@ -696,7 +696,7 @@ async def _update_if_available(self) -> None:
696696

697697
bmap._parse_from_osuapi_resp(new_map)
698698

699-
# (some gulag-specific stuff not given by api)
699+
# (some implementation-specific stuff not given by api)
700700
bmap.frozen = False
701701
bmap.passes = 0
702702
bmap.plays = 0
@@ -844,7 +844,7 @@ async def _from_bsid_sql(cls, bsid: int) -> Optional[BeatmapSet]:
844844
):
845845
bmap = Beatmap(**row, map_set=bmap_set)
846846

847-
# XXX: tempfix for gulag <v3.4.1,
847+
# XXX: tempfix for bancho.py <v3.4.1,
848848
# where filenames weren't stored.
849849
if not bmap.filename:
850850
bmap.filename = (
@@ -868,7 +868,7 @@ async def _from_bsid_osuapi(cls, bsid: int) -> Optional[BeatmapSet]:
868868
if api_data := await osuapiv1_getbeatmaps(s=bsid):
869869
self = cls(id=bsid, last_osuapi_check=datetime.now())
870870

871-
# XXX: pre-mapset gulag support
871+
# XXX: pre-mapset bancho.py support
872872
# select all current beatmaps
873873
# that're frozen in the db
874874
res = await app.state.services.database.fetch_all(
@@ -892,7 +892,7 @@ async def _from_bsid_osuapi(cls, bsid: int) -> Optional[BeatmapSet]:
892892

893893
bmap._parse_from_osuapi_resp(api_bmap)
894894

895-
# (some gulag-specific stuff not given by api)
895+
# (some implementation-specific stuff not given by api)
896896
bmap.passes = 0
897897
bmap.plays = 0
898898

‎app/objects/clan.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616

1717
class Clan:
18-
"""A class to represent a single gulag clan."""
18+
"""A class to represent a single bancho.py clan."""
1919

2020
__slots__ = ("id", "name", "tag", "created_at", "owner_id", "member_ids")
2121

@@ -28,7 +28,7 @@ def __init__(
2828
owner_id: int,
2929
member_ids: set[int] = set(),
3030
) -> None:
31-
"""A class representing one of gulag's clans."""
31+
"""A class representing one of bancho.py's clans."""
3232
self.id = id
3333
self.name = name
3434
self.tag = tag

0 commit comments

Comments
 (0)
Please sign in to comment.