From 1d6f58ab8b5f042bcd58b53ef40c431dc9d70e6a Mon Sep 17 00:00:00 2001 From: counterweight Date: Wed, 24 Dec 2025 10:39:09 +0100 Subject: [PATCH] working --- .gitignore | 1 + Makefile | 39 ++++++++++++++++++++++++++ README.md | 17 +++++++++++ caddy.bitcoininfra.contrapeso.xyz.conf | 21 ++++++++++++++ config/services.json | 2 +- deploy.config.example | 19 +++++++++++++ 6 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 Makefile create mode 100644 caddy.bitcoininfra.contrapeso.xyz.conf create mode 100644 deploy.config.example diff --git a/.gitignore b/.gitignore index 3ca3e45..874696e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ dist/ *.pyc __pycache__/ .DS_Store +deploy.config diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f5622a1 --- /dev/null +++ b/Makefile @@ -0,0 +1,39 @@ +SHELL := /bin/bash +.PHONY: build serve deploy help + +# Default target +help: + @echo "Available targets:" + @echo " make build - Build the static site" + @echo " make serve - Serve the site locally on port 8000" + @echo " make deploy - Deploy the built site to remote server" + @echo "" + @echo "For deployment, copy deploy.config.example to deploy.config and fill in your details" + +# Build the site +build: + @echo "Building site..." + python3 build.py + +# Serve locally +serve: build + @echo "Serving site at http://localhost:8000" + @echo "Press Ctrl+C to stop" + cd dist && python3 -m http.server 8000 + +# Deploy to remote server +deploy: build + @if [ ! -f deploy.config ]; then \ + echo "Error: deploy.config not found!"; \ + echo "Copy deploy.config.example to deploy.config and fill in your details."; \ + exit 1; \ + fi + @echo "Deploying to remote server..." + @source deploy.config; \ + SSH_CMD="ssh"; \ + if [ -n "$$SSH_PORT" ]; then SSH_CMD="$$SSH_CMD -p $$SSH_PORT"; fi; \ + if [ -n "$$SSH_KEY" ]; then SSH_CMD="$$SSH_CMD -i $$SSH_KEY"; fi; \ + rsync -avz --delete -e "$$SSH_CMD" \ + dist/ $$REMOTE_USER@$$REMOTE_HOST:$$REMOTE_PATH + @echo "✓ Deployment complete!" + diff --git a/README.md b/README.md index 0bec202..24086a5 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,27 @@ Static site generator for sharing self-hosted service information. ## Usage +### Build the site +```bash +make build +``` +or ```bash python3 build.py ``` +### Serve locally +```bash +make serve +``` +Serves the site at http://localhost:8000 + +### Deploy to remote server +```bash +make deploy +``` +Before deploying, copy `deploy.config.example` to `deploy.config` and fill in your server details. + Edit `config/services.json` to customize content. Output is generated in `dist/`. ## Structure diff --git a/caddy.bitcoininfra.contrapeso.xyz.conf b/caddy.bitcoininfra.contrapeso.xyz.conf new file mode 100644 index 0000000..ff06d13 --- /dev/null +++ b/caddy.bitcoininfra.contrapeso.xyz.conf @@ -0,0 +1,21 @@ +bitcoininfra.contrapeso.xyz { + # Root directory where the static files are located + root * /var/www/bitcoin-services-home/ + + # Enable file server to serve static files + file_server + + # Optional: Enable compression + encode gzip zstd + + # Optional: Set security headers + header { + # Security headers + X-Content-Type-Options "nosniff" + X-Frame-Options "DENY" + X-XSS-Protection "1; mode=block" + Referrer-Policy "strict-origin-when-cross-origin" + } + +} + diff --git a/config/services.json b/config/services.json index a6d1b67..ccd9bdf 100644 --- a/config/services.json +++ b/config/services.json @@ -1,6 +1,6 @@ { "site": { - "title": "COUNTER BITCOIN SERVICES", + "title": "COUNTERWEIGHT'S BITCOIN SERVICES", "subtitle": "Self-Hosted Infrastructure Available for the Public", "description": "Welcome to my self-hosted services Bitcoin hub. I run this for myself, but you are welcome to use it as well free of cost.\nIf you feel like helping pay the bills, you can send some sats to infra@wallet.contrapeso.xyz." }, diff --git a/deploy.config.example b/deploy.config.example new file mode 100644 index 0000000..b81658f --- /dev/null +++ b/deploy.config.example @@ -0,0 +1,19 @@ +# Deployment Configuration +# Copy this file to deploy.config and fill in your actual values +# deploy.config is gitignored and will not be committed + +# Remote server hostname or IP address +REMOTE_HOST=example.com + +# Remote server username +REMOTE_USER=username + +# Remote path where the site should be deployed (absolute path) +REMOTE_PATH=/var/www/bitcoin-services-home + +# Optional: SSH port (defaults to 22 if not specified) +# SSH_PORT=22 + +# Optional: Path to SSH private key (if not using default ~/.ssh/id_rsa) +# SSH_KEY=~/.ssh/id_rsa +