main-ops #1
65
docs/ops/current/deployment-docs-mycelium.md
Normal file
65
docs/ops/current/deployment-docs-mycelium.md
Normal file
@@ -0,0 +1,65 @@
|
||||
# Deployment Guide for Mycelium Society Docs
|
||||
|
||||
This guide provides a deployment for serving the Mycelium Society documentation at `docs.mycelium.tf`.
|
||||
|
||||
We build the docs website with hero docusaurus then we serve directly from files.
|
||||
|
||||
## 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 serving:
|
||||
|
||||
```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 {
|
||||
root * /root/hero/www/info/mycelium_society
|
||||
encode gzip
|
||||
try_files {path} {path}/ /index.html
|
||||
file_server
|
||||
}
|
||||
```
|
||||
|
||||
## Step 2: Reload Caddy
|
||||
|
||||
```bash
|
||||
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 -dp
|
||||
```
|
||||
|
||||
This builds the Docusaurus site and deploys it to `/root/hero/www/info/mycelium_society`.
|
||||
|
||||
## 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 directly from static files at `/root/hero/www/info/mycelium_society`.
|
||||
- Build and deploy using the hero command above.
|
148
docs/ops/current/deployment-society-mycelium.md
Normal file
148
docs/ops/current/deployment-society-mycelium.md
Normal file
@@ -0,0 +1,148 @@
|
||||
# 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 society.mycelium.caddy
|
||||
```
|
||||
|
||||
Create `society.mycelium.caddy`:
|
||||
|
||||
```
|
||||
society.mycelium.tf {
|
||||
root * /root/code/git.ourworld.tf/mycelium/www_mycelium_society/dist
|
||||
try_files {path} {path}/ /index.html
|
||||
file_server
|
||||
}
|
||||
```
|
||||
|
||||
## Step 5: Start Services
|
||||
|
||||
```bash
|
||||
# If using zinit for build automation
|
||||
zinit monitor mycelium-society
|
||||
zinit start mycelium-society
|
||||
|
||||
# Restart Caddy to load configuration
|
||||
zinit restart caddy
|
||||
```
|
||||
|
||||
## 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)
|
Reference in New Issue
Block a user