1
1

Added NOSTR RELAY stack.

This commit is contained in:
Derek Smith 2022-11-13 20:23:48 -05:00
parent 25139b514c
commit e6acdb9df3
Signed by: farscapian
GPG Key ID: 8F1CD799CCA516CC
8 changed files with 109 additions and 5 deletions

View File

@ -6,7 +6,7 @@ export WWW_SERVER_MAC_ADDRESS=
export DEPLOY_WWW_SERVER=false export DEPLOY_WWW_SERVER=false
export DEPLOY_BTCPAY_SERVER=false export DEPLOY_BTCPAY_SERVER=false
export DEPLOY_GHOST=true export DEPLOY_GHOST=true
export DEPLOY_NOSTR_RELAY=true export DEPLOY_NOSTR_RELAY=false
export DEPLOY_ONION_SITE=false export DEPLOY_ONION_SITE=false
export DEPLOY_NEXTCLOUD=false export DEPLOY_NEXTCLOUD=false
export DEPLOY_GITEA=false export DEPLOY_GITEA=false
@ -83,6 +83,8 @@ export NEXTCLOUD_DB_IMAGE="$DEFAULT_DB_IMAGE"
export GITEA_IMAGE="gitea/gitea:latest" export GITEA_IMAGE="gitea/gitea:latest"
export GITEA_DB_IMAGE="$DEFAULT_DB_IMAGE" export GITEA_DB_IMAGE="$DEFAULT_DB_IMAGE"
export NOSTR_RELAY_IMAGE="scsibug/nostr-rs-relay"
export SOVEREIGN_STACK_MAC_ADDRESS= export SOVEREIGN_STACK_MAC_ADDRESS=
export WWW_SERVER_MAC_ADDRESS= export WWW_SERVER_MAC_ADDRESS=
export BTCPAYSERVER_MAC_ADDRESS= export BTCPAYSERVER_MAC_ADDRESS=

View File

@ -396,7 +396,7 @@ export SITE_LANGUAGE_CODES="en"
export DUPLICITY_BACKUP_PASSPHRASE="$(new_pass)" export DUPLICITY_BACKUP_PASSPHRASE="$(new_pass)"
export DEPLOY_GHOST=true export DEPLOY_GHOST=true
export DEPLOY_NEXTCLOUD=false export DEPLOY_NEXTCLOUD=false
export DEPLOY_NOSTR_RELAY=true export DEPLOY_NOSTR_RELAY=false
export NOSTR_ACCOUNT_PUBKEY="NOSTR_IDENTITY_PUBKEY_GOES_HERE" export NOSTR_ACCOUNT_PUBKEY="NOSTR_IDENTITY_PUBKEY_GOES_HERE"
export DEPLOY_GITEA=false export DEPLOY_GITEA=false
#export DEPLOY_ONION_SITE=false #export DEPLOY_ONION_SITE=false

View File

@ -8,6 +8,7 @@ cd "$(dirname "$0")"
# This is the config for a basic proxy to the listening port 127.0.0.1:2368 # This is the config for a basic proxy to the listening port 127.0.0.1:2368
# It also supports modern TLS, so SSL certs must be available. # It also supports modern TLS, so SSL certs must be available.
#opt-add-nostr-relay;
cat > "$SITE_PATH/btcpay.sh" <<EOL cat > "$SITE_PATH/btcpay.sh" <<EOL
#!/bin/bash #!/bin/bash
@ -37,7 +38,7 @@ export NBITCOIN_NETWORK="${BTC_CHAIN}"
export LIGHTNING_ALIAS="${PRIMARY_DOMAIN}" export LIGHTNING_ALIAS="${PRIMARY_DOMAIN}"
export BTCPAYGEN_LIGHTNING="clightning" export BTCPAYGEN_LIGHTNING="clightning"
export BTCPAYGEN_CRYPTO1="btc" export BTCPAYGEN_CRYPTO1="btc"
export BTCPAYGEN_ADDITIONAL_FRAGMENTS="opt-save-storage-s;opt-add-btctransmuter;opt-add-nostr-relay;" export BTCPAYGEN_ADDITIONAL_FRAGMENTS="opt-save-storage-s;opt-add-btctransmuter;"
export BTCPAYGEN_REVERSEPROXY="nginx" export BTCPAYGEN_REVERSEPROXY="nginx"
export BTCPAY_ENABLE_SSH=false export BTCPAY_ENABLE_SSH=false
export BTCPAY_BASE_DIRECTORY=${REMOTE_HOME} export BTCPAY_BASE_DIRECTORY=${REMOTE_HOME}

View File

@ -116,7 +116,7 @@ done
./stub/ghost_yml.sh ./stub/ghost_yml.sh
./stub/nextcloud_yml.sh ./stub/nextcloud_yml.sh
./stub/gitea_yml.sh ./stub/gitea_yml.sh
./stub/nostr_yml.sh
# # start a browser session; point it to port 80 to ensure HTTPS redirect. # # start a browser session; point it to port 80 to ensure HTTPS redirect.
# # WWW_FQDN is in our certificate, so we resolve to that. # # WWW_FQDN is in our certificate, so we resolve to that.

View File

@ -14,7 +14,7 @@ for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
source ../../domain_env.sh source ../../domain_env.sh
### Stop all services. ### Stop all services.
for APP in ghost nextcloud gitea; do for APP in ghost nextcloud gitea nostr; do
# backup each language for each app. # backup each language for each app.
for LANGUAGE_CODE in ${SITE_LANGUAGE_CODES//,/ }; do for LANGUAGE_CODE in ${SITE_LANGUAGE_CODES//,/ }; do
STACK_NAME="$DOMAIN_IDENTIFIER-$APP-$LANGUAGE_CODE" STACK_NAME="$DOMAIN_IDENTIFIER-$APP-$LANGUAGE_CODE"

View File

@ -218,6 +218,35 @@ EOL
EOL EOL
if [ "$DEPLOY_NOSTR_RELAY" = true ]; then
cat >>"$NGINX_CONF_PATH" <<EOL
# wss://$NOSTR_FQDN server block
server {
listen 443 ssl;
server_name ${NOSTR_FQDN};
ssl_certificate $CONTAINER_TLS_PATH/fullchain.pem;
ssl_certificate_key $CONTAINER_TLS_PATH/privkey.pem;
ssl_trusted_certificate $CONTAINER_TLS_PATH/fullchain.pem;
keepalive_timeout 70;
location / {
# redirect all HTTP traffic to btcpay server
proxy_pass http://nostr-${DOMAIN_IDENTIFIER}:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host \$host;
}
}
EOL
fi
cat >>"$NGINX_CONF_PATH" <<EOL cat >>"$NGINX_CONF_PATH" <<EOL
# https server block for https://${BTCPAY_SERVER_NAMES} # https server block for https://${BTCPAY_SERVER_NAMES}
server { server {

View File

@ -45,7 +45,12 @@ EOL
cat >> "$DOCKER_YAML_PATH" <<EOL cat >> "$DOCKER_YAML_PATH" <<EOL
- nextcloudnet-$DOMAIN_IDENTIFIER-en - nextcloudnet-$DOMAIN_IDENTIFIER-en
EOL EOL
fi
if [ "$DEPLOY_NOSTR_RELAY" = "true" ]; then
cat >> "$DOCKER_YAML_PATH" <<EOL
- nostrnet-$DOMAIN_IDENTIFIER
EOL
fi fi
fi fi
@ -112,6 +117,15 @@ EOL
nextcloudnet-$DOMAIN_IDENTIFIER-en: nextcloudnet-$DOMAIN_IDENTIFIER-en:
attachable: true attachable: true
EOL
fi
if [ "$DEPLOY_NOSTR_RELAY" = "true" ]; then
cat >> "$DOCKER_YAML_PATH" <<EOL
nostrnet-$DOMAIN_IDENTIFIER:
attachable: true
EOL EOL
fi fi

View File

@ -0,0 +1,58 @@
#!/bin/bash
set -exu
cd "$(dirname "$0")"
for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
export DOMAIN_NAME="$DOMAIN_NAME"
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
# source the site path so we know what features it has.
source "$RESPOSITORY_PATH/reset_env.sh"
source "$SITE_PATH/site_definition"
source "$RESPOSITORY_PATH/domain_env.sh"
if [ "$DEPLOY_NOSTR_RELAY" = true ]; then
REMOTE_NOSTR_PATH="$REMOTE_HOME/nostr"
NOSTR_PATH="$REMOTE_NOSTR_PATH/$DOMAIN_NAME"
ssh "$PRIMARY_WWW_FQDN" mkdir -p "$NOSTR_PATH/data" "$NOSTR_PATH/db"
export STACK_TAG="nostr-$DOMAIN_IDENTIFIER"
export DOCKER_YAML_PATH="$SITE_PATH/webstack/nostr.yml"
NET_NAME="nostrnet-$DOMAIN_IDENTIFIER"
DBNET_NAME="nostrdbnet-$DOMAIN_IDENTIFIER"
# here's the NGINX config. We support ghost and nextcloud.
echo "" > "$DOCKER_YAML_PATH"
cat >>"$DOCKER_YAML_PATH" <<EOL
version: "3.8"
services:
${STACK_TAG}:
image: ${NOSTR_RELAY_IMAGE}
volumes:
- ${NOSTR_PATH}/data:/usr/src/app/db
# environment:
# - USER_UID=1000
networks:
- ${NET_NAME}
deploy:
restart_policy:
condition: on-failure
networks:
${NET_NAME}:
name: "reverse-proxy_${NET_NAME}"
external: true
EOL
docker pull "$NOSTR_RELAY_IMAGE"
docker stack deploy -c "$DOCKER_YAML_PATH" "$DOMAIN_IDENTIFIER-nostr"
sleep 1
fi
done