chore: configurable deployment

This commit is contained in:
Shivering Ocelot committed 2026-09-20 17:00:38 -05:00
1 parent caeb47be11
commit 6be745a6f4
6 files changed
+62 -30

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
domain=hub.hordelab.com
install_path=/var/horde/hub/
+50 -21
View File
@@ -2,42 +2,71 @@
set -euo pipefail
cd "$(dirname "$0")"
host="root@hub.hordelab.com"
remote_path="/var/horde/hub/"
if [ ! -f .env ]; then
echo ".env file not found. You can create one by copying the provided example:"
echo "cp $(dirname "$0")/example.env $(dirname "$0")/.env"
exit 1
fi
source .env
# Required: crash if not set in .env
: "${domain:?domain is not defined in .env}"
: "${install_path:?install_path is not defined in .env}"
# Optional: fall back to defaults
: "${data_path:=$install_path/local-data}"
: "${launch_path:=$data_path/hub-launch.sh}"
: "${service_name:=horde-hub}"
: "${port:=17922}"
: "${remote:=$domain}"
read_template() {
sed \
-e "s/\$DOMAIN/$domain/g" \
-e "s|\$INSTALL_PATH|$install_path|g" \
-e "s|\$LAUNCH_PATH|$launch_path|g" \
-e "s|\$DATA_PATH|$data_path|g" \
-e "s/\$SERVICE_NAME/$service_name/g" \
-e "s/\$PORT/$port/g" \
template/$1
}
upload_template() {
read_template $1 | ssh $remote "cat > \"$2\""
}
run_nginx() {
echo "Uploading nginx config file"
scp template/nginx.conf "$host:/etc/nginx/sites-enabled/hub.hordelab.com"
ssh "$host" -t "
nginx -s reload
upload_template nginx.conf "/etc/nginx/sites-enabled/$domain"
ssh $remote -t "
# full process is currently broken
#certbot --keep -d hub.hordelab.com
#certbot --keep -d $domain
# uncomment if needed
#certbot certonly -d hub.hordelab.com
#certbot certonly -d $domain
#nginx -s reload
nginx -s reload
"
}
run_service() {
echo "Uploading Launcher and Service"
scp template/launch-hub.sh "$host:/var/horde/launch-hub.sh"
scp template/systemd.service "$host:/etc/systemd/system/horde-hub.service"
ssh "$host" -t "
upload_template launch-hub.sh $launch_path
upload_template systemd.service "/etc/systemd/system/$service_name.service"
ssh $remote -t "
systemctl daemon-reload
systemctl enable horde-hub.service
systemctl start horde-hub.service
systemctl enable $service_name.service
systemctl start $service_name.service
"
}
run_update() {
echo "Updating repository"
ssh "$host" -t "
ssh $remote -t "
source ~/.nvm/nvm.sh #?
cd /var/horde/hub
cd $install_path
git pull
make install
make web
@@ -45,14 +74,14 @@ run_update() {
}
run_dist() {
echo "Uploading frontend/dist to $host:/var/frontend/dist"
ssh "$host" "rm -rf $remote_path/frontend/dist && mkdir $remote_path/frontend/dist"
scp -r ../frontend/dist "$host:$remote_path/frontend/"
echo "Uploading frontend/dist to $remote:$install_path/frontend/dist"
ssh $remote "rm -rf $install_path/frontend/dist && mkdir $install_path/frontend/dist"
scp -r ../frontend/dist $remote:$install_path/frontend/
}
restart_service() {
echo "Restarting horde-hub.service"
ssh "$host" -t "systemctl restart horde-hub.service"
echo "Restarting $service_name.service"
ssh $remote -t "systemctl restart $service_name.service"
}
# Determine which stages to run
+3 -2
View File
@@ -1,8 +1,9 @@
# Remove tracked keys lmao
export OPENAI_API_KEY=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
export REPLICATE_API_KEY=r8_J1lnphqfZNUtK9CIh81SE4uHWWKJuvR3tr8S2
export OPENROUTER_API_KEY=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
export HORDE_DATA_DIR=/var/horde/hub-data
export HORDE_DATA_DIR=$DATA_PATH
echo Starting Horde Server
/var/horde/hub/.venv/bin/python3 /var/horde/hub/backend/src/app.py
$INSTALL_PATH/.venv/bin/python3 $INSTALL_PATH/backend/src/app.py
+5 -5
View File
@@ -2,7 +2,7 @@
server {
listen 80;
listen [::]:80;
server_name hub.hordelab.com;
server_name $DOMAIN;
return 301 https://$host$request_uri;
}
@@ -12,13 +12,13 @@ server {
listen 443 ssl;
listen [::]:443 ssl;
server_name hub.hordelab.com;
server_name $DOMAIN;
ssl_certificate /etc/letsencrypt/live/hub.hordelab.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/hub.hordelab.com/privkey.pem;
ssl_certificate /etc/letsencrypt/live/$DOMAIN/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/$DOMAIN/privkey.pem;
location / {
proxy_pass http://localhost:17922;
proxy_pass http://localhost:$PORT;
proxy_http_version 1.1;
# Websocket support
+1 -1
View File
@@ -5,7 +5,7 @@ After=network.target
[Service]
Type=simple
Restart=always
ExecStart=bash /var/horde/launch-hub.sh
ExecStart=bash $LAUNCH_PATH
[Install]
WantedBy=multi-user.target
+1 -1
View File
@@ -57,7 +57,7 @@ case "$1" in
;;
"deploy")
bash deploy/run.sh $@
bash deploy/run.sh "${@:2}"
;;
# Execute with custom home directory if it exists