chore: update configuration for ai docker (#512)
* chore: update configuration for ai docker * chore: add script to test ci docker * chore: update docs * chore: update docs
This commit is contained in:
parent
8654126dcd
commit
af75e8a2c0
|
|
@ -47,7 +47,7 @@ jobs:
|
|||
sed -i 's/GOTRUE_RATE_LIMIT_EMAIL_SENT=100/GOTRUE_RATE_LIMIT_EMAIL_SENT=1000/' .env
|
||||
sed -i 's/APPFLOWY_MAILER_SMTP_USERNAME=.*/APPFLOWY_MAILER_SMTP_USERNAME=${{ secrets.CI_GOTRUE_SMTP_USER }}/' .env
|
||||
sed -i 's/APPFLOWY_MAILER_SMTP_PASSWORD=.*/APPFLOWY_MAILER_SMTP_PASSWORD=${{ secrets.CI_GOTRUE_SMTP_PASS }}/' .env
|
||||
sed -i 's/OPENAI_API_KEY=.*/OPENAI_API_KEY=${{ secrets.CI_OPENAI_API_KEY }}/' .env
|
||||
sed -i 's/APPFLOWY_AI_OPENAI_API_KEY=.*/APPFLOWY_AI_OPENAI_API_KEY=${{ secrets.CI_OPENAI_API_KEY }}/' .env
|
||||
|
||||
- name: Update Nginx Configuration
|
||||
run: |
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env bash
|
||||
set -x
|
||||
set -eo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# This script simulates the continuous integration (CI) environment on a local machine. It
|
||||
# requires a `.env` file to be located in the project's root directory. The values in the `.env`
|
||||
# file must be updated to reflect the specifications of the CI environment.
|
||||
# Check if .env file exists in the current directory
|
||||
|
||||
if [ -f ".env" ]; then
|
||||
echo ".env file exists"
|
||||
else
|
||||
echo ".env file does not exist. Copying deploy.env to .env and update the values"
|
||||
exit 1 # Exit with an error code to indicate failure
|
||||
fi
|
||||
|
||||
# Make sure to update the test client configuration in libs/client-api-test-util/src/client.rs
|
||||
# export LOCALHOST_URL="http://localhost"
|
||||
# export LOCALHOST_WS_URL="ws://localhost/ws"
|
||||
# export LOCALHOST_GOTRUE_URL="http://localhost:gotrue"
|
||||
|
||||
docker compose down
|
||||
docker compose -f docker-compose-ci.yml pull
|
||||
|
||||
# SKIP_BUILD_APPFLOWY_CLOUD=true.
|
||||
if [[ -z "${SKIP_BUILD_APPFLOWY_CLOUD+x}" ]]
|
||||
then
|
||||
docker build -t appflowy_cloud .
|
||||
fi
|
||||
|
||||
docker compose -f docker-compose-ci.yml up -d
|
||||
|
|
@ -105,10 +105,9 @@ CLOUDFLARE_TUNNEL_TOKEN=
|
|||
# APPFLOWY_DATABASE_URL=postgres://POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:5432/$POSTGRES_DB
|
||||
|
||||
# AppFlowy AI
|
||||
OPENAI_API_KEY=
|
||||
APPFLOWY_AI_URL=http://appflowy_ai:5001
|
||||
# The SERVER_NAME is environment variable for AppFlowy AI server. By default, it is localhost:5001
|
||||
APPFLOWY_AI_SERVER_NAME=appflowy_ai:5001
|
||||
APPFLOWY_AI_OPENAI_API_KEY=
|
||||
APPFLOWY_AI_SERVER_HOST=appflowy_ai
|
||||
APPFLOWY_AI_SERVER_PORT=5001
|
||||
|
||||
# AppFlowy History
|
||||
APPFLOWY_HISTORY_URL=http://history:50051
|
||||
|
|
|
|||
12
dev.env
12
dev.env
|
|
@ -97,9 +97,11 @@ GF_SECURITY_ADMIN_PASSWORD=password
|
|||
CLOUDFLARE_TUNNEL_TOKEN=
|
||||
|
||||
# AppFlowy AI
|
||||
OPENAI_API_KEY=
|
||||
APPFLOWY_AI_URL=http://localhost:5001
|
||||
# The SERVER_NAME is environment variable for AppFlowy AI server. By default, it is localhost:5001
|
||||
APPFLOWY_AI_SERVER_NAME=localhost:5001
|
||||
APPFLOWY_AI_OPENAI_API_KEY=
|
||||
APPFLOWY_AI_SERVER_HOST=localhost
|
||||
APPFLOWY_AI_SERVER_PORT=5001
|
||||
|
||||
APPFLOWY_HISTORY_DATABASE_URL=postgres://postgres:password@localhost:5432/postgres
|
||||
# AppFlowy History
|
||||
APPFLOWY_HISTORY_URL=http://history:50051
|
||||
APPFLOWY_HISTORY_REDIS_URL=redis://redis:6379
|
||||
APPFLOWY_HISTORY_DATABASE_URL=postgres://postgres:password@postgres:5432/postgres
|
||||
|
|
|
|||
|
|
@ -112,7 +112,8 @@ services:
|
|||
- APPFLOWY_S3_BUCKET=${APPFLOWY_S3_BUCKET}
|
||||
- APPFLOWY_S3_REGION=${APPFLOWY_S3_REGION}
|
||||
- APPFLOWY_ACCESS_CONTROL=${APPFLOWY_ACCESS_CONTROL}
|
||||
- APPFLOWY_AI_URL=${APPFLOWY_AI_URL}
|
||||
- APPFLOWY_AI_SERVER_HOST=${APPFLOWY_AI_SERVER_HOST}
|
||||
- APPFLOWY_AI_SERVER_PORT=${APPFLOWY_AI_SERVER_PORT}
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
|
|
@ -137,10 +138,9 @@ services:
|
|||
ports:
|
||||
- "5001:5001"
|
||||
environment:
|
||||
- FLASK_DEBUG=false
|
||||
- FLASK_SKIP_DOTENV=true
|
||||
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
||||
- SERVER_NAME=${APPFLOWY_AI_SERVER_NAME}
|
||||
- OPENAI_API_KEY=${APPFLOWY_AI_OPENAI_API_KEY}
|
||||
- APPFLOWY_AI_SERVER_HOST=${APPFLOWY_AI_SERVER_HOST}
|
||||
- APPFLOWY_AI_SERVER_PORT=${APPFLOWY_AI_SERVER_PORT}
|
||||
|
||||
appflowy_history:
|
||||
restart: on-failure
|
||||
|
|
|
|||
|
|
@ -107,10 +107,9 @@ services:
|
|||
ports:
|
||||
- 5001:5001
|
||||
environment:
|
||||
- FLASK_DEBUG=false
|
||||
- FLASK_SKIP_DOTENV=true
|
||||
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
||||
- SERVER_NAME=${APPFLOWY_AI_SERVER_NAME}
|
||||
- OPENAI_API_KEY=${APPFLOWY_AI_OPENAI_API_KEY}
|
||||
- APPFLOWY_AI_SERVER_HOST=${APPFLOWY_AI_SERVER_HOST}
|
||||
- APPFLOWY_AI_SERVER_PORT=${APPFLOWY_AI_SERVER_PORT}
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
|
|
|
|||
|
|
@ -108,7 +108,8 @@ services:
|
|||
- APPFLOWY_S3_BUCKET=${APPFLOWY_S3_BUCKET}
|
||||
- APPFLOWY_S3_REGION=${APPFLOWY_S3_REGION}
|
||||
- APPFLOWY_ACCESS_CONTROL=${APPFLOWY_ACCESS_CONTROL}
|
||||
- APPFLOWY_AI_URL=${APPFLOWY_AI_URL}
|
||||
- APPFLOWY_AI_SERVER_HOST=${APPFLOWY_AI_SERVER_HOST}
|
||||
- APPFLOWY_AI_SERVER_PORT=${APPFLOWY_AI_SERVER_PORT}
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
|
|
@ -134,10 +135,9 @@ services:
|
|||
ports:
|
||||
- "5001:5001"
|
||||
environment:
|
||||
- FLASK_DEBUG=false
|
||||
- FLASK_SKIP_DOTENV=true
|
||||
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
||||
- SERVER_NAME=${APPFLOWY_AI_SERVER_NAME}
|
||||
- OPENAI_API_KEY=${APPFLOWY_AI_OPENAI_API_KEY}
|
||||
- APPFLOWY_AI_SERVER_HOST=${APPFLOWY_AI_SERVER_HOST}
|
||||
- APPFLOWY_AI_SERVER_PORT=${APPFLOWY_AI_SERVER_PORT}
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
|
|
|
|||
|
|
@ -187,7 +187,8 @@ pub async fn init_state(config: &Config, rt_cmd_tx: RTCommandSender) -> Result<A
|
|||
info!("Connecting to Redis...");
|
||||
let redis_conn_manager = get_redis_client(config.redis_uri.expose_secret()).await?;
|
||||
|
||||
let appflowy_ai_client = AppFlowyAIClient::new(config.appflowy_ai.url.expose_secret());
|
||||
info!("Connecting to AppFlowy AI: {}", config.appflowy_ai.url());
|
||||
let appflowy_ai_client = AppFlowyAIClient::new(&config.appflowy_ai.url());
|
||||
|
||||
// Pg listeners
|
||||
info!("Setting up Pg listeners...");
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Context;
|
||||
use infra::env_util::get_env_var;
|
||||
use secrecy::Secret;
|
||||
use secrecy::{ExposeSecret, Secret};
|
||||
use serde::Deserialize;
|
||||
use sqlx::postgres::{PgConnectOptions, PgSslMode};
|
||||
use std::fmt::Display;
|
||||
|
|
@ -53,7 +53,18 @@ pub struct GoTrueSetting {
|
|||
|
||||
#[derive(serde::Deserialize, Clone, Debug)]
|
||||
pub struct AppFlowyAISetting {
|
||||
pub url: Secret<String>,
|
||||
pub port: Secret<String>,
|
||||
pub host: Secret<String>,
|
||||
}
|
||||
|
||||
impl AppFlowyAISetting {
|
||||
pub fn url(&self) -> String {
|
||||
format!(
|
||||
"http://{}:{}",
|
||||
self.host.expose_secret(),
|
||||
self.port.expose_secret()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// We are using 127.0.0.1 as our host in address, we are instructing our
|
||||
|
|
@ -165,7 +176,8 @@ pub fn get_configuration() -> Result<Config, anyhow::Error> {
|
|||
region: get_env_var("APPFLOWY_S3_REGION", ""),
|
||||
},
|
||||
appflowy_ai: AppFlowyAISetting {
|
||||
url: get_env_var("APPFLOWY_AI_URL", "http://localhost:5001").into(),
|
||||
port: get_env_var("APPFLOWY_AI_SERVER_PORT", "5001").into(),
|
||||
host: get_env_var("APPFLOWY_AI_SERVER_HOST", "localhost").into(),
|
||||
},
|
||||
grpc_history: GrpcHistorySetting {
|
||||
addrs: get_env_var("APPFLOWY_GRPC_HISTORY_ADDRS", "http://localhost:50051"),
|
||||
|
|
|
|||
Loading…
Reference in New Issue