Add backend, worker, deploy docker-compose and CI skeleton
CI / basic-check (push) Has been cancelled
CI / basic-check (push) Has been cancelled
This commit is contained in:
@@ -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
|
||||||
@@ -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"}
|
||||||
@@ -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
|
||||||
@@ -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:
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
def main():
|
||||||
|
print("NetMapper worker bootstrap")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
redis==5.1.1
|
||||||
|
pydantic==2.9.2
|
||||||
|
python-nmap==0.7.1
|
||||||
|
pysnmp==7.1.15
|
||||||
Reference in New Issue
Block a user