From ed7e04a6b816e934e39c5cb500f15c0d8a04b81f Mon Sep 17 00:00:00 2001 From: Jonathan Zernik Date: Mon, 4 Apr 2022 04:54:50 -0700 Subject: [PATCH] Add agora app (#1282) Co-authored-by: Luke Childs --- apps/agora/data/entrypoint.sh | 8 +++++ apps/agora/data/www/admin/index.html | 14 ++++++++ apps/agora/database/filebrowser.db | 0 apps/agora/docker-compose.yml | 49 ++++++++++++++++++++++++++++ apps/agora/files/.gitkeep | 0 apps/agora/nginx/nginx.conf | 26 +++++++++++++++ apps/registry.json | 25 ++++++++++++++ scripts/configure | 4 +++ templates/.env-sample | 2 ++ templates/torrc-server-sample | 4 +++ 10 files changed, 132 insertions(+) create mode 100755 apps/agora/data/entrypoint.sh create mode 100644 apps/agora/data/www/admin/index.html create mode 100644 apps/agora/database/filebrowser.db create mode 100644 apps/agora/docker-compose.yml create mode 100644 apps/agora/files/.gitkeep create mode 100644 apps/agora/nginx/nginx.conf diff --git a/apps/agora/data/entrypoint.sh b/apps/agora/data/entrypoint.sh new file mode 100755 index 0000000..95e195e --- /dev/null +++ b/apps/agora/data/entrypoint.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +# Update configs +/filebrowser config init +/filebrowser config set --branding.name "Agora Admin" +/filebrowser users add umbrel ${APP_PASSWORD} + +exec /filebrowser -p 8080 --baseurl "/admin/files" diff --git a/apps/agora/data/www/admin/index.html b/apps/agora/data/www/admin/index.html new file mode 100644 index 0000000..c3c6564 --- /dev/null +++ b/apps/agora/data/www/admin/index.html @@ -0,0 +1,14 @@ + + + + Agora Admin + + +

Welcome to Agora Admin!

+ + + diff --git a/apps/agora/database/filebrowser.db b/apps/agora/database/filebrowser.db new file mode 100644 index 0000000..e69de29 diff --git a/apps/agora/docker-compose.yml b/apps/agora/docker-compose.yml new file mode 100644 index 0000000..e89aa7f --- /dev/null +++ b/apps/agora/docker-compose.yml @@ -0,0 +1,49 @@ +version: "3.7" + +services: + filebrowser: + image: filebrowser/filebrowser:v2.21.1@sha256:6da71bfffc1345075a5cc06e0a7ae270098186407c62f4f71994e079677364d0 + user: 1000:1000 + restart: on-failure + stop_grace_period: 1m + volumes: + - ${APP_DATA_DIR}/files:/srv + - ${APP_DATA_DIR}/database/filebrowser.db:/database.db + - ${APP_DATA_DIR}/data:/data + environment: + APP_PASSWORD: "$APP_PASSWORD" + entrypoint: /data/entrypoint.sh + + agora: + image: ghcr.io/agora-org/agora:sha-48d3205@sha256:35eda120a8d868c7fa3b9cbdcad7cc2245b9fe7e0c5356c8091bb0bf9a65222d + restart: on-failure + stop_grace_period: 1m + volumes: + - ${APP_DATA_DIR}/files:/files + - ${LND_DATA_DIR}:/lnd:ro + user: "1000:1000" + environment: + # LND environment variables + LND_RPC_AUTHORITY: "$LND_IP:$LND_GRPC_PORT" + TLS_CERT_PATH: "/lnd/tls.cert" + INVOICES_MACAROON_PATH: "/lnd/data/chain/bitcoin/$BITCOIN_NETWORK/invoice.macaroon" + + # App specific environment variables + FILES_DIR: "/files" + AGORA_PORT: 8080 + + nginx: + image: nginx:1.19-alpine@sha256:c2ce58e024275728b00a554ac25628af25c54782865b3487b11c21cafb7fabda + init: true + restart: on-failure + volumes: + - ${APP_DATA_DIR}/nginx/nginx.conf:/etc/nginx/nginx.conf + - ${APP_DATA_DIR}/data/www:/usr/share/nginx/html + ports: + - "$APP_AGORA_PORT:80" + depends_on: + - agora + - filebrowser + networks: + default: + ipv4_address: $APP_AGORA_IP diff --git a/apps/agora/files/.gitkeep b/apps/agora/files/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/apps/agora/nginx/nginx.conf b/apps/agora/nginx/nginx.conf new file mode 100644 index 0000000..8f6290f --- /dev/null +++ b/apps/agora/nginx/nginx.conf @@ -0,0 +1,26 @@ +events { } + +http { + + +server { + listen 80; + server_name _; + + location / { + proxy_pass http://agora:8080; + } + + location /admin { + root /usr/share/nginx/html; + index index.html; + } + + location /admin/files { + client_max_body_size 0; + proxy_pass http://filebrowser:8080; + } + + } + +} diff --git a/apps/registry.json b/apps/registry.json index d743b85..2eef0f4 100644 --- a/apps/registry.json +++ b/apps/registry.json @@ -1015,5 +1015,30 @@ "path": "", "deterministicPassword": true, "torOnly": false + }, + { + "id": "agora", + "category": "Files", + "name": "Agora", + "version": "v0.1.2", + "tagline": "Earn Bitcoin for hosting files", + "description": "Agora is a project that allows anyone to sell files on the web for bitcoin using the Lightning Network.\n\nAgora serves the contents of a local directory, providing file listings and downloads over HTTP. For example, you can point it at a directory full of PDFs, allowing users to browse and view the PDFs in their web browser. If agora is connected to an LND node, it can be configured to require Lightning Network payments for downloads.", + "developer": "Casey Rodarmor & Sönke Hahn", + "website": "https://agora-org.github.io/agora/", + "dependencies": [ + "lnd" + ], + "repo": "https://github.com/agora-org/agora", + "support": "https://t.me/agoradiscussion", + "port": 12080, + "gallery": [ + "1.jpg", + "2.jpg", + "3.jpg" + ], + "path": "/admin/", + "deterministicPassword": true, + "defaultUsername": "umbrel", + "torOnly": false } ] diff --git a/scripts/configure b/scripts/configure index 0c00fa3..02b549e 100755 --- a/scripts/configure +++ b/scripts/configure @@ -256,6 +256,8 @@ APP_JAM_PORT="5002" APP_BLESKOMAT_SERVER_PORT="3333" APP_BLESKOMAT_SERVER_IP="10.21.21.85" APP_BLESKOMAT_SERVER_DB_IP="10.21.21.86" +APP_AGORA_IP="10.21.21.87" +APP_AGORA_PORT="12080" # Generate RPC credentials if [[ -z ${BITCOIN_RPC_USER+x} ]] || [[ -z ${BITCOIN_RPC_PASS+x} ]] || [[ -z ${BITCOIN_RPC_AUTH+x} ]]; then @@ -512,6 +514,8 @@ for template in "${NGINX_CONF_FILE}" "${BITCOIN_CONF_FILE}" "${LND_CONF_FILE}" " sed -i "s//${APP_BLESKOMAT_SERVER_PORT}/g" "${template}" sed -i "s//${APP_BLESKOMAT_SERVER_IP}/g" "${template}" sed -i "s//${APP_BLESKOMAT_SERVER_DB_IP}/g" "${template}" + sed -i "s//${APP_AGORA_IP}/g" "${template}" + sed -i "s//${APP_AGORA_PORT}/g" "${template}" done ########################################################## diff --git a/templates/.env-sample b/templates/.env-sample index 72a5d1f..8e86861 100644 --- a/templates/.env-sample +++ b/templates/.env-sample @@ -154,3 +154,5 @@ APP_JAM_PORT= APP_BLESKOMAT_SERVER_PORT= APP_BLESKOMAT_SERVER_IP= APP_BLESKOMAT_SERVER_DB_IP= +APP_AGORA_IP= +APP_AGORA_PORT= diff --git a/templates/torrc-server-sample b/templates/torrc-server-sample index 54eb195..93dbcbf 100644 --- a/templates/torrc-server-sample +++ b/templates/torrc-server-sample @@ -225,3 +225,7 @@ HiddenServicePort 80 :80 # bleskomat-server Hidden Service HiddenServiceDir /data/app-bleskomat-server HiddenServicePort 80 : + +# agora Hidden Service +HiddenServiceDir /data/app-agora +HiddenServicePort 80 :80