From 16cd458ecce89b91011cb1612afa7089f121384d Mon Sep 17 00:00:00 2001 From: mik-tf Date: Tue, 30 Sep 2025 09:24:06 -0400 Subject: [PATCH 1/7] docs: Add deployment guide for Mycelium Society website --- docs/ops/current/deployment.md | 166 +++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 docs/ops/current/deployment.md diff --git a/docs/ops/current/deployment.md b/docs/ops/current/deployment.md new file mode 100644 index 0000000..4749bab --- /dev/null +++ b/docs/ops/current/deployment.md @@ -0,0 +1,166 @@ +# Deployment Guide for Mycelium Society Website + +This guide provides a deployment approach for the Mycelium Society website, adapted from the ThreeFold Marketplace setup. This is a React + Vite frontend application that builds to static files served via Caddy. + +> **Note:** For automated deployment, consider integrating with CI/CD pipelines. + +We show steps for the main branch; for development, adjust accordingly (e.g., use `development` branch and dev-specific paths). + +## Prerequisites + +- Linux server with: + - Git installed + - Node.js (version 18+) and npm installed + - Caddy web server installed + - zinit service manager installed (optional, for automation) + - Root or sudo access + +## Step 1: Clone the Repository + +Create the directory structure and clone the repository: + +```bash +# Create directory structure +mkdir -p /root/code/git.ourworld.tf/mycelium/ +cd /root/code/git.ourworld.tf/mycelium/ + +# Clone the repository +git clone https://git.ourworld.tf/mycelium/www_mycelium_society +cd www_mycelium_society +git checkout main +``` + +## Step 2: Build the Application + +Install dependencies and build the production version: + +```bash +# Install Node.js dependencies +npm install + +# Build for production +npm run build +``` + +This generates optimized static files in the `dist/` folder. + +## Step 3: Create a zinit Service (Optional for Build Automation) + +For automated builds and updates, create a zinit service: + +1. Create the service script: + +```bash +mkdir -p /etc/zinit/cmds +nano /etc/zinit/cmds/mycelium-society.sh +``` + +Add the following content (adjust branch as needed): + +```bash +#!/bin/bash +cd /root/code/git.ourworld.tf/mycelium/www_mycelium_society +git checkout main +npm install +npm run build +# Static files are ready; Caddy serves them +``` + +Make the script executable: + +```bash +chmod +x /etc/zinit/cmds/mycelium-society.sh +``` + +2. Create the zinit service definition: + +```bash +nano /etc/zinit/mycelium-society.yaml +``` + +Add: + +```yaml +exec: "/bin/bash -c /etc/zinit/cmds/mycelium-society.sh" +``` + +## Step 4: Configure Caddy + +Update your Caddyfile to serve the static files: + +```bash +# Edit the Caddyfile (adjust path to your Caddyfile location) +nano /root/code/github/despiegk/env_web/ourworld/ovh1_web_current/caddy/Caddyfile +``` + +Add or update: + +``` +import mycelium_society.caddy +``` + +Create `mycelium_society.caddy`: + +``` +society.mycelium.tf { + root * /root/code/git.ourworld.tf/mycelium/www_mycelium_society/dist + try_files {path} {path}/ /index.html + file_server +} +``` + +For a development environment (separate setup): + +``` +dev.society.mycelium.tf { + root * /root/code/git.ourworld.tf/mycelium/dev/www_mycelium_society/dist + try_files {path} {path}/ /index.html + file_server +} +``` + +## Step 5: Start Services + +```bash +# If using zinit for build automation +zinit start mycelium-society-prod + +# Restart Caddy to load configuration +zinit restart caddy +``` + +## Environment Separation (Dev/Prod) + +For clean separation: + +- **Prod:** `/root/code/git.ourworld.tf/mycelium/prod/www_mycelium_society/` +- **Dev:** `/root/code/git.ourworld.tf/mycelium/dev/www_mycelium_society/` + +Clone and build separately for each. + +## Updating the Application + +To update after changes: + +```bash +cd /root/code/git.ourworld.tf/mycelium/www_mycelium_society +git pull +npm install +npm run build +# Reload Caddy +zinit restart caddy +``` + +## Monitoring + +- Check Caddy status: `zinit list` +- View logs: `zinit log caddy` +- Access the site at `http://your-domain` (ensure DNS points to VM public IP) + +## Local Development + +For local builds: + +- `npm install` +- `npm run dev` (development server) +- `npm run build` (production build) \ No newline at end of file -- 2.43.0 From 718895aac10a05b179e61e345fde46a3c374743c Mon Sep 17 00:00:00 2001 From: mik-tf Date: Tue, 30 Sep 2025 09:51:34 -0400 Subject: [PATCH 2/7] docs: Update deployment guide with corrected Caddy config file names --- docs/ops/current/deployment.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/ops/current/deployment.md b/docs/ops/current/deployment.md index 4749bab..aac2d7b 100644 --- a/docs/ops/current/deployment.md +++ b/docs/ops/current/deployment.md @@ -96,10 +96,10 @@ nano /root/code/github/despiegk/env_web/ourworld/ovh1_web_current/caddy/Caddyfil Add or update: ``` -import mycelium_society.caddy +import society.mycelium.caddy ``` -Create `mycelium_society.caddy`: +Create `society.mycelium.caddy`: ``` society.mycelium.tf { @@ -123,7 +123,8 @@ dev.society.mycelium.tf { ```bash # If using zinit for build automation -zinit start mycelium-society-prod +zinit monitor mycelium-society +zinit start mycelium-society # Restart Caddy to load configuration zinit restart caddy -- 2.43.0 From c4f07c03bff313312fd45666cfdb7953a051cebc Mon Sep 17 00:00:00 2001 From: mik-tf Date: Tue, 30 Sep 2025 09:52:05 -0400 Subject: [PATCH 3/7] docs: Remove dev environment config from deployment guide --- docs/ops/current/deployment.md | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/docs/ops/current/deployment.md b/docs/ops/current/deployment.md index aac2d7b..19b675c 100644 --- a/docs/ops/current/deployment.md +++ b/docs/ops/current/deployment.md @@ -109,16 +109,6 @@ society.mycelium.tf { } ``` -For a development environment (separate setup): - -``` -dev.society.mycelium.tf { - root * /root/code/git.ourworld.tf/mycelium/dev/www_mycelium_society/dist - try_files {path} {path}/ /index.html - file_server -} -``` - ## Step 5: Start Services ```bash @@ -130,15 +120,6 @@ zinit start mycelium-society zinit restart caddy ``` -## Environment Separation (Dev/Prod) - -For clean separation: - -- **Prod:** `/root/code/git.ourworld.tf/mycelium/prod/www_mycelium_society/` -- **Dev:** `/root/code/git.ourworld.tf/mycelium/dev/www_mycelium_society/` - -Clone and build separately for each. - ## Updating the Application To update after changes: -- 2.43.0 From ca03655256339f3639b5ad0308795690a5dc4cf1 Mon Sep 17 00:00:00 2001 From: mik-tf Date: Tue, 30 Sep 2025 09:56:52 -0400 Subject: [PATCH 4/7] docs: Add deployment guide for Mycelium Society documentation --- docs/ops/current/deployment-docs-mycelium.md | 57 +++++++++++++++++++ ...ment.md => deployment-society-mycelium.md} | 0 2 files changed, 57 insertions(+) create mode 100644 docs/ops/current/deployment-docs-mycelium.md rename docs/ops/current/{deployment.md => deployment-society-mycelium.md} (100%) diff --git a/docs/ops/current/deployment-docs-mycelium.md b/docs/ops/current/deployment-docs-mycelium.md new file mode 100644 index 0000000..5efabb4 --- /dev/null +++ b/docs/ops/current/deployment-docs-mycelium.md @@ -0,0 +1,57 @@ +# Deployment Guide for Mycelium Society Docs + +This guide provides a deployment for serving the Mycelium Society documentation at `docs.mycelium.tf` by proxying to the existing content at `https://docs.ourworld.tf/mycelium_society/docs/`. + +This allows users to access the docs via `docs.mycelium.tf` while the content is hosted elsewhere. + +## Prerequisites + +- Linux server with Caddy web server installed +- zinit service manager installed +- Root or sudo access + +## Step 1: Configure Caddy + +Update your Caddyfile to include the docs proxy: + +```bash +# Edit the Caddyfile (adjust path to your Caddyfile location) +nano /root/code/github/despiegk/env_web/ourworld/ovh1_web_current/caddy/Caddyfile +``` + +Add or update: + +``` +import mycelium_docs.caddy +``` + +Create `mycelium_docs.caddy`: + +``` +docs.mycelium.tf { + reverse_proxy https://docs.ourworld.tf/mycelium_society/docs/ { + header_up Host docs.ourworld.tf + header_up X-Forwarded-Proto https + header_up X-Real-IP {remote} + header_up X-Forwarded-Host {host} + } +} +``` + +## Step 2: Reload Caddy + +```bash +zinit restart caddy +``` + +## Monitoring + +- Check Caddy status: `zinit list` +- View logs: `zinit log caddy` +- Access at `https://docs.mycelium.tf` + +## Notes + +- Ensure DNS for `docs.mycelium.tf` points to your server. +- The content is served from `https://docs.ourworld.tf/mycelium_society/docs/`, but users see `docs.mycelium.tf`. +- No additional build or cloning required; it's a reverse proxy setup. \ No newline at end of file diff --git a/docs/ops/current/deployment.md b/docs/ops/current/deployment-society-mycelium.md similarity index 100% rename from docs/ops/current/deployment.md rename to docs/ops/current/deployment-society-mycelium.md -- 2.43.0 From f83233b927a950b11de1ef23edc2d1b3d63bbd6f Mon Sep 17 00:00:00 2001 From: mik-tf Date: Tue, 30 Sep 2025 10:12:27 -0400 Subject: [PATCH 5/7] docs: Fix Caddy config rewrite rule for Mycelium Society docs deployment --- docs/ops/current/deployment-docs-mycelium.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/ops/current/deployment-docs-mycelium.md b/docs/ops/current/deployment-docs-mycelium.md index 5efabb4..899f56d 100644 --- a/docs/ops/current/deployment-docs-mycelium.md +++ b/docs/ops/current/deployment-docs-mycelium.md @@ -29,7 +29,8 @@ Create `mycelium_docs.caddy`: ``` docs.mycelium.tf { - reverse_proxy https://docs.ourworld.tf/mycelium_society/docs/ { + rewrite * /mycelium_society/docs{uri} + reverse_proxy https://docs.ourworld.tf { header_up Host docs.ourworld.tf header_up X-Forwarded-Proto https header_up X-Real-IP {remote} -- 2.43.0 From 19552a2b554e6c4122dc0495f89ed9cd8b25520b Mon Sep 17 00:00:00 2001 From: mik-tf Date: Tue, 30 Sep 2025 13:06:12 -0400 Subject: [PATCH 6/7] docs: Update deployment guide for direct file serving instead of proxy --- docs/ops/current/deployment-docs-mycelium.md | 31 ++++++++++++-------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/docs/ops/current/deployment-docs-mycelium.md b/docs/ops/current/deployment-docs-mycelium.md index 899f56d..ba871ad 100644 --- a/docs/ops/current/deployment-docs-mycelium.md +++ b/docs/ops/current/deployment-docs-mycelium.md @@ -1,8 +1,8 @@ # Deployment Guide for Mycelium Society Docs -This guide provides a deployment for serving the Mycelium Society documentation at `docs.mycelium.tf` by proxying to the existing content at `https://docs.ourworld.tf/mycelium_society/docs/`. +This guide provides a deployment for serving the Mycelium Society documentation at `docs.mycelium.tf`. -This allows users to access the docs via `docs.mycelium.tf` while the content is hosted elsewhere. +We build the docs website with hero docusaurus then we serve directly from files. ## Prerequisites @@ -12,7 +12,7 @@ This allows users to access the docs via `docs.mycelium.tf` while the content is ## Step 1: Configure Caddy -Update your Caddyfile to include the docs proxy: +Update your Caddyfile to include the docs serving: ```bash # Edit the Caddyfile (adjust path to your Caddyfile location) @@ -29,13 +29,10 @@ Create `mycelium_docs.caddy`: ``` docs.mycelium.tf { - rewrite * /mycelium_society/docs{uri} - reverse_proxy https://docs.ourworld.tf { - header_up Host docs.ourworld.tf - header_up X-Forwarded-Proto https - header_up X-Real-IP {remote} - header_up X-Forwarded-Host {host} - } + root * /root/hero/www/info/mycelium_society + encode gzip + try_files {path} {path}/ /index.html + file_server } ``` @@ -45,6 +42,16 @@ docs.mycelium.tf { zinit restart caddy ``` +## Building and Publishing Docs + +Users can build and publish the docs using: + +```bash +hero docusaurus -path ~/code/git.ourworld.tf/tfgrid/docs_tfgrid4/ebooks/mycelium_society -d +``` + +This builds the Docusaurus site and deploys it to `/root/hero/www/info/mycelium_society`. + ## Monitoring - Check Caddy status: `zinit list` @@ -54,5 +61,5 @@ zinit restart caddy ## Notes - Ensure DNS for `docs.mycelium.tf` points to your server. -- The content is served from `https://docs.ourworld.tf/mycelium_society/docs/`, but users see `docs.mycelium.tf`. -- No additional build or cloning required; it's a reverse proxy setup. \ No newline at end of file +- The content is served directly from static files at `/root/hero/www/info/mycelium_society`. +- Build and deploy using the hero command above. \ No newline at end of file -- 2.43.0 From cc5a05c097729dd37fa06aea8d91bf607b2c882e Mon Sep 17 00:00:00 2001 From: mik-tf Date: Tue, 30 Sep 2025 13:06:27 -0400 Subject: [PATCH 7/7] docs: Update deployment command flag in Mycelium Society docs guide --- docs/ops/current/deployment-docs-mycelium.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ops/current/deployment-docs-mycelium.md b/docs/ops/current/deployment-docs-mycelium.md index ba871ad..dddb949 100644 --- a/docs/ops/current/deployment-docs-mycelium.md +++ b/docs/ops/current/deployment-docs-mycelium.md @@ -47,7 +47,7 @@ zinit restart caddy Users can build and publish the docs using: ```bash -hero docusaurus -path ~/code/git.ourworld.tf/tfgrid/docs_tfgrid4/ebooks/mycelium_society -d +hero docusaurus -path ~/code/git.ourworld.tf/tfgrid/docs_tfgrid4/ebooks/mycelium_society -dp ``` This builds the Docusaurus site and deploys it to `/root/hero/www/info/mycelium_society`. -- 2.43.0