From ddb0fbef57f19a09a108dc73fb69b928911ff19c Mon Sep 17 00:00:00 2001 From: Derek Smith Date: Sun, 5 Mar 2023 11:49:06 -0500 Subject: [PATCH] Add clams integration. --- defaults.sh | 5 ++-- deployment/deploy.sh | 1 + deployment/www/deploy_clams.sh | 24 --------------- deployment/www/generate_certs.sh | 2 ++ deployment/www/go.sh | 4 ++- deployment/www/prepare_clams.sh | 46 +++++++++++++++++++++++++++++ deployment/www/stub/nginx_config.sh | 28 ++++++++++++++++-- deployment/www/stub/nginx_yml.sh | 31 ++++++++++++++----- 8 files changed, 104 insertions(+), 37 deletions(-) delete mode 100755 deployment/www/deploy_clams.sh create mode 100755 deployment/www/prepare_clams.sh diff --git a/defaults.sh b/defaults.sh index 032e05a..087489c 100755 --- a/defaults.sh +++ b/defaults.sh @@ -2,8 +2,9 @@ set -e -export DEPLOY_WWW_SERVER=false -export DEPLOY_GHOST=false + +export DEPLOY_GHOST=true +export DEPLOY_CLAMS=true export DEPLOY_NEXTCLOUD=false export DEPLOY_GITEA=false diff --git a/deployment/deploy.sh b/deployment/deploy.sh index 553cdd7..644865e 100755 --- a/deployment/deploy.sh +++ b/deployment/deploy.sh @@ -292,6 +292,7 @@ export DOMAIN_NAME="${DOMAIN_NAME}" export SITE_LANGUAGE_CODES="en" export DUPLICITY_BACKUP_PASSPHRASE="$(new_pass)" export DEPLOY_GHOST=true +export DEPLOY_CLAMS=true export DEPLOY_NEXTCLOUD=false export NOSTR_ACCOUNT_PUBKEY= export DEPLOY_GITEA=false diff --git a/deployment/www/deploy_clams.sh b/deployment/www/deploy_clams.sh deleted file mode 100755 index 99e6b50..0000000 --- a/deployment/www/deploy_clams.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -set -ex -cd "$(dirname "$0")" - -# deploy clams wallet. -LOCAL_CLAMS_REPO_PATH="$(pwd)/www/clams" -if [ "$DEPLOY_BTCPAY_SERVER" = true ]; then - if [ ! -d "$LOCAL_CLAMS_REPO_PATH" ]; then - git clone "$CLAMS_GIT_REPO" "$LOCAL_CLAMS_REPO_PATH" - else - cd "$LOCAL_CLAMS_REPO_PATH" - #git config pull.ff only - git pull - cd - - fi -fi - -lxc file push -r -p ./clams "${PRIMARY_WWW_FQDN//./-}"/home/ubuntu/code - -# run the primary script and output the files to --output-path -ssh "$PRIMARY_WWW_FQDN" mkdir -p "$REMOTE_HOME/clams/browser-app" -ssh "$PRIMARY_WWW_FQDN" "$REMOTE_HOME/code/clams/browser-app/run.sh --output-path=$REMOTE_HOME/clams/browser-app" -ssh "$PRIMARY_WWW_FQDN" rm -rf "$REMOTE_HOME/code" diff --git a/deployment/www/generate_certs.sh b/deployment/www/generate_certs.sh index 06e770d..acd6d5b 100755 --- a/deployment/www/generate_certs.sh +++ b/deployment/www/generate_certs.sh @@ -25,7 +25,9 @@ for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do if [ "$DOMAIN_NAME" = "$PRIMARY_DOMAIN" ]; then DOMAIN_STRING="$DOMAIN_STRING -d $CLAMS_FQDN"; fi if [ "$DEPLOY_NEXTCLOUD" = true ]; then DOMAIN_STRING="$DOMAIN_STRING -d $NEXTCLOUD_FQDN"; fi if [ "$DEPLOY_GITEA" = true ]; then DOMAIN_STRING="$DOMAIN_STRING -d $GITEA_FQDN"; fi + if [ "$DEPLOY_CLAMS" = true ]; then DOMAIN_STRING="$DOMAIN_STRING -d $CLAMS_FQDN"; fi if [ -n "$NOSTR_ACCOUNT_PUBKEY" ]; then DOMAIN_STRING="$DOMAIN_STRING -d $NOSTR_FQDN"; fi + # if BTCPAY_ALT_NAMES has been set by the admin, iterate over the list # and append the domain names to the certbot request diff --git a/deployment/www/go.sh b/deployment/www/go.sh index d5d8a82..795c53c 100755 --- a/deployment/www/go.sh +++ b/deployment/www/go.sh @@ -3,6 +3,9 @@ set -eu cd "$(dirname "$0")" +# prepare clams images and such +./prepare_clams.sh + # Create the nginx config file which covers all domains. bash -c ./stub/nginx_config.sh @@ -137,7 +140,6 @@ fi ./stub/nextcloud_yml.sh ./stub/gitea_yml.sh ./stub/nostr_yml.sh -./deploy_clams.sh # # start a browser session; point it to port 80 to ensure HTTPS redirect. # # WWW_FQDN is in our certificate, so we resolve to that. diff --git a/deployment/www/prepare_clams.sh b/deployment/www/prepare_clams.sh new file mode 100755 index 0000000..fefe217 --- /dev/null +++ b/deployment/www/prepare_clams.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +set -ex +cd "$(dirname "$0")" + +# deploy clams wallet. +LOCAL_CLAMS_REPO_PATH="$(pwd)/clams" + +if [ ! -d "$LOCAL_CLAMS_REPO_PATH" ]; then + git clone "$CLAMS_GIT_REPO" "$LOCAL_CLAMS_REPO_PATH" +else + cd "$LOCAL_CLAMS_REPO_PATH" + git config --global pull.rebase false + git pull + cd - +fi + + +# # overwrite the clams/.env file with Sovereign Stack specific parameters. +# CLAMS_CONFIG_PATH="$LOCAL_CLAMS_REPO_PATH/.env" +# cat > "$CLAMS_CONFIG_PATH" <> "$NGINX_CONF_PATH" <> "$DOCKER_YAML_PATH" <> "$DOCKER_YAML_PATH" <> "$DOCKER_YAML_PATH" <> "$DOCKER_YAML_PATH" <> "$DOCKER_YAML_PATH" <> "$DOCKER_YAML_PATH" <> "$DOCKER_YAML_PATH" <> "$DOCKER_YAML_PATH" <> "$DOCKER_YAML_PATH" <