Use Commonlib for self-hosted setup tools

This commit is contained in:
vorotamoroz
2026-07-20 15:47:12 +00:00
parent c49536acc9
commit 44784d4865
15 changed files with 1474 additions and 409 deletions
+15 -22
View File
@@ -1,8 +1,15 @@
#!/bin/bash
## Script for deploy and automatic setup CouchDB onto fly.io.
## We need Deno for generating the Setup-URI.
## Deno is used for Commonlib-backed provisioning and Setup URI generation.
source setenv.sh $@
set -euo pipefail
if ! command -v deno >/dev/null 2>&1; then
echo "ERROR: Deno 2 is required for CouchDB provisioning and Setup URI generation." >&2
exit 1
fi
source setenv.sh "$@"
export hostname="https://$appname.fly.dev"
@@ -14,30 +21,16 @@ echo "region : $region"
echo ""
echo "-- START DEPLOYING --> "
set -e
fly launch --name=$appname --env="COUCHDB_USER=$username" --copy-config=true --detach --no-deploy --region ${region} --yes
fly secrets set COUCHDB_PASSWORD=$password
fly deploy
set +e
../couchdb/couchdb-init.sh
# flyctl deploy
echo "OK!"
if command -v deno >/dev/null 2>&1; then
echo "Setup finished! Also, we can set up Self-hosted LiveSync instantly, by the following setup uri."
echo "Passphrase of setup-uri will be printed only one time. Keep it safe!"
echo "--- configured ---"
echo "database : ${database}"
echo "E2EE passphrase: ${passphrase}"
echo "--- setup uri ---"
deno run -A generate_setupuri.ts
else
echo "Setup finished! Here is the configured values (reprise)!"
echo "-- YOUR CONFIGURATION --"
echo "URL : $hostname"
echo "username: $username"
echo "password: $password"
echo "-- YOUR CONFIGURATION --"
echo "If we had Deno, we would got the setup uri directly!"
fi
echo "Setup finished. The Commonlib-generated Setup URI follows."
echo "Its passphrase is printed only once, so store it safely."
echo "--- configured ---"
echo "database: ${database}"
echo "--- setup URI ---"
deno run --minimum-dependency-age=0 --allow-env generate_setupuri.ts