diff --git a/docker-compose.yaml b/docker-compose.yaml index 18237f8..b007d03 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,22 +1,31 @@ services: - web: - image: reg.lugvitc.net/pwncore:latest - ports: - - "11000:8000" - environment: - - DATABASE_URL=postgresql://postgres:lugvitcrocks@db:5432/postgres - - WORKERS=4 - volumes: - - /var/run/docker.sock:/var/run/docker.sock - depends_on: - - db - - db: - image: postgres:14 - environment: - - POSTGRES_USER=postgres - - POSTGRES_PASSWORD=lugvitcrocks - - POSTGRES_DB=pwncore - - PGDATA=/var/lib/postgresql/data/pgdata - volumes: - - /home/lugvitc/cod3/postgresDB:/var/lib/postgresql/data + web: + image: reg.lugvitc.net/pwncore:latest + ports: + - ${PORT}:8000 + environment: + - DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB} + - WORKERS=${WORKERS} + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - ${CONFIG_FILE}:/app/src/pwncore/config.py + depends_on: + - db + db: + image: postgres:14 + user: ${UID}:${GID} + environment: + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + - POSTGRES_DB=${POSTGRES_DB} + - PGDATA=/var/lib/postgresql/data/pgdata + volumes: + - ${DATA_PATH}:/var/lib/postgresql/data + ports: + - 5432:5432 + admin: + image: mathesar/mathesar-prod:latest + ports: + - ${PORT_ADMIN}:8000 + depends_on: + - db diff --git a/src/pwncore/__init__.py b/src/pwncore/__init__.py index f91a713..b78885f 100644 --- a/src/pwncore/__init__.py +++ b/src/pwncore/__init__.py @@ -52,13 +52,12 @@ async def app_lifespan(app: FastAPI): app.include_router(routes.router) origins = [ - "http://ctf.lugvitc.org", - "https://ctf.lugvitc.org", + "http://c0d.lugvitc.net", + "https://c0d.lugvitc.net", ] if config.development: - origins.append("http://localhost:5173") - origins.append("http://localhost:4173") + origins.append("*") app.add_middleware( CORSMiddleware, diff --git a/src/pwncore/routes/admin.py b/src/pwncore/routes/admin.py index 4d35f3c..597aa61 100644 --- a/src/pwncore/routes/admin.py +++ b/src/pwncore/routes/admin.py @@ -29,7 +29,7 @@ if config.development: logging.basicConfig(level=logging.INFO) -ADMIN_HASH = "$2b$12$K2LsLGS/Mahksh0V6xZYKOviNEHMv3Of5f1zhyF6CWJ8rJIcKnSqu" +ADMIN_HASH = "$2b$12$USIGDWgl8WSgSoGauDTKE.ZAKyInaJn84fsZ.ARA6FmntIZeNCTUq" NAMES = [ "Mimas", "Enceladus", @@ -143,8 +143,8 @@ async def init_db( description="How to master the art of solving CTFs? Git good nub.", author="Aadivishnu and Shoubhit", points=300, - image_name="test:latest", - image_config={"PortBindings": {"22/tcp": [{}], "5000/tcp": [{}]}}, + image_name="reg.lugvitc.net/key:latest", + image_config={"PortBindings": {"22/tcp": [{}]}}, ) await Team.create(name="CID Squad", secret_hash=bcrypt.hash("veryverysecret")) await Team.create( diff --git a/src/pwncore/routes/ctf/start.py b/src/pwncore/routes/ctf/start.py index 7a70dea..fa80848 100644 --- a/src/pwncore/routes/ctf/start.py +++ b/src/pwncore/routes/ctf/start.py @@ -38,7 +38,8 @@ async def start_docker_container(ctf_id: int, response: Response, jwt: RequireJw if team_container: a, b = team_container[0], team_container[1:] db_ports = await a.ports.all().values("port") # Get ports from DB - ports = [db_port["port"] for db_port in db_ports] # Create a list out of it + ports = [db_port["port"] + for db_port in db_ports] # Create a list out of it for db_container in b: try: