修改infra内容;移动project_info到config内
This commit is contained in:
@@ -18,7 +18,7 @@ import geopandas as gpd
|
|||||||
from sqlalchemy import create_engine
|
from sqlalchemy import create_engine
|
||||||
import ast
|
import ast
|
||||||
import sensitivity
|
import sensitivity
|
||||||
import app.services.project_info as project_info
|
import configs.project_info as project_info
|
||||||
import app.algorithms.api_ex.kmeans_sensor
|
import app.algorithms.api_ex.kmeans_sensor
|
||||||
import app.algorithms.api_ex.Fdataclean
|
import app.algorithms.api_ex.Fdataclean
|
||||||
import app.algorithms.api_ex.Pdataclean
|
import app.algorithms.api_ex.Pdataclean
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import pandas as pd
|
|||||||
import openpyxl
|
import openpyxl
|
||||||
import pytz
|
import pytz
|
||||||
import app.infra.db.influxdb.info as influxdb_info
|
import app.infra.db.influxdb.info as influxdb_info
|
||||||
import app.services.project_info as project_info
|
import configs.project_info as project_info
|
||||||
import app.services.time_api as time_api
|
import app.services.time_api as time_api
|
||||||
from app.native.api.postgresql_info import get_pgconn_string
|
from app.native.api.postgresql_info import get_pgconn_string
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ import py_linq
|
|||||||
import app.services.time_api as time_api
|
import app.services.time_api as time_api
|
||||||
import app.services.simulation as simulation
|
import app.services.simulation as simulation
|
||||||
import app.services.globals as globals
|
import app.services.globals as globals
|
||||||
import app.services.project_info as project_info
|
import configs.project_info as project_info
|
||||||
from app.infra.db.timescaledb.database import db as tsdb
|
from app.infra.db.timescaledb.database import db as tsdb
|
||||||
from app.infra.db.postgresql.database import db as pgdb
|
from app.infra.db.postgresql.database import db as pgdb
|
||||||
from app.algorithms.online_Analysis import *
|
from app.algorithms.online_Analysis import *
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import psycopg
|
|||||||
import logging
|
import logging
|
||||||
import app.services.globals as globals
|
import app.services.globals as globals
|
||||||
import uuid
|
import uuid
|
||||||
import app.services.project_info as project_info
|
import configs.project_info as project_info
|
||||||
from app.native.api.postgresql_info import get_pgconn_string
|
from app.native.api.postgresql_info import get_pgconn_string
|
||||||
from timescaledb.internal_queries import InternalQueries as TimescaleInternalQueries
|
from timescaledb.internal_queries import InternalQueries as TimescaleInternalQueries
|
||||||
from timescaledb.internal_queries import InternalStorage as TimescaleInternalStorage
|
from timescaledb.internal_queries import InternalStorage as TimescaleInternalStorage
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM python:3.10-slim
|
FROM python:3.12-slim
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +1,164 @@
|
|||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
# ==========================================
|
||||||
|
# Core API Service
|
||||||
|
# ==========================================
|
||||||
api:
|
api:
|
||||||
build:
|
build:
|
||||||
context: ../..
|
context: ../..
|
||||||
dockerfile: infra/docker/Dockerfile
|
dockerfile: infra/docker/Dockerfile
|
||||||
|
container_name: tjwater_api
|
||||||
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "${API_PORT}:8000"
|
||||||
volumes:
|
volumes:
|
||||||
- ../../app:/app/app
|
- ../../app:/app/app
|
||||||
- ../../resources:/app/resources
|
- ../../resources:/app/resources
|
||||||
environment:
|
environment:
|
||||||
- PYTHONPATH=/app
|
- PYTHONPATH=/app
|
||||||
|
- REDIS_HOST=redis
|
||||||
|
- REDIS_PORT=${REDIS_PORT}
|
||||||
|
- REDIS_PASSWORD=${REDIS_PASSWORD}
|
||||||
|
# Add other DB connections here as needed by your app
|
||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- redis
|
||||||
|
- timescaledb
|
||||||
|
- postgis
|
||||||
|
|
||||||
|
# ==========================================
|
||||||
|
# Infrastructure Services
|
||||||
|
# ==========================================
|
||||||
|
|
||||||
|
# --- Redis ---
|
||||||
redis:
|
redis:
|
||||||
image: redis:alpine
|
image: redis:latest
|
||||||
|
container_name: redis
|
||||||
|
restart: always
|
||||||
|
command: redis-server --requirepass ${REDIS_PASSWORD}
|
||||||
ports:
|
ports:
|
||||||
- "6379:6379"
|
- "${REDIS_PORT}:6379"
|
||||||
|
volumes:
|
||||||
|
- ./redis/data:/data
|
||||||
|
|
||||||
# Add other services as needed (postgres, influxdb, timescaledb)
|
# --- InfluxDB ---
|
||||||
|
influxdb:
|
||||||
|
image: influxdb:2.7
|
||||||
|
container_name: influxdb
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
DOCKER_INFLUXDB_INIT_MODE: setup
|
||||||
|
DOCKER_INFLUXDB_INIT_USERNAME: ${INFLUXDB_USER}
|
||||||
|
DOCKER_INFLUXDB_INIT_PASSWORD: ${INFLUXDB_PASSWORD}
|
||||||
|
DOCKER_INFLUXDB_INIT_ORG: ${INFLUXDB_ORG}
|
||||||
|
DOCKER_INFLUXDB_INIT_BUCKET: ${INFLUXDB_BUCKET}
|
||||||
|
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: ${INFLUXDB_ADMIN_TOKEN}
|
||||||
|
ports:
|
||||||
|
- "${INFLUXDB_PORT}:8086"
|
||||||
|
volumes:
|
||||||
|
- ./influxdb/data:/var/lib/influxdb2
|
||||||
|
|
||||||
|
# --- Keycloak ---
|
||||||
|
keycloakDB:
|
||||||
|
image: postgis/postgis:14-3.5
|
||||||
|
container_name: keycloakDB
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: ${KEYCLOAK_DB_NAME}
|
||||||
|
POSTGRES_USER: ${KEYCLOAK_DB_USER}
|
||||||
|
POSTGRES_PASSWORD: ${KEYCLOAK_DB_PASSWORD}
|
||||||
|
ports:
|
||||||
|
- "${KEYCLOAK_DB_PORT}:5432"
|
||||||
|
volumes:
|
||||||
|
- ./keycloak/db_data:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
keycloak:
|
||||||
|
image: keycloak/keycloak:latest
|
||||||
|
container_name: keycloak
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
KC_HOSTNAME: localhost
|
||||||
|
KC_HOSTNAME_STRICT_BACKCHANNEL: "true"
|
||||||
|
KEYCLOAK_ADMIN: ${KEYCLOAK_ADMIN_USER}
|
||||||
|
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD}
|
||||||
|
KC_HEALTH_ENABLED: "true"
|
||||||
|
KC_LOG_LEVEL: info
|
||||||
|
KC_DB: postgres
|
||||||
|
KC_DB_URL: jdbc:postgresql://keycloakDB:5432/${KEYCLOAK_DB_NAME}
|
||||||
|
KC_DB_USERNAME: ${KEYCLOAK_DB_USER}
|
||||||
|
KC_DB_PASSWORD: ${KEYCLOAK_DB_PASSWORD}
|
||||||
|
volumes:
|
||||||
|
- ./keycloak/themes:/opt/keycloak/themes
|
||||||
|
- ./keycloak/import:/opt/keycloak/data/import
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "curl", "-f", "http://localhost:8080/health/ready" ]
|
||||||
|
interval: 15s
|
||||||
|
timeout: 2s
|
||||||
|
retries: 15
|
||||||
|
command: [ "start-dev", "--import-realm" ]
|
||||||
|
ports:
|
||||||
|
- "${KEYCLOAK_PORT}:8080"
|
||||||
|
depends_on:
|
||||||
|
- keycloakDB
|
||||||
|
|
||||||
|
# --- TimescaleDB & Grafana ---
|
||||||
|
timescaledb:
|
||||||
|
image: timescale/timescaledb:latest-pg15
|
||||||
|
container_name: timescaledb
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: ${TIMESCALE_DB_NAME}
|
||||||
|
POSTGRES_USER: ${TIMESCALE_USER}
|
||||||
|
POSTGRES_PASSWORD: ${DB_PASSWORD_SHARED}
|
||||||
|
ports:
|
||||||
|
- "${TIMESCALE_PORT}:5432"
|
||||||
|
volumes:
|
||||||
|
- ./timescaledb/data:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
grafana:
|
||||||
|
image: grafana/grafana:latest
|
||||||
|
container_name: grafana
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "${GRAFANA_PORT}:3000"
|
||||||
|
depends_on:
|
||||||
|
- timescaledb
|
||||||
|
volumes:
|
||||||
|
- ./timescaledb/grafana_data:/var/lib/grafana
|
||||||
|
environment:
|
||||||
|
- GF_SECURITY_ADMIN_USER=${GRAFANA_ADMIN_USER}
|
||||||
|
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD}
|
||||||
|
|
||||||
|
# --- MapService (PostGIS & GeoServer) ---
|
||||||
|
postgis:
|
||||||
|
image: postgis/postgis:14-3.5
|
||||||
|
container_name: postgis
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: ${POSTGIS_DB_NAME}
|
||||||
|
POSTGRES_USER: ${POSTGIS_USER}
|
||||||
|
POSTGRES_PASSWORD: ${DB_PASSWORD_SHARED}
|
||||||
|
ports:
|
||||||
|
- "${POSTGIS_PORT}:5432"
|
||||||
|
volumes:
|
||||||
|
- ./mapservice/data:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
geoserver:
|
||||||
|
image: docker.osgeo.org/geoserver:2.27.1
|
||||||
|
container_name: geoserver
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "${GEOSERVER_PORT}:8080"
|
||||||
|
depends_on:
|
||||||
|
- postgis
|
||||||
|
environment:
|
||||||
|
- GEOSERVER_ADMIN_USER=${GEOSERVER_ADMIN_USER}
|
||||||
|
- GEOSERVER_ADMIN_PASSWORD=${GEOSERVER_ADMIN_PASSWORD}
|
||||||
|
- INSTALL_EXTENSIONS=true
|
||||||
|
- STABLE_EXTENSIONS=css,vectortiles
|
||||||
|
- CORS_ENABLED=true
|
||||||
|
- CORS_ALLOWED_ORIGINS=*
|
||||||
|
volumes:
|
||||||
|
- ./mapservice/geoserver_data:/opt/geoserver_data
|
||||||
|
|
||||||
|
networks:
|
||||||
|
default:
|
||||||
|
driver: bridge
|
||||||
|
|||||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
BIN
resources/old_requirements.txt
Normal file
BIN
resources/old_requirements.txt
Normal file
Binary file not shown.
@@ -1,168 +0,0 @@
|
|||||||
annotated-doc==0.0.4
|
|
||||||
annotated-types==0.7.0
|
|
||||||
anyio==4.8.0
|
|
||||||
attrs==25.4.0
|
|
||||||
Authlib==1.6.6
|
|
||||||
beartype==0.22.9
|
|
||||||
beautifulsoup4==4.13.4
|
|
||||||
cachetools==6.2.4
|
|
||||||
certifi==2024.8.30
|
|
||||||
cffi==2.0.0
|
|
||||||
chardet==5.2.0
|
|
||||||
charset-normalizer==3.4.0
|
|
||||||
click==8.1.8
|
|
||||||
cloudpickle==3.1.2
|
|
||||||
colorama==0.4.6
|
|
||||||
contourpy==1.3.2
|
|
||||||
cryptography==46.0.3
|
|
||||||
cycler==0.12.1
|
|
||||||
cyclopts==4.5.0
|
|
||||||
Cython==3.0.12
|
|
||||||
diskcache==5.6.3
|
|
||||||
distro==1.9.0
|
|
||||||
dnspython==2.8.0
|
|
||||||
docstring_parser==0.17.0
|
|
||||||
docutils==0.21.2
|
|
||||||
dotenv==0.9.9
|
|
||||||
ecos==2.0.14
|
|
||||||
email-validator==2.3.0
|
|
||||||
esda==2.7.0
|
|
||||||
et_xmlfile==2.0.0
|
|
||||||
exceptiongroup==1.3.1
|
|
||||||
fakeredis==2.33.0
|
|
||||||
fastapi==0.128.0
|
|
||||||
fastmcp==2.9.2
|
|
||||||
fonttools==4.58.0
|
|
||||||
future==0.18.3
|
|
||||||
GeoAlchemy2==0.17.1
|
|
||||||
geopandas==1.0.1
|
|
||||||
greenlet==3.1.1
|
|
||||||
h11==0.14.0
|
|
||||||
httpcore==1.0.7
|
|
||||||
httpx==0.28.1
|
|
||||||
httpx-sse==0.4.3
|
|
||||||
idna==3.10
|
|
||||||
importlib_metadata==8.7.1
|
|
||||||
influxdb-client==1.48.0
|
|
||||||
iniconfig==2.0.0
|
|
||||||
jaraco.classes==3.4.0
|
|
||||||
jaraco.context==6.1.0
|
|
||||||
jaraco.functools==4.4.0
|
|
||||||
jeepney==0.9.0
|
|
||||||
Jinja2==3.1.6
|
|
||||||
jiter==0.8.2
|
|
||||||
joblib==1.5.0
|
|
||||||
jsonschema==4.26.0
|
|
||||||
jsonschema-path==0.3.4
|
|
||||||
jsonschema-specifications==2025.9.1
|
|
||||||
keyring==25.7.0
|
|
||||||
Kivy==2.3.0
|
|
||||||
Kivy-Garden==0.1.5
|
|
||||||
kiwisolver==1.4.8
|
|
||||||
libpysal==4.13.0
|
|
||||||
lupa==2.6
|
|
||||||
mapclassify==2.8.1
|
|
||||||
markdown-it-py==3.0.0
|
|
||||||
MarkupSafe==3.0.3
|
|
||||||
matplotlib==3.10.3
|
|
||||||
mcp==1.9.4
|
|
||||||
mdurl==0.1.2
|
|
||||||
more-itertools==10.8.0
|
|
||||||
msgpack==1.1.0
|
|
||||||
networkx==3.4.2
|
|
||||||
numexpr==2.14.1
|
|
||||||
numpy==1.26.2
|
|
||||||
openai==1.63.0
|
|
||||||
openapi-pydantic==0.5.1
|
|
||||||
openpyxl==3.1.5
|
|
||||||
opentelemetry-api==1.39.1
|
|
||||||
opentelemetry-exporter-prometheus==0.60b1
|
|
||||||
opentelemetry-instrumentation==0.60b1
|
|
||||||
opentelemetry-sdk==1.39.1
|
|
||||||
opentelemetry-semantic-conventions==0.60b1
|
|
||||||
osqp==1.0.5
|
|
||||||
packaging==25.0
|
|
||||||
pandas==2.2.3
|
|
||||||
pathable==0.4.4
|
|
||||||
pathvalidate==3.3.1
|
|
||||||
pillow==11.2.1
|
|
||||||
pipdeptree==2.30.0
|
|
||||||
platformdirs==4.3.8
|
|
||||||
pluggy==1.5.0
|
|
||||||
pointpats==2.5.1
|
|
||||||
prometheus_client==0.24.1
|
|
||||||
psycopg==3.2.5
|
|
||||||
psycopg-binary==3.2.5
|
|
||||||
psycopg-pool==3.3.0
|
|
||||||
psycopg2==2.9.10
|
|
||||||
PuLP==3.1.1
|
|
||||||
py-key-value-aio==0.3.0
|
|
||||||
py-key-value-shared==0.3.0
|
|
||||||
py-linq==1.4.0
|
|
||||||
pyarmor==9.0.7
|
|
||||||
pyarmor.cli.core==7.6.4
|
|
||||||
pybind11-stubgen==2.5.1
|
|
||||||
pycparser==2.23
|
|
||||||
pydantic==2.10.6
|
|
||||||
pydantic-settings==2.12.0
|
|
||||||
pydantic_core==2.27.2
|
|
||||||
pydevd-pycharm==243.16718.36
|
|
||||||
pydocket==0.16.6
|
|
||||||
Pygments==2.18.0
|
|
||||||
PyJWT==2.10.1
|
|
||||||
pykalman==0.10.2
|
|
||||||
# pymetis @ file:///D:/bld/pymetis_1762455149640/work 通过 conda 安装 pymetis,避免编译问题 conda install -c conda-forge pymetis
|
|
||||||
pynvim==0.5.0
|
|
||||||
pyogrio==0.11.0
|
|
||||||
pyparsing==3.2.3
|
|
||||||
pyperclip==1.11.0
|
|
||||||
pyproj==3.7.1
|
|
||||||
pytest==8.3.5
|
|
||||||
python-dateutil==2.9.0.post0
|
|
||||||
python-dotenv==1.2.1
|
|
||||||
python-json-logger==4.0.0
|
|
||||||
python-multipart==0.0.20
|
|
||||||
pytz==2025.2
|
|
||||||
PyYAML==6.0.3
|
|
||||||
pyzmq==26.2.1
|
|
||||||
reactivex==4.0.4
|
|
||||||
redis==5.2.1
|
|
||||||
referencing==0.36.2
|
|
||||||
requests==2.32.3
|
|
||||||
rich==14.2.0
|
|
||||||
rich-rst==1.3.2
|
|
||||||
rpds-py==0.30.0
|
|
||||||
rtree==1.4.0
|
|
||||||
schedule==1.2.2
|
|
||||||
scikit-base==0.12.6
|
|
||||||
scikit-fuzzy==0.5.0
|
|
||||||
scikit-learn==1.6.1
|
|
||||||
scikit-survival==0.26.0
|
|
||||||
scipy==1.15.2
|
|
||||||
SecretStorage==3.5.0
|
|
||||||
setuptools==80.7.1
|
|
||||||
shapely==2.1.0
|
|
||||||
shellingham==1.5.4
|
|
||||||
six==1.17.0
|
|
||||||
sniffio==1.3.1
|
|
||||||
sortedcontainers==2.4.0
|
|
||||||
soupsieve==2.7
|
|
||||||
spaghetti==1.7.6
|
|
||||||
spopt==0.6.1
|
|
||||||
SQLAlchemy==2.0.41
|
|
||||||
sse-starlette==3.0.4
|
|
||||||
starlette==0.50.0
|
|
||||||
threadpoolctl==3.6.0
|
|
||||||
tqdm==4.67.1
|
|
||||||
typer==0.21.1
|
|
||||||
typing-inspection==0.4.0
|
|
||||||
typing_extensions==4.12.2
|
|
||||||
tzdata==2025.2
|
|
||||||
urllib3==2.2.3
|
|
||||||
uvicorn==0.34.0
|
|
||||||
websockets==16.0
|
|
||||||
wheel==0.45.1
|
|
||||||
wntr==1.3.2
|
|
||||||
wrapt==1.17.3
|
|
||||||
zipp==3.23.0
|
|
||||||
zmq==0.0.0
|
|
||||||
Reference in New Issue
Block a user