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/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_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/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
|
- name: Update Nginx Configuration
|
||||||
run: |
|
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_DATABASE_URL=postgres://POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:5432/$POSTGRES_DB
|
||||||
|
|
||||||
# AppFlowy AI
|
# AppFlowy AI
|
||||||
OPENAI_API_KEY=
|
APPFLOWY_AI_OPENAI_API_KEY=
|
||||||
APPFLOWY_AI_URL=http://appflowy_ai:5001
|
APPFLOWY_AI_SERVER_HOST=appflowy_ai
|
||||||
# The SERVER_NAME is environment variable for AppFlowy AI server. By default, it is localhost:5001
|
APPFLOWY_AI_SERVER_PORT=5001
|
||||||
APPFLOWY_AI_SERVER_NAME=appflowy_ai:5001
|
|
||||||
|
|
||||||
# AppFlowy History
|
# AppFlowy History
|
||||||
APPFLOWY_HISTORY_URL=http://history:50051
|
APPFLOWY_HISTORY_URL=http://history:50051
|
||||||
|
|
|
||||||
12
dev.env
12
dev.env
|
|
@ -97,9 +97,11 @@ GF_SECURITY_ADMIN_PASSWORD=password
|
||||||
CLOUDFLARE_TUNNEL_TOKEN=
|
CLOUDFLARE_TUNNEL_TOKEN=
|
||||||
|
|
||||||
# AppFlowy AI
|
# AppFlowy AI
|
||||||
OPENAI_API_KEY=
|
APPFLOWY_AI_OPENAI_API_KEY=
|
||||||
APPFLOWY_AI_URL=http://localhost:5001
|
APPFLOWY_AI_SERVER_HOST=localhost
|
||||||
# The SERVER_NAME is environment variable for AppFlowy AI server. By default, it is localhost:5001
|
APPFLOWY_AI_SERVER_PORT=5001
|
||||||
APPFLOWY_AI_SERVER_NAME=localhost: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_BUCKET=${APPFLOWY_S3_BUCKET}
|
||||||
- APPFLOWY_S3_REGION=${APPFLOWY_S3_REGION}
|
- APPFLOWY_S3_REGION=${APPFLOWY_S3_REGION}
|
||||||
- APPFLOWY_ACCESS_CONTROL=${APPFLOWY_ACCESS_CONTROL}
|
- 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:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
|
@ -137,10 +138,9 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- "5001:5001"
|
- "5001:5001"
|
||||||
environment:
|
environment:
|
||||||
- FLASK_DEBUG=false
|
- OPENAI_API_KEY=${APPFLOWY_AI_OPENAI_API_KEY}
|
||||||
- FLASK_SKIP_DOTENV=true
|
- APPFLOWY_AI_SERVER_HOST=${APPFLOWY_AI_SERVER_HOST}
|
||||||
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
- APPFLOWY_AI_SERVER_PORT=${APPFLOWY_AI_SERVER_PORT}
|
||||||
- SERVER_NAME=${APPFLOWY_AI_SERVER_NAME}
|
|
||||||
|
|
||||||
appflowy_history:
|
appflowy_history:
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
|
|
|
||||||
|
|
@ -107,10 +107,9 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- 5001:5001
|
- 5001:5001
|
||||||
environment:
|
environment:
|
||||||
- FLASK_DEBUG=false
|
- OPENAI_API_KEY=${APPFLOWY_AI_OPENAI_API_KEY}
|
||||||
- FLASK_SKIP_DOTENV=true
|
- APPFLOWY_AI_SERVER_HOST=${APPFLOWY_AI_SERVER_HOST}
|
||||||
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
- APPFLOWY_AI_SERVER_PORT=${APPFLOWY_AI_SERVER_PORT}
|
||||||
- SERVER_NAME=${APPFLOWY_AI_SERVER_NAME}
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,8 @@ services:
|
||||||
- APPFLOWY_S3_BUCKET=${APPFLOWY_S3_BUCKET}
|
- APPFLOWY_S3_BUCKET=${APPFLOWY_S3_BUCKET}
|
||||||
- APPFLOWY_S3_REGION=${APPFLOWY_S3_REGION}
|
- APPFLOWY_S3_REGION=${APPFLOWY_S3_REGION}
|
||||||
- APPFLOWY_ACCESS_CONTROL=${APPFLOWY_ACCESS_CONTROL}
|
- 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:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
|
@ -134,10 +135,9 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- "5001:5001"
|
- "5001:5001"
|
||||||
environment:
|
environment:
|
||||||
- FLASK_DEBUG=false
|
- OPENAI_API_KEY=${APPFLOWY_AI_OPENAI_API_KEY}
|
||||||
- FLASK_SKIP_DOTENV=true
|
- APPFLOWY_AI_SERVER_HOST=${APPFLOWY_AI_SERVER_HOST}
|
||||||
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
- APPFLOWY_AI_SERVER_PORT=${APPFLOWY_AI_SERVER_PORT}
|
||||||
- SERVER_NAME=${APPFLOWY_AI_SERVER_NAME}
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,8 @@ pub async fn init_state(config: &Config, rt_cmd_tx: RTCommandSender) -> Result<A
|
||||||
info!("Connecting to Redis...");
|
info!("Connecting to Redis...");
|
||||||
let redis_conn_manager = get_redis_client(config.redis_uri.expose_secret()).await?;
|
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
|
// Pg listeners
|
||||||
info!("Setting up Pg listeners...");
|
info!("Setting up Pg listeners...");
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use infra::env_util::get_env_var;
|
use infra::env_util::get_env_var;
|
||||||
use secrecy::Secret;
|
use secrecy::{ExposeSecret, Secret};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use sqlx::postgres::{PgConnectOptions, PgSslMode};
|
use sqlx::postgres::{PgConnectOptions, PgSslMode};
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
|
|
@ -53,7 +53,18 @@ pub struct GoTrueSetting {
|
||||||
|
|
||||||
#[derive(serde::Deserialize, Clone, Debug)]
|
#[derive(serde::Deserialize, Clone, Debug)]
|
||||||
pub struct AppFlowyAISetting {
|
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
|
// 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", ""),
|
region: get_env_var("APPFLOWY_S3_REGION", ""),
|
||||||
},
|
},
|
||||||
appflowy_ai: AppFlowyAISetting {
|
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 {
|
grpc_history: GrpcHistorySetting {
|
||||||
addrs: get_env_var("APPFLOWY_GRPC_HISTORY_ADDRS", "http://localhost:50051"),
|
addrs: get_env_var("APPFLOWY_GRPC_HISTORY_ADDRS", "http://localhost:50051"),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue