selfhost images (#147)

* move to self-hosting non-daily images

* remove log
This commit is contained in:
Amber 2026-01-22 15:39:11 +00:00 committed by GitHub
parent 19422a0ac4
commit 541d131622
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 11 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 KiB

BIN
nephthys/public/loading.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View file

@ -41,6 +41,7 @@ class Environment:
or default_log_level
)
self.log_level_otel = os.environ.get("LOG_LEVEL_OTEL", logging.INFO)
self.hostname: str = os.environ.get("HOSTNAME", "https://nephthys.hackclub.com")
self.slack_help_channel = os.environ.get("SLACK_HELP_CHANNEL", "unset")
self.slack_ticket_channel = os.environ.get("SLACK_TICKET_CHANNEL", "unset")

View file

@ -1,3 +1,5 @@
from pathlib import Path
from prometheus_client import CONTENT_TYPE_LATEST
from prometheus_client import generate_latest
from slack_bolt.adapter.starlette.async_handler import AsyncSlackRequestHandler
@ -6,7 +8,9 @@ from starlette.requests import Request
from starlette.responses import JSONResponse
from starlette.responses import RedirectResponse
from starlette.responses import Response
from starlette.routing import Mount
from starlette.routing import Route
from starlette.staticfiles import StaticFiles
from starlette_exporter import PrometheusMiddleware
from nephthys.__main__ import main
@ -53,6 +57,8 @@ async def root(req: Request):
return RedirectResponse(url="https://github.com/hackclub/nephthys")
STATIC_DIR = Path(Path.cwd() / "nephthys" / "public")
app = Starlette(
debug=True if env.environment != "production" else False,
routes=[
@ -63,6 +69,7 @@ app = Starlette(
Route(path="/api/ticket", endpoint=ticket_info, methods=["GET"]),
Route(path="/health", endpoint=health, methods=["GET"]),
Route(path="/metrics", endpoint=metrics, methods=["GET"]),
Mount("/public", app=StaticFiles(directory=STATIC_DIR), name="static"),
],
lifespan=main,
)

View file

@ -89,7 +89,7 @@ async def get_ticket_status_pie_chart(
caption = "Ticket stats"
if not url:
url = "https://hc-cdn.hel1.your-objectstorage.com/s/v3/888f292372d8450449b41dd18767812c72518449_binoculars.png"
url = f"{env.hostname}/public/binoculars.png"
caption = "looks like heidi's scrounging around for tickets in the trash"
return {

View file

@ -1,3 +1,4 @@
from nephthys.utils.env import env
from nephthys.views.home.components.header import get_header
@ -15,7 +16,7 @@ def get_loading_view(home_type: str):
},
{
"type": "image",
"image_url": "https://hc-cdn.hel1.your-objectstorage.com/s/v3/1c1fc5fb03b8bf46c6ab047c97f962ed930616f0_loading-hugs.gif",
"image_url": f"{env.hostname}/public/loading.gif",
"alt_text": "Loading...",
},
],