Skip to content

Commit

Permalink
feat: aiproxy deploy support one db (#5241)
Browse files Browse the repository at this point in the history
  • Loading branch information
zijiren233 authored Nov 28, 2024
1 parent 98fdc1a commit d98d1a9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions service/aiproxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,12 @@ sealos run ghcr.io/labring/sealos-cloud-aiproxy-service:latest \
-e ADMIN_KEY=<admin-key> \
-e cloudDomain=<cloud-domain>
```

# Use One PostgreSQL

```bash
sealos run ghcr.io/labring/sealos-cloud-aiproxy-service:latest \
-e ADMIN_KEY=<admin-key> \
-e cloudDomain=<cloud-domain> \
-e LOG_SQL_DSN=""
```
12 changes: 12 additions & 0 deletions service/aiproxy/deploy/scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ if grep "<sql-placeholder>" manifests/aiproxy-config.yaml >/dev/null 2>&1; then
# Update config
sed -i "s|<sql-placeholder>|${SQL_DSN}|g" manifests/aiproxy-config.yaml
sed -i "s|<sql-log-placeholder>|${LOG_SQL_DSN}|g" manifests/aiproxy-config.yaml
elif grep "LOG_SQL_DSN: \"\"" manifests/aiproxy-config.yaml >/dev/null 2>&1; then
# Deploy PostgreSQL resources
kubectl apply -f manifests/pgsql.yaml -n aiproxy-system

# Wait for secrets
wait_for_secret "aiproxy-conn-credential"

# Build connection strings
SQL_DSN=$(build_postgres_dsn "aiproxy-conn-credential") || exit $?

# Update config
sed -i "s|<sql-placeholder>|${SQL_DSN}|g" manifests/aiproxy-config.yaml
else
echo "Error: LOG_SQL_DSN is not allowed to be passed alone, please provide both SQL_DSN and LOG_SQL_DSN or provide SQL_DSN only or neither."
exit 1
Expand Down

0 comments on commit d98d1a9

Please sign in to comment.