Update Clams deployment.

This commit is contained in:
Derek Smith 2023-04-02 09:30:34 -04:00
parent 6d59329a21
commit ea78a2b734
Signed by: farscapian
GPG Key ID: B443E530A14E1C90
4 changed files with 46 additions and 99 deletions

View File

@ -7,9 +7,6 @@ cd "$(dirname "$0")"
DOCKER_HOST="ssh://ubuntu@$WWW_FQDN" DOCKER_HOST="ssh://ubuntu@$WWW_FQDN"
export DOCKER_HOST="$DOCKER_HOST" export DOCKER_HOST="$DOCKER_HOST"
# prepare clams images and such
#./prepare_clams.sh
# Create the nginx config file which covers all domainys. # Create the nginx config file which covers all domainys.
bash -c ./stub/nginx_config.sh bash -c ./stub/nginx_config.sh
@ -68,6 +65,12 @@ for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
exit 1 exit 1
fi fi
# prepare clams images and such
if [ "$DEPLOY_CLAMS" = true ]; then
echo ""
./clams/build.sh
fi
done done
./stop_docker_stacks.sh ./stop_docker_stacks.sh

View File

@ -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

View File

@ -31,6 +31,8 @@ events {
http { http {
client_max_body_size 100m; client_max_body_size 100m;
server_tokens off; 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 # 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 # Needed to allow very long URLs to prevent issues while signing PSBTs
@ -49,13 +51,31 @@ http {
# return 403 for all non-explicit hostnames # return 403 for all non-explicit hostnames
server { server {
listen 80 default_server; listen 80 default_server;
return 301 https://${WWW_FQDN}\$request_uri; return 301 https://${WWW_FQDN}\$request_uri;
} }
EOL EOL
fi fi
if [ "$DEPLOY_CLAMS" = true ]; then
# clams-browser-app server
cat >>"$NGINX_CONF_PATH" <<EOL
# https server block for https://${CLAMS_FQDN}
server {
listen 80;
server_name ${CLAMS_FQDN};
location / {
return 301 https://${CLAMS_FQDN}\$request_uri;
}
}
EOL
fi
# ghost http to https redirects. # ghost http to https redirects.
cat >>"$NGINX_CONF_PATH" <<EOL cat >>"$NGINX_CONF_PATH" <<EOL
# http://${DOMAIN_NAME} redirect to https://${WWW_FQDN} # http://${DOMAIN_NAME} redirect to https://${WWW_FQDN}
@ -263,35 +283,29 @@ EOL
EOL EOL
# Clams server entry if [ "$DEPLOY_CLAMS" = true ]; then
# clams-browser-app server
cat >>"$NGINX_CONF_PATH" <<EOL
# https server block for https://${CLAMS_FQDN}
server {
listen 443 ssl;
# cat >>"$NGINX_CONF_PATH" <<EOL ssl_certificate $CONTAINER_TLS_PATH/fullchain.pem;
# # https server block for https://${CLAMS_FQDN} ssl_certificate_key $CONTAINER_TLS_PATH/privkey.pem;
# server { ssl_trusted_certificate $CONTAINER_TLS_PATH/fullchain.pem;
# listen 443 ssl http2;
# ssl_certificate $CONTAINER_TLS_PATH/fullchain.pem; server_name ${CLAMS_FQDN};
# ssl_certificate_key $CONTAINER_TLS_PATH/privkey.pem;
# ssl_trusted_certificate $CONTAINER_TLS_PATH/fullchain.pem;
# server_name ${CLAMS_FQDN}; server_tokens off;
# index index.js; autoindex off;
gzip_static on;
# root /apps/clams; root /browser-app;
# index 200.htm; index 200.html;
}
# location / {
# try_files \$uri \$uri/ /200.htm;
# }
# location ~* \.(?:css|js|jpg|svg)$ { EOL
# expires 30d; fi
# add_header Cache-Control "public";
# }
# }
# EOL
echo " # set up cache paths for nginx caching" >>"$NGINX_CONF_PATH" echo " # set up cache paths for nginx caching" >>"$NGINX_CONF_PATH"
for LANGUAGE_CODE in ${SITE_LANGUAGE_CODES//,/ }; do for LANGUAGE_CODE in ${SITE_LANGUAGE_CODES//,/ }; do
@ -506,31 +520,6 @@ EOL
EOL EOL
fi fi
# deploy Clams browser app under the primary domain.
if [ $iteration = 0 ]; then
cat >> "$NGINX_CONF_PATH" <<EOF
# server block for the clams browser-app; just a static website
server {
listen 443 ssl;
server_name ${CLAMS_FQDN};
autoindex off;
server_tokens off;
gzip_static on;
root /browser-app;
index 200.html;
}
EOF
fi
iteration=$((iteration+1)) iteration=$((iteration+1))
done done

View File

@ -137,16 +137,6 @@ EOL
done done
done done
if [ "$DEPLOY_CLAMS" = true ]; then
cat >> "$DOCKER_YAML_PATH" <<EOL
volumes:
clams-browser-app:
external: true
name: clams-root
EOL
fi
if [ "$STOP_SERVICES" = false ]; then if [ "$STOP_SERVICES" = false ]; then
docker stack deploy -c "$DOCKER_YAML_PATH" "reverse-proxy" docker stack deploy -c "$DOCKER_YAML_PATH" "reverse-proxy"
# iterate over all our domains and create the nginx config file. # iterate over all our domains and create the nginx config file.