feat: rebuild as multi-user web agent
This commit is contained in:
Executable
+55
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
project_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
env_file="${project_dir}/.env"
|
||||
|
||||
if [[ -e "${env_file}" ]]; then
|
||||
echo "${env_file} already exists; refusing to overwrite it." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
umask 077
|
||||
read -r -p "Bootstrap admin email: " admin_email
|
||||
read -r -s -p "Rotated model API key: " model_api_key
|
||||
echo
|
||||
|
||||
if [[ -z "${admin_email}" || -z "${model_api_key}" ]]; then
|
||||
echo "Admin email and model API key are required." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
random_hex() {
|
||||
openssl rand -hex "$1"
|
||||
}
|
||||
|
||||
admin_password="$(random_hex 18)"
|
||||
postgres_password="$(random_hex 18)"
|
||||
|
||||
{
|
||||
echo "WEBUI_URL=http://localhost:3000"
|
||||
echo "CORS_ALLOW_ORIGIN=http://localhost:3000"
|
||||
echo "WEBUI_COOKIE_SECURE=false"
|
||||
echo "WEBUI_SECRET_KEY=$(random_hex 32)"
|
||||
echo "WEBUI_ADMIN_EMAIL=${admin_email}"
|
||||
echo "WEBUI_ADMIN_PASSWORD=${admin_password}"
|
||||
echo "OPENWEBUI_FORWARD_JWT_SECRET=$(random_hex 32)"
|
||||
echo "INTERNAL_PROVIDER_KEY=$(random_hex 32)"
|
||||
echo "INTERNAL_GATEWAY_KEY=$(random_hex 32)"
|
||||
echo "MODEL_API_KEY=${model_api_key}"
|
||||
echo "MODEL_API_BASE_URL=https://api.k1412.top"
|
||||
echo "POSTGRES_USER=agent"
|
||||
echo "POSTGRES_PASSWORD=${postgres_password}"
|
||||
echo "POSTGRES_DB=agent"
|
||||
echo "EXECUTION_PROVIDER=local-docker"
|
||||
echo "WORKSPACE_IMAGE=k1412-agent-workspace:dev"
|
||||
echo "WORKSPACE_NETWORK_ENABLED=true"
|
||||
echo "WORKSPACE_MEMORY_LIMIT=2g"
|
||||
echo "WORKSPACE_CPU_LIMIT=2"
|
||||
echo "WORKSPACE_PIDS_LIMIT=512"
|
||||
} > "${env_file}"
|
||||
|
||||
chmod 600 "${env_file}"
|
||||
echo "Created ${env_file} with mode 600."
|
||||
echo "Bootstrap admin password: ${admin_password}"
|
||||
echo "Store that password in a password manager; it is not printed again."
|
||||
Reference in New Issue
Block a user