chore: share docker network (#1197)

* chore: share ci docker network

* chore: share ci docker network

* chore: share ci docker network

* chore: add health endpoint

* chore: add health endpoint

* chore: add health endpoint

* chore: add health endpoint

* chore: add health endpoint

* chore: add health endpoint
This commit is contained in:
Nathan.fooo 2025-01-24 23:02:16 +08:00 committed by GitHub
parent 11342e7f67
commit a272ce1296
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 31 additions and 1 deletions

View File

@ -11,6 +11,8 @@ services:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/ssl/certificate.crt:/etc/nginx/ssl/certificate.crt
- ./nginx/ssl/private_key.key:/etc/nginx/ssl/private_key.key
networks:
- shared_network
#- ./nginx_logs:/var/log/nginx
# You do not need this if you have configured to use your own s3 file storage
@ -28,6 +30,8 @@ services:
command: server /data --console-address ":9001"
volumes:
- minio_data:/data
networks:
- shared_network
postgres:
restart: on-failure
@ -47,12 +51,16 @@ services:
- SUPABASE_PASSWORD=${SUPABASE_PASSWORD:-root}
volumes:
- ./migrations/before:/docker-entrypoint-initdb.d
networks:
- shared_network
redis:
restart: on-failure
image: redis
ports:
- "6379:6379"
networks:
- shared_network
gotrue:
restart: on-failure
@ -109,9 +117,13 @@ services:
- GOTRUE_EXTERNAL_DISCORD_CLIENT_ID=${GOTRUE_EXTERNAL_DISCORD_CLIENT_ID}
- GOTRUE_EXTERNAL_DISCORD_SECRET=${GOTRUE_EXTERNAL_DISCORD_SECRET}
- GOTRUE_EXTERNAL_DISCORD_REDIRECT_URI=${GOTRUE_EXTERNAL_DISCORD_REDIRECT_URI}
networks:
- shared_network
appflowy_cloud:
restart: on-failure
ports:
- 8000:8000
environment:
- RUST_LOG=${RUST_LOG:-info}
- APPFLOWY_ENVIRONMENT=production
@ -148,6 +160,8 @@ services:
args:
FEATURES: ""
PROFILE: ci
networks:
- shared_network
image: appflowyinc/appflowy_cloud:${APPFLOWY_CLOUD_VERSION:-latest}
depends_on:
gotrue:
@ -167,6 +181,8 @@ services:
- ADMIN_FRONTEND_GOTRUE_URL=${ADMIN_FRONTEND_GOTRUE_URL:-http://gotrue:9999}
- ADMIN_FRONTEND_APPFLOWY_CLOUD_URL=${ADMIN_FRONTEND_APPFLOWY_CLOUD_URL:-http://appflowy_cloud:8000}
- ADMIN_FRONTEND_PATH_PREFIX=${ADMIN_FRONTEND_PATH_PREFIX:-}
networks:
- shared_network
depends_on:
appflowy_cloud:
condition: service_started
@ -188,6 +204,8 @@ services:
- AI_MINIO_URL=${AI_MINIO_URL}
- AI_APPFLOWY_HOST=${AI_APPFLOWY_HOST}
- SUPPORT_OPENAI_V3_IMAGE_MODEL=false
networks:
- shared_network
appflowy_worker:
restart: on-failure
@ -213,7 +231,14 @@ services:
- APPFLOWY_MAILER_SMTP_USERNAME=${APPFLOWY_MAILER_SMTP_USERNAME}
- APPFLOWY_MAILER_SMTP_EMAIL=${APPFLOWY_MAILER_SMTP_EMAIL}
- APPFLOWY_MAILER_SMTP_PASSWORD=${APPFLOWY_MAILER_SMTP_PASSWORD}
networks:
- shared_network
volumes:
postgres_data:
minio_data:
networks:
shared_network:
name: appflowy_network
driver: bridge

View File

@ -18,7 +18,7 @@ use actix_session::storage::RedisSessionStore;
use actix_session::SessionMiddleware;
use actix_web::cookie::Key;
use actix_web::middleware::NormalizePath;
use actix_web::{dev::Server, web::Data, App, HttpServer};
use actix_web::{dev::Server, web, web::Data, App, HttpResponse, HttpServer, Responder};
use anyhow::{Context, Error};
use appflowy_collaborate::collab::access_control::CollabStorageAccessControlImpl;
use aws_sdk_s3::config::{Credentials, Region, SharedCredentialsProvider};
@ -159,6 +159,7 @@ pub async fn run_actix_server(
.service(template_scope())
.service(data_import_scope())
.service(access_request_scope())
.route("/health", web::get().to(health_check))
.app_data(Data::new(state.metrics.registry.clone()))
.app_data(Data::new(state.metrics.request_metrics.clone()))
.app_data(Data::new(state.metrics.realtime_metrics.clone()))
@ -502,3 +503,7 @@ async fn get_gotrue_client(setting: &GoTrueSetting) -> Result<gotrue::api::Clien
.map_err(|e| anyhow::anyhow!("Failed to connect to GoTrue: {}", e));
Ok(gotrue_client)
}
async fn health_check() -> impl Responder {
HttpResponse::Ok().body("OK")
}