diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..eb30423 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,13 @@ +name: CI + +on: + push: + pull_request: + +jobs: + basic-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Show tree + run: find . -maxdepth 3 | sort diff --git a/backend/app/main.py b/backend/app/main.py new file mode 100644 index 0000000..900642c --- /dev/null +++ b/backend/app/main.py @@ -0,0 +1,11 @@ +from fastapi import FastAPI + +app = FastAPI(title="NetMapper API", version="0.1.0") + +@app.get("/health") +def health(): + return {"status": "ok"} + +@app.get("/api/v1") +def root(): + return {"service": "netmapper-backend", "version": "0.1.0"} diff --git a/backend/requirements.txt b/backend/requirements.txt new file mode 100644 index 0000000..e5f295d --- /dev/null +++ b/backend/requirements.txt @@ -0,0 +1,6 @@ +fastapi==0.115.0 +uvicorn[standard]==0.30.6 +pydantic==2.9.2 +sqlalchemy==2.0.35 +psycopg[binary]==3.2.3 +redis==5.1.1 diff --git a/deploy/docker/docker-compose.yml b/deploy/docker/docker-compose.yml new file mode 100644 index 0000000..c112494 --- /dev/null +++ b/deploy/docker/docker-compose.yml @@ -0,0 +1,54 @@ +version: "3.9" + +services: + postgres: + image: postgres:16 + environment: + POSTGRES_DB: netmapper + POSTGRES_USER: netmapper + POSTGRES_PASSWORD: netmapper + volumes: + - postgres_data:/var/lib/postgresql/data + ports: + - "5432:5432" + + redis: + image: redis:7 + ports: + - "6379:6379" + + backend: + image: python:3.12-slim + working_dir: /app + command: sh -c "pip install -r requirements.txt && uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload" + volumes: + - ../../backend:/app + ports: + - "8000:8000" + depends_on: + - postgres + - redis + + worker: + image: python:3.12-slim + working_dir: /app + command: sh -c "pip install -r requirements.txt && python app/main.py" + volumes: + - ../../worker:/app + depends_on: + - redis + - backend + + frontend: + image: node:20-alpine + working_dir: /app + command: sh -c "npm install && npm run dev -- --host 0.0.0.0 --port 5173" + volumes: + - ../../frontend:/app + ports: + - "5173:5173" + depends_on: + - backend + +volumes: + postgres_data: diff --git a/worker/app/main.py b/worker/app/main.py new file mode 100644 index 0000000..832a973 --- /dev/null +++ b/worker/app/main.py @@ -0,0 +1,5 @@ +def main(): + print("NetMapper worker bootstrap") + +if __name__ == "__main__": + main() diff --git a/worker/requirements.txt b/worker/requirements.txt new file mode 100644 index 0000000..0f8f668 --- /dev/null +++ b/worker/requirements.txt @@ -0,0 +1,4 @@ +redis==5.1.1 +pydantic==2.9.2 +python-nmap==0.7.1 +pysnmp==7.1.15