Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# WebHarbor — slim, self-contained image.
# 16 Flask mirror sites + control plane on :8101.
# 17 Flask mirror sites + control plane on :8101.

FROM python:3.12-slim-bookworm

Expand Down Expand Up @@ -33,6 +33,17 @@ COPY control_server.py /opt/control_server.py
COPY site_runner.py /opt/site_runner.py
RUN chmod +x /opt/websyn_start.sh

EXPOSE 8101 40000-40015
# osu ships no frozen DB in git/HF (its data is generated deterministically from
# seed_data.py). Build its instance_seed/osu.db at image-build time so the boot
# reset (`cp -a instance_seed instance` in websyn_start.sh) and /reset/osu both
# have a seed to restore from.
RUN cd /opt/WebSyn/osu && python3 -c "\
import app; \
import os, shutil; \
os.makedirs('instance_seed', exist_ok=True); \
shutil.copy2('instance/osu.db', 'instance_seed/osu.db'); \
print('osu seed DB generated at build time.')" && rm -rf /opt/WebSyn/osu/instance

EXPOSE 8101 40000-40016

CMD ["/opt/websyn_start.sh"]
2 changes: 1 addition & 1 deletion control_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
'allrecipes', 'amazon', 'apple', 'arxiv', 'bbc_news', 'booking',
'github', 'google_flights', 'google_map', 'google_search',
'huggingface', 'wolfram_alpha', 'cambridge_dictionary',
'coursera', 'espn', 'merriam_webster',
'coursera', 'espn', 'merriam_webster', 'osu',
]
BASE_PORT = 40000
WEBSYN_DIR = '/opt/WebSyn'
Expand Down
17 changes: 17 additions & 0 deletions sites/osu/_health.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Health check module for OSU mirror site."""


def health_check(app, db, College, Program):
"""Return health status dict."""
try:
with app.app_context():
college_count = College.query.count()
program_count = Program.query.count()
return {
'ok': True,
'site': 'osu',
'colleges': college_count,
'programs': program_count,
}
except Exception as e:
return {'ok': False, 'error': str(e)}
Loading