view host/update.sh @ 2100:665d227f06f3 ssltesting

Https cleanup
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 15 Dec 2025 22:45:11 -0700
parents 41b8b2cbbdf8
children 3112b06ab447
line wrap: on
line source

#!/bin/bash

set -e
# prevents error if there is nothing in sites/
shopt -s nullglob

SCRIPT_DIR="$(cd -- "$(dirname -- "$0")" && pwd)"
cd $SCRIPT_DIR

./stop.sh

echo Updating hg
hg pull -u

../scripts/build-luan.sh

mkdir -p local
mkdir -p logs
rm -f logs/*
hg identify >logs/changeset.txt

if [ ! -f local/tiny_account.key ]; then
	echo "Register letsencrypt (tiny-acme)"
	openssl genrsa 4096 >local/tiny_account.key
fi

cp startup/nginx/mime.types local/mime.types
# id -gn gets the name of the primary group of the current user (staff)
luan startup/nginx/nginx.conf.luan $(pwd) $(whoami) $(id -gn) >local/nginx.conf
luan startup/nginx/nginx.default.conf.luan $(pwd) >local/nginx.default.conf

# this is done because the nginx conf uses absolute paths
# and this breaks sites when the luan/host directory is moved
for conf in sites/*/nginx.ssl.conf; do
	domain=$(basename $(dirname "$conf"))
	luan startup/nginx/nginx.ssl.conf.luan $SCRIPT_DIR $domain >$conf
done

echo Starting...
./start.sh