tweaks to support running in docker

This commit is contained in:
2025-07-07 15:50:47 +09:30
parent 35f57ddb79
commit 0fbcd813ca
6 changed files with 11 additions and 7 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
import requests
class IaaSClient:
def __init__(self, api_key, base_url="http://localhost:5000/api"):
def __init__(self, api_key, base_url="http://172.17.0.1:5000/api"):
self.base_url = base_url
self.api_key = api_key
+3 -3
View File
@@ -14,11 +14,11 @@ from app.utils.standard_responses import api_response
app: Flask = Flask(__name__) # same as before
app.config.update(
SQLALCHEMY_DATABASE_URI="mysql://root:password@172.17.0.1:3306/theapi",
WEBSOCKET_SERVER_URL="http://127.0.0.1:6001/api/create_task",
WEBSOCKET_SERVER_URL="http://172.17.0.1:6001/api/create_task",
# New – Celery settings (override via ENV)
CELERY_BROKER_URL="redis://localhost:6379/0",
CELERY_RESULT_BACKEND="redis://localhost:6379/1",
CELERY_BROKER_URL="redis://172.17.0.1:6379/0",
CELERY_RESULT_BACKEND="redis://172.17.0.1:6379/1",
)
pymysql.install_as_MySQLdb()
+2 -1
View File
@@ -36,4 +36,5 @@ celery.conf.beat_schedule.update(
# The export below keeps your old import paths valid:
__all__ = ["celery"]
import app.tasks.container_workload # noqa: E402,F401
import app.tasks.container_workload
import app.tasks.simple
+3
View File
@@ -0,0 +1,3 @@
source .venv/bin/activate
cd worker
python3 main.py
+1 -1
View File
@@ -10,7 +10,7 @@ from sqlalchemy.orm import sessionmaker, declarative_base
import pymysql
# Redis configuration
REDIS_HOST = "localhost"
REDIS_HOST = "172.17.0.1"
REDIS_PORT = 6379
# Database configuration
+1 -1
View File
@@ -11,7 +11,7 @@ from websocket_server.shared_state import connected_workers, worker_lock
logger = logging.getLogger("websocket_server")
# API server endpoint
api_server_url = "http://127.0.0.1:5000/api"
api_server_url = "http://172.17.0.1:5000/api"
# Tracks threads for each worker
worker_threads = {}