This commit is contained in:
118
docs/nodes/reward.md
Normal file
118
docs/nodes/reward.md
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
|
||||||
|
# Example Node Configurations (Q4 2025)
|
||||||
|
|
||||||
|
This document outlines example compute nodes, their specifications, estimated costs, performance profiles, and potential monthly income based on the **ThreeFold / GeoMind** model for decentralized AI, compute, and storage nodes.
|
||||||
|
|
||||||
|
Nodes are divided into **Certified** and **Non-Certified** types, each with defined hardware specs and income models.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ⚙️ Node Specifications
|
||||||
|
|
||||||
|
| **Type** | **Estimate Cost (USD)** | **CPU Cores** | **Passmark** | **MEM (GB)** | **SSD (GB)** | **AI (GB)** | **TPS** |
|
||||||
|
| --------------------------------- | ----------------------- | ------------- | ------------ | ------------ | ------------ | ----------- |
|
||||||
|
| **Non-Certified** | | | | | | | |
|
||||||
|
| 3Node Home | $500 | 16 | 22,000 | 32 | 1,000 | – | – |
|
||||||
|
| Large TFGrid Node | $2,000 | 36 | 20,000 | 512 | 4,000 | – | – |
|
||||||
|
| Large TFGrid Node 2 | $1,200 | 36 | 20,000 | 128 | 2,000 | – | – |
|
||||||
|
| **Certified (new batch Q4 2025)** | | | | | | | |
|
||||||
|
| Mini 1 | $350 | 16 | 16,000 | 32 | 1,000 | – | – |
|
||||||
|
| Mini 2 | $800 | 24 | 25,000 | 64 | 2,000 | – | – |
|
||||||
|
| Mini 3 | $1,000 | 24 | 25,000 | 128 | 4,000 | – | – |
|
||||||
|
| Mini AI 1 | $2,000 | 32 | 50,000 | 128 | 4,000 | 128 | 20 |
|
||||||
|
| Nvidia 6000 (1x) | $15,000 | 24 | 35,000 | 128 | 4,000 | 96 | 350 |
|
||||||
|
| Nvidia 6000 (2x) | $30,000 | 24 | 35,000 | 128 | 8,000 | 192 | 700 |
|
||||||
|
| Tenstorrent 8x | $30,000 | 24 | 35,000 | 128 | 8,000 | 192 | 1,000 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Node Economics
|
||||||
|
|
||||||
|
### Hardware Cost and Income Potential
|
||||||
|
|
||||||
|
| **Model** | **Max # Slices** | **HW Cost / month (5 Y)** | **Min Income / Month** | **Max Income / Month** | **Nr Slices** |
|
||||||
|
| ---------------- | ---------------- | ------------------------- | ---------------------- | ---------------------- | ------------- |
|
||||||
|
| Mini 1 | 25 | 8 | 10.92 | 126 | 7 |
|
||||||
|
| Mini 2 | 25 | 13 | 23 | 270 | 15 |
|
||||||
|
| Mini 3 | 25 | 17 | 48.36 | 558 | 25 |
|
||||||
|
| Mini AI 1 | 4 | 33 | 52 | 600 | 4 |
|
||||||
|
| Nvidia 6000 (1x) | 1 | 250 | 390 | 4,500 | 1 |
|
||||||
|
| Nvidia 6000 (2x) | 2 | 500 | 780 | 9,000 | 2 |
|
||||||
|
| Tenstorrent 8x | 2 | 500 | 780 | 9,000 | 2 |
|
||||||
|
|
||||||
|
> 💡 **Income split:**
|
||||||
|
> 80 % to hoster, 10 % burned, 10 % to ThreeFold (protocol).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Cloud Credit (CC) Pricing
|
||||||
|
|
||||||
|
| **Currency Basis** | **Value** |
|
||||||
|
| ----------------------- | -------------------------------- |
|
||||||
|
| 1 CC = 1/1000 g of gold | ≈ 0.128 USD *(as of Oct 8 2025)* |
|
||||||
|
| Equivalent | 2 TFT (TF token units) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Pricing for 1 Slice
|
||||||
|
|
||||||
|
| **Cores** | **Perf** | **Mem (GB)** | **SSD (GB)** | **TPS** | **Min Price / Month (CC)** | **Max Price / Month (CC)** | **Min Price / Hour (CC)** | **Max Price / Hour (CC)** |
|
||||||
|
| --------- | -------- | ------------ | ------------ | ------- | -------------------------- | -------------------------- | ------------------------- | ------------------------- |
|
||||||
|
| 2.3 | 3,143 | 4 | 143 | 0 | 1.2 | 12 | 0.0033 | 0.0250 |
|
||||||
|
| 1.8 | 1,000 | 25.4 | 200 | 0 | 7.6 | 76.2 | 0.0212 | 0.1588 |
|
||||||
|
| 1.8 | 1,000 | 6.2 | 100 | 0 | 1.9 | 18.6 | 0.0052 | 0.0388 |
|
||||||
|
| 2.3 | 2,286 | 4 | 143 | 0 | 1.2 | 12 | 0.0033 | 0.0250 |
|
||||||
|
| 1.6 | 1,667 | 4 | 133 | 0 | 1.2 | 12 | 0.0033 | 0.0250 |
|
||||||
|
| 1.0 | 1,000 | 5.0 | 160 | 0 | 1.5 | 14.9 | 0.0041 | 0.0310 |
|
||||||
|
| 8.0 | 12,500 | 31 | 1,000 | 5 | 10 | 100 | 0.0278 | 0.2083 |
|
||||||
|
| 24 | 35,000 | 124 | 4,000 | 350 | 300 | 3,000 | 0.8 | 6.3 |
|
||||||
|
| 12 | 17,500 | 62 | 4,000 | 350 | 300 | 3,000 | 0.8 | 6.3 |
|
||||||
|
| 12 | 17,500 | 62 | 4,000 | 1,000 | 300 | 3,000 | 0.8 | 6.3 |
|
||||||
|
|
||||||
|
> **Note:**
|
||||||
|
> These calculations assume **no CPU oversubscription** — in real deployments, users can utilize higher effective CPU capacity.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Bid Tiers (ThreeFold Willing to Set)
|
||||||
|
|
||||||
|
| **Type** | **# Nodes** | **Min Perf** | **MEM (GB)** | **GPU (GB)** | **Price / Month (CC)** |
|
||||||
|
| --------------------------- | ----------- | ------------ | ------------ | ------------ | ---------------------- |
|
||||||
|
| Std Compute Slice | 20,000 | 2,000 | 4 | 1.2 | |
|
||||||
|
| Mem Heavy Slice | 2,000 | 2,000 | 8 | 2.4 | |
|
||||||
|
| AI Slice | 2,000 | 25,000 | 124 | 50 | |
|
||||||
|
| AI Slice Big Nvidia 1x | 50 | 35,000 | 124 | 96 | 500 |
|
||||||
|
| AI Slice Big Nvidia 2x | 50 | 35,000 | 250 | 192 | 1,000 |
|
||||||
|
| AI Slice Big Tenstorrent 8x | 50 | 35,000 | 250 | 192 | 1,000 |
|
||||||
|
|
||||||
|
**Total:**
|
||||||
|
|
||||||
|
* **24,150 slices**
|
||||||
|
* **253,800 GB total memory**
|
||||||
|
* **≈ 3,965,625 CC monthly potential (≈ $507,600)**
|
||||||
|
|
||||||
|
> *Based on new AI 395+ nodes. Dedicated memory & GPU per slice (full node model).*
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Pricing Logic
|
||||||
|
|
||||||
|
* Bids can be set per **1 hour**, **1 month**, or longer durations.
|
||||||
|
* Prices adjust dynamically based on reservation length (shorter = higher price).
|
||||||
|
* Reflects **minimum reservation duration** logic from Mycelium / ThreeFold’s marketplace.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Summary Explanation
|
||||||
|
|
||||||
|
* Each **node** is a physical or certified compute machine that can be divided into **slices** — independent virtual allocations (e.g., 2 cores, 4 GB RAM, 143 GB SSD = 1 slice).
|
||||||
|
* **Certified Nodes** (Mini, AI, GPU variants) are hardware validated for stable and efficient participation in the decentralized grid.
|
||||||
|
* Each node has:
|
||||||
|
|
||||||
|
* A **capital cost** (hardware)
|
||||||
|
* A **hardware amortization** over 5 years (monthly cost)
|
||||||
|
* A potential **monthly income** based on slice sales (compute / AI / storage)
|
||||||
|
* **Hosters** receive 80 % of income, 10 % is protocol burn, 10 % to ThreeFold.
|
||||||
|
* The income range shows **minimum guaranteed** and **maximum potential** usage scenarios.
|
||||||
|
* **Cloud Credits (CC)** are the internal accounting unit pegged to gold, maintaining stability and fairness.
|
||||||
|
|
@@ -1,31 +0,0 @@
|
|||||||
# Operations Documentation
|
|
||||||
|
|
||||||
**Internal documentation for the ops team - not published to the website.**
|
|
||||||
|
|
||||||
This directory contains operational documentation for deploying and managing the TFGrid Economics site. These files are **not** part of the Docusaurus website content (which lives in `docs/`).
|
|
||||||
|
|
||||||
## Contents
|
|
||||||
|
|
||||||
- **[server-deployment.md](./server-deployment.md)** - Guide for deploying to threefold.info/economics using zinit and Caddy
|
|
||||||
|
|
||||||
## Structure
|
|
||||||
|
|
||||||
```
|
|
||||||
tfgrid-economics/
|
|
||||||
├── docs/ # Public website content (Docusaurus)
|
|
||||||
│ ├── ops/ # Public ops docs (GitHub Pages deployment)
|
|
||||||
│ └── ...
|
|
||||||
├── ops/ # Internal ops documentation (this directory)
|
|
||||||
│ └── server-deployment.md
|
|
||||||
└── ...
|
|
||||||
```
|
|
||||||
|
|
||||||
## Important Notes
|
|
||||||
|
|
||||||
- **Public website docs**: `docs/` - Content that gets published to plan.threefold.pro
|
|
||||||
- **Internal ops docs**: `ops/` - Private operational documentation for the team
|
|
||||||
- Files in this directory should **not** be referenced from the Docusaurus site
|
|
||||||
|
|
||||||
## Repository
|
|
||||||
|
|
||||||
https://git.ourworld.tf/tfgrid/tfgrid-economics
|
|
@@ -1,485 +0,0 @@
|
|||||||
# Server Deployment Guide for TFGrid Economics
|
|
||||||
|
|
||||||
Production deployment guide for hosting the TFGrid Economics documentation site at `threefold.info/economics`.
|
|
||||||
|
|
||||||
**Repository**: https://git.ourworld.tf/tfgrid/tfgrid-economics
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
- **URL**: https://threefold.info/economics/
|
|
||||||
- **Service Manager**: zinit
|
|
||||||
- **Web Server**: Caddy (reverse proxy)
|
|
||||||
- **Port**: 9997
|
|
||||||
- **Branch**: main
|
|
||||||
|
|
||||||
The repository is pre-configured with `baseUrl: '/economics/'` in `docusaurus.config.js`.
|
|
||||||
|
|
||||||
## Quick Reference
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Update site
|
|
||||||
cd /root/code/git.ourworld.tf/tfgrid/tfgrid-economics
|
|
||||||
git pull && zinit restart tfgrid-economics
|
|
||||||
|
|
||||||
# View logs
|
|
||||||
zinit log tfgrid-economics
|
|
||||||
|
|
||||||
# Check status
|
|
||||||
zinit list | grep tfgrid-economics
|
|
||||||
ss -tuln | grep 9997
|
|
||||||
```
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
- Linux server with:
|
|
||||||
- Git installed
|
|
||||||
- Node.js 18+ installed
|
|
||||||
- Caddy web server installed
|
|
||||||
- zinit service manager installed
|
|
||||||
- Root or sudo access
|
|
||||||
- SSH access to the server (e.g., `root@info.ourworld.tf`)
|
|
||||||
|
|
||||||
## Step 1: Clone the Repository
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Create directory structure
|
|
||||||
mkdir -p /root/code/git.ourworld.tf/tfgrid/
|
|
||||||
cd /root/code/git.ourworld.tf/tfgrid/
|
|
||||||
|
|
||||||
# Clone the repository
|
|
||||||
git clone https://git.ourworld.tf/tfgrid/tfgrid-economics
|
|
||||||
cd tfgrid-economics
|
|
||||||
git checkout main
|
|
||||||
```
|
|
||||||
|
|
||||||
## Step 2: Build the Site
|
|
||||||
|
|
||||||
The repository is already configured with the correct base URL (`/economics/`) in `docusaurus.config.js`.
|
|
||||||
|
|
||||||
Build the static site files:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Install dependencies
|
|
||||||
npm install
|
|
||||||
|
|
||||||
# Build the production site
|
|
||||||
npm run build
|
|
||||||
```
|
|
||||||
|
|
||||||
This creates a `build/` directory with static HTML, CSS, and JavaScript files.
|
|
||||||
|
|
||||||
## Step 3: Create a zinit Service
|
|
||||||
|
|
||||||
Create a zinit service to serve the built site:
|
|
||||||
|
|
||||||
### 3.1 Create the Service Script
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mkdir -p /etc/zinit/cmds
|
|
||||||
nano /etc/zinit/cmds/tfgrid-economics.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
Add the following content:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Load nvm (Node Version Manager)
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
|
||||||
|
|
||||||
cd /root/code/git.ourworld.tf/tfgrid/tfgrid-economics
|
|
||||||
|
|
||||||
# Pull latest changes
|
|
||||||
git checkout main
|
|
||||||
git pull
|
|
||||||
|
|
||||||
# Install dependencies and build
|
|
||||||
npm install
|
|
||||||
npm run build
|
|
||||||
|
|
||||||
# Serve the built site using a simple HTTP server
|
|
||||||
# npx serve is a lightweight static server
|
|
||||||
exec npx serve -s build -l 9997
|
|
||||||
```
|
|
||||||
|
|
||||||
**Note**: This script loads nvm before running npm commands. If you're not using nvm, replace the nvm lines with:
|
|
||||||
```bash
|
|
||||||
export PATH="/usr/local/bin:/usr/bin:/bin:$PATH"
|
|
||||||
```
|
|
||||||
|
|
||||||
Make the script executable:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
chmod +x /etc/zinit/cmds/tfgrid-economics.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3.2 Create the zinit Service Definition
|
|
||||||
|
|
||||||
```bash
|
|
||||||
nano /etc/zinit/tfgrid-economics.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
Add the following content:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
exec: "/bin/bash -c /etc/zinit/cmds/tfgrid-economics.sh"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Step 4: Configure Caddy
|
|
||||||
|
|
||||||
Navigate to your Caddy configuration directory (location may vary based on your setup).
|
|
||||||
|
|
||||||
### 4.1 Find the Existing threefold.info Configuration
|
|
||||||
|
|
||||||
First, locate which file contains the `threefold.info` domain block:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
grep -l "threefold.info" *.caddy
|
|
||||||
```
|
|
||||||
|
|
||||||
In this setup, it's in `info.caddy`.
|
|
||||||
|
|
||||||
### 4.2 Add Economics Route to Existing Configuration
|
|
||||||
|
|
||||||
Edit the file containing the `threefold.info` block:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Backup first
|
|
||||||
cp info.caddy info.caddy.backup
|
|
||||||
|
|
||||||
# Edit the file
|
|
||||||
nano info.caddy
|
|
||||||
```
|
|
||||||
|
|
||||||
Add the `handle_path` block **at the beginning** of the `threefold.info` block (before `root` and `file_server`):
|
|
||||||
|
|
||||||
```
|
|
||||||
info.ourworld.tf threefold.info info.i.threefold.me {
|
|
||||||
# TFGrid Economics - MUST come before file_server
|
|
||||||
handle_path /economics* {
|
|
||||||
reverse_proxy localhost:9997 {
|
|
||||||
header_up Host {host}
|
|
||||||
header_up X-Real-IP {remote}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Default file server for other content
|
|
||||||
root * /root/hero/www/info
|
|
||||||
encode gzip
|
|
||||||
file_server
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
**Important Notes:**
|
|
||||||
- The `handle_path` must come **before** `file_server` to take priority
|
|
||||||
- The `handle_path` directive strips `/economics` from the path before forwarding to port 9997
|
|
||||||
- Don't create a separate file with another `threefold.info` block - Caddy will try to provision SSL certs for invalid hostnames
|
|
||||||
- This approach works when `threefold.info` is already defined in an existing file
|
|
||||||
|
|
||||||
## Step 5: Start Services with zinit
|
|
||||||
|
|
||||||
Monitor and start the service:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Monitor the zinit service
|
|
||||||
zinit monitor tfgrid-economics
|
|
||||||
|
|
||||||
# Start the service
|
|
||||||
zinit start tfgrid-economics
|
|
||||||
|
|
||||||
# Restart Caddy to load new configuration
|
|
||||||
zinit restart caddy
|
|
||||||
```
|
|
||||||
|
|
||||||
## Updating the Application
|
|
||||||
|
|
||||||
To update the site after making changes:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Go to the repository directory
|
|
||||||
cd /root/code/git.ourworld.tf/tfgrid/tfgrid-economics
|
|
||||||
|
|
||||||
# Pull the latest changes
|
|
||||||
git checkout main
|
|
||||||
git pull
|
|
||||||
|
|
||||||
# Rebuild and restart
|
|
||||||
zinit restart tfgrid-economics
|
|
||||||
```
|
|
||||||
|
|
||||||
The service script will automatically rebuild the site when restarted.
|
|
||||||
|
|
||||||
## Monitoring
|
|
||||||
|
|
||||||
Check the application status:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Check if the service is running
|
|
||||||
zinit list | grep tfgrid-economics
|
|
||||||
|
|
||||||
# View application logs
|
|
||||||
zinit log tfgrid-economics
|
|
||||||
|
|
||||||
# Monitor logs in real-time
|
|
||||||
tail -f /var/log/zinit/tfgrid-economics.log
|
|
||||||
|
|
||||||
# Check port is listening
|
|
||||||
ss -tuln | grep 9997
|
|
||||||
```
|
|
||||||
|
|
||||||
## Verification
|
|
||||||
|
|
||||||
After deployment, verify the site is accessible:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Test locally on the server
|
|
||||||
curl http://localhost:9997
|
|
||||||
|
|
||||||
# Test via Caddy
|
|
||||||
curl https://threefold.info/economics/
|
|
||||||
```
|
|
||||||
|
|
||||||
Visit in your browser: **https://threefold.info/economics/**
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### Application Not Starting
|
|
||||||
|
|
||||||
Check for errors in the application logs:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
zinit log tfgrid-economics
|
|
||||||
```
|
|
||||||
|
|
||||||
### npm/npx Command Not Found
|
|
||||||
|
|
||||||
If zinit can't find npm, you need to add Node.js to the PATH in the script.
|
|
||||||
|
|
||||||
First, find where Node.js is installed:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
which node
|
|
||||||
which npm
|
|
||||||
which npx
|
|
||||||
```
|
|
||||||
|
|
||||||
Common locations:
|
|
||||||
- `/usr/local/bin/` (standard install)
|
|
||||||
- `/usr/bin/` (system package manager)
|
|
||||||
- `~/.nvm/` (nvm installation)
|
|
||||||
|
|
||||||
Then update `/etc/zinit/cmds/tfgrid-economics.sh` with the correct PATH:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# For standard installation
|
|
||||||
export PATH="/usr/local/bin:/usr/bin:/bin:$PATH"
|
|
||||||
|
|
||||||
# For nvm installation
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Build Failures
|
|
||||||
|
|
||||||
Check if Node.js and dependencies are properly installed:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd /root/code/git.ourworld.tf/tfgrid/tfgrid-economics
|
|
||||||
node --version # Should be 18+
|
|
||||||
npm install
|
|
||||||
npm run build
|
|
||||||
```
|
|
||||||
|
|
||||||
### Connection Refused
|
|
||||||
|
|
||||||
Make sure the application is running and listening on the correct port:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ss -tuln | grep 9997
|
|
||||||
```
|
|
||||||
|
|
||||||
### Port Already in Use
|
|
||||||
|
|
||||||
If port 9997 is already in use, choose a different port:
|
|
||||||
1. Update the port in `/etc/zinit/cmds/tfgrid-economics.sh`
|
|
||||||
2. Update the port in the Caddy configuration
|
|
||||||
3. Restart both services
|
|
||||||
|
|
||||||
```bash
|
|
||||||
zinit restart tfgrid-economics
|
|
||||||
zinit restart caddy
|
|
||||||
```
|
|
||||||
|
|
||||||
### Caddy Not Serving the Site
|
|
||||||
|
|
||||||
Verify Caddy configuration:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Test Caddy configuration
|
|
||||||
caddy validate --config Caddyfile
|
|
||||||
|
|
||||||
# Check Caddy logs
|
|
||||||
zinit log caddy
|
|
||||||
|
|
||||||
# Restart Caddy
|
|
||||||
zinit restart caddy
|
|
||||||
```
|
|
||||||
|
|
||||||
### Caddy SSL Certificate Errors for "handle_path"
|
|
||||||
|
|
||||||
If you see errors like `Cannot issue for "handle_path": Domain name contains an invalid character`, you've likely created a separate `.caddy` file with a domain block that should be merged into an existing file instead.
|
|
||||||
|
|
||||||
**Problem:** Creating a standalone file like:
|
|
||||||
```
|
|
||||||
threefold.info {
|
|
||||||
handle_path /economics* {
|
|
||||||
...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
When `threefold.info` is already defined elsewhere, this causes Caddy to try provisioning certs incorrectly.
|
|
||||||
|
|
||||||
**Solution:** Add the `handle_path` block to the existing file that contains the `threefold.info` domain block.
|
|
||||||
|
|
||||||
### Git Authentication Issues
|
|
||||||
|
|
||||||
If the repository requires authentication:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Configure git credentials
|
|
||||||
git config --global credential.helper store
|
|
||||||
|
|
||||||
# Or use SSH instead of HTTPS
|
|
||||||
cd /root/code/git.ourworld.tf/tfgrid/
|
|
||||||
rm -rf tfgrid-economics
|
|
||||||
git clone git@git.ourworld.tf:tfgrid/tfgrid-economics.git
|
|
||||||
cd tfgrid-economics
|
|
||||||
git checkout main
|
|
||||||
```
|
|
||||||
|
|
||||||
## Alternative: Direct Caddy File Server
|
|
||||||
|
|
||||||
Instead of using `npx serve` with zinit, you can configure Caddy to serve the static files directly.
|
|
||||||
|
|
||||||
**Edit the file containing `threefold.info` (e.g., `info.caddy`):**
|
|
||||||
|
|
||||||
```
|
|
||||||
info.ourworld.tf threefold.info info.i.threefold.me {
|
|
||||||
# TFGrid Economics - Direct file serving
|
|
||||||
handle_path /economics* {
|
|
||||||
root * /root/code/git.ourworld.tf/tfgrid/tfgrid-economics/build
|
|
||||||
try_files {path} {path}/ /index.html
|
|
||||||
encode gzip
|
|
||||||
file_server
|
|
||||||
}
|
|
||||||
|
|
||||||
# Default file server for other content
|
|
||||||
root * /root/hero/www/info
|
|
||||||
encode gzip
|
|
||||||
file_server
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
**Benefits:**
|
|
||||||
- Simpler setup (no need for `npx serve`)
|
|
||||||
- Caddy handles compression and caching efficiently
|
|
||||||
- One less service to manage
|
|
||||||
|
|
||||||
With this approach, you don't need the zinit service - just rebuild when you update:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd /root/code/git.ourworld.tf/tfgrid/tfgrid-economics
|
|
||||||
git checkout main
|
|
||||||
git pull
|
|
||||||
npm install
|
|
||||||
npm run build
|
|
||||||
# Caddy automatically serves the updated build/ directory
|
|
||||||
```
|
|
||||||
|
|
||||||
**Optional update script** (`/usr/local/bin/update-tfgrid-economics.sh`):
|
|
||||||
```bash
|
|
||||||
#!/bin/bash
|
|
||||||
cd /root/code/git.ourworld.tf/tfgrid/tfgrid-economics
|
|
||||||
git checkout main
|
|
||||||
git pull
|
|
||||||
npm install
|
|
||||||
npm run build
|
|
||||||
echo "TFGrid Economics updated successfully"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Security Considerations
|
|
||||||
|
|
||||||
### File Permissions
|
|
||||||
|
|
||||||
Ensure proper file permissions:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Set ownership
|
|
||||||
chown -R root:root /root/code/git.ourworld.tf/tfgrid/tfgrid-economics
|
|
||||||
|
|
||||||
# Set directory permissions
|
|
||||||
find /root/code/git.ourworld.tf/tfgrid/tfgrid-economics -type d -exec chmod 755 {} \;
|
|
||||||
|
|
||||||
# Set file permissions
|
|
||||||
find /root/code/git.ourworld.tf/tfgrid/tfgrid-economics -type f -exec chmod 644 {} \;
|
|
||||||
|
|
||||||
# Make zinit script executable
|
|
||||||
chmod +x /etc/zinit/cmds/tfgrid-economics.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
### HTTPS/SSL
|
|
||||||
|
|
||||||
Caddy automatically provisions SSL certificates via Let's Encrypt for your domain. Ensure:
|
|
||||||
- Your domain resolves to the server
|
|
||||||
- Ports 80 and 443 are open
|
|
||||||
- Caddy can write to its data directory
|
|
||||||
|
|
||||||
### Firewall
|
|
||||||
|
|
||||||
Ensure required ports are open:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Check firewall status
|
|
||||||
ufw status
|
|
||||||
|
|
||||||
# Open ports if needed
|
|
||||||
ufw allow 80/tcp
|
|
||||||
ufw allow 443/tcp
|
|
||||||
```
|
|
||||||
|
|
||||||
## Service Management Summary
|
|
||||||
|
|
||||||
**Commands for daily operations:**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Start service
|
|
||||||
zinit start tfgrid-economics
|
|
||||||
|
|
||||||
# Stop service
|
|
||||||
zinit stop tfgrid-economics
|
|
||||||
|
|
||||||
# Restart service (rebuilds site)
|
|
||||||
zinit restart tfgrid-economics
|
|
||||||
|
|
||||||
# Check status
|
|
||||||
zinit list | grep tfgrid-economics
|
|
||||||
|
|
||||||
# View logs
|
|
||||||
zinit log tfgrid-economics
|
|
||||||
|
|
||||||
# Monitor in real-time
|
|
||||||
zinit monitor tfgrid-economics
|
|
||||||
```
|
|
||||||
|
|
||||||
## Links
|
|
||||||
|
|
||||||
- **Repository**: https://git.ourworld.tf/tfgrid/tfgrid-economics
|
|
||||||
- **Live Site**: https://threefold.info/economics/
|
|
||||||
- **Server**: info.ourworld.tf
|
|
||||||
|
|
||||||
## Related Documentation
|
|
||||||
|
|
||||||
- For local development setup, see `README.md` in the repository
|
|
||||||
- For content updates and editing, see the repository documentation
|
|
Reference in New Issue
Block a user