init commit

This commit is contained in:
2025-08-12 21:02:23 +09:00
parent a64b348631
commit 29aca4e7e9
37 changed files with 1318 additions and 176 deletions

26
services/bot/entrypoint.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -euo pipefail
if [ -f "/app/.env" ]; then
set -a; source /app/.env; set +a
fi
echo "Waiting for DB..."
python - <<'PY'
import os, time, pymysql
url = os.environ["DATABASE_URL"]
u = url.split("://",1)[1].split("@",1)
auth, host_db = u[0], u[1]
host, port_db = host_db.split("/",1)[0], host_db.split("/",1)[1]
host, port = host.split(":")[0], int(host.split(":")[1] or 3306)
user, password = auth.split(":")[0], ":".join(auth.split(":")[1:])
db = port_db.split("?")[0]
for i in range(60):
try:
conn = pymysql.connect(host=host, port=port, user=user, password=password, database=db)
conn.close()
break
except Exception as e:
print("Waiting DB...", e)
time.sleep(2)
PY
alembic upgrade head
exec python -m app.main