Add Google OAuth configuration and enhance API functionality
- Updated .env.example with WEB_GOOGLE_CLIENT_ID and WEB_GOOGLE_CLIENT_SECRET for Google OAuth. - Modified README.md to reflect changes in docker-compose for unified web and API deployment. - Enhanced auth.py to support NextAuth JWT session cookies. - Improved main.py with lifespan management and additional API endpoints. - Added mod_overview endpoint in mod.py for MOD panel statistics. - Updated docker-compose.yml for local API and web service configurations.
This commit is contained in:
@@ -16,12 +16,58 @@ services:
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 20s
|
||||
|
||||
# Local mode API: binds to local Postgres/Mongo containers.
|
||||
api-local:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
image: reader-api:latest
|
||||
container_name: reader-api-local
|
||||
profiles: ["localdb"]
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
DATABASE_URL: postgresql://reader:reader@postgres:5432/reader
|
||||
MONGODB_URI: mongodb://mongo:27017/reader
|
||||
ports:
|
||||
- "8001:8000"
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/api/health').read()"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 20s
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
mongo:
|
||||
condition: service_healthy
|
||||
|
||||
web:
|
||||
build:
|
||||
context: ../reader
|
||||
dockerfile: Dockerfile
|
||||
image: reader-web:latest
|
||||
container_name: reader-web
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
PORT: 3000
|
||||
READER_API_ORIGIN: http://api:8000
|
||||
NEXTAUTH_URL: ${NEXTAUTH_URL:-http://localhost:3000}
|
||||
NEXTAUTH_SECRET: ${NEXTAUTH_SECRET}
|
||||
GOOGLE_CLIENT_ID: ${WEB_GOOGLE_CLIENT_ID}
|
||||
GOOGLE_CLIENT_SECRET: ${WEB_GOOGLE_CLIENT_SECRET}
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- web_uploads:/app/public/uploads
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
api:
|
||||
condition: service_healthy
|
||||
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
container_name: reader-api-postgres
|
||||
@@ -55,5 +101,6 @@ services:
|
||||
retries: 10
|
||||
|
||||
volumes:
|
||||
web_uploads:
|
||||
postgres_data:
|
||||
mongo_data:
|
||||
|
||||
Reference in New Issue
Block a user