From ea78a2b7345bb362633ca337a2277ed213b5394c Mon Sep 17 00:00:00 2001 From: Derek Smith Date: Sun, 2 Apr 2023 09:30:34 -0400 Subject: [PATCH] Update Clams deployment. --- www/go.sh | 9 ++-- www/prepare_clams.sh | 35 ---------------- www/stub/nginx_config.sh | 91 ++++++++++++++++++---------------------- www/stub/nginx_yml.sh | 10 ----- 4 files changed, 46 insertions(+), 99 deletions(-) delete mode 100755 www/prepare_clams.sh diff --git a/www/go.sh b/www/go.sh index d8809c8..d17e96e 100755 --- a/www/go.sh +++ b/www/go.sh @@ -7,9 +7,6 @@ cd "$(dirname "$0")" DOCKER_HOST="ssh://ubuntu@$WWW_FQDN" export DOCKER_HOST="$DOCKER_HOST" -# prepare clams images and such -#./prepare_clams.sh - # Create the nginx config file which covers all domainys. bash -c ./stub/nginx_config.sh @@ -68,6 +65,12 @@ for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do exit 1 fi + # prepare clams images and such + if [ "$DEPLOY_CLAMS" = true ]; then + echo "" + ./clams/build.sh + fi + done ./stop_docker_stacks.sh diff --git a/www/prepare_clams.sh b/www/prepare_clams.sh deleted file mode 100755 index c3af997..0000000 --- a/www/prepare_clams.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -set -e -cd "$(dirname "$0")" - -# deploy clams wallet. -LOCAL_CLAMS_REPO_PATH="$(pwd)/clams" -CLAMS_APP_DOCKER_REPO_URL="https://github.com/farscapian/clams-app-docker" -if [ ! -d "$LOCAL_CLAMS_REPO_PATH" ]; then - git clone "$CLAMS_APP_DOCKER_REPO_URL" "$LOCAL_CLAMS_REPO_PATH" -else - cd "$LOCAL_CLAMS_REPO_PATH" - git config --global pull.rebase false - git pull - cd - -fi - -# lxc file push -r -p "$LOCAL_CLAMS_REPO_PATH" "${PRIMARY_WWW_FQDN//./-}$REMOTE_HOME" -BROWSER_APP_GIT_TAG="1.5.0" -BROWSER_APP_GIT_REPO_URL="https://github.com/clams-tech/browser-app" -BROWSER_APP_IMAGE_NAME="browser-app:$BROWSER_APP_GIT_TAG" - -# build the browser-app image. -if ! docker image list --format "{{.Repository}}:{{.Tag}}" | grep -q "$BROWSER_APP_IMAGE_NAME"; then - docker build --build-arg GIT_REPO_URL="$BROWSER_APP_GIT_REPO_URL" \ - --build-arg VERSION="$BROWSER_APP_GIT_TAG" \ - -t "$BROWSER_APP_IMAGE_NAME" \ - "$(pwd)/clams/frontend/browser-app/" -fi - -# If the clams-root volume doesn't exist, we create and seed it. -if ! docker volume list | grep -q clams-root; then - docker volume create clams-root - docker run -t --rm -v clams-root:/output --name browser-app "$BROWSER_APP_IMAGE_NAME" -fi diff --git a/www/stub/nginx_config.sh b/www/stub/nginx_config.sh index 591c538..7a62fa3 100755 --- a/www/stub/nginx_config.sh +++ b/www/stub/nginx_config.sh @@ -31,6 +31,8 @@ events { http { client_max_body_size 100m; server_tokens off; + sendfile on; + include mime.types; # next two sets commands and connection_upgrade block come from https://docs.btcpayserver.org/FAQ/Deployment/#can-i-use-an-existing-nginx-server-as-a-reverse-proxy-with-ssl-termination # Needed to allow very long URLs to prevent issues while signing PSBTs @@ -49,13 +51,31 @@ http { # return 403 for all non-explicit hostnames server { - listen 80 default_server; - return 301 https://${WWW_FQDN}\$request_uri; + listen 80 default_server; + return 301 https://${WWW_FQDN}\$request_uri; } EOL fi + + if [ "$DEPLOY_CLAMS" = true ]; then + # clams-browser-app server + cat >>"$NGINX_CONF_PATH" <>"$NGINX_CONF_PATH" <>"$NGINX_CONF_PATH" <>"$NGINX_CONF_PATH" <>"$NGINX_CONF_PATH" for LANGUAGE_CODE in ${SITE_LANGUAGE_CODES//,/ }; do @@ -506,31 +520,6 @@ EOL EOL fi - # deploy Clams browser app under the primary domain. - if [ $iteration = 0 ]; then - -cat >> "$NGINX_CONF_PATH" <> "$DOCKER_YAML_PATH" <