Initial commit — GCP Dot self-hosted clone
Some checks failed
Build & publish Docker images / Egg image (push) Has been cancelled
Build & publish Docker images / Server image (push) Has been cancelled

Server (FastAPI + SQLite) runs Stouffer Z network variance analysis.
Egg container uses os.urandom for hardware-entropy 200-bit trials.
Gitea Actions workflow auto-builds and publishes both Docker images.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Hexadual
2026-04-30 01:21:22 -05:00
commit ee2249c5f8
13 changed files with 1033 additions and 0 deletions

109
README.md Normal file
View File

@@ -0,0 +1,109 @@
# Global Consciousness Project — Self-Hosted
A live network-variance tracker inspired by the [Global Consciousness Project](https://global-mind.org).
Distributed "egg" containers contribute random numbers; the server runs statistical analysis and displays a colored dot.
## Architecture
```
Egg containers (anyone can run)
│ POST /api/data (one 200-bit trial per second)
Server (FastAPI + SQLite)
│ runs Stouffer Z network variance analysis every 60 s
Website → animated dot + history chart + embeddable iframe
```
## Quick start — run the server
```bash
git clone <this-repo>
cd gcp
docker compose up -d
```
The site is now at **http://localhost:8000**.
To expose it publicly, put it behind a reverse proxy (nginx, Caddy) or deploy to any VPS / cloud service.
## Contribute an egg
Anyone can run an egg — one Docker command:
```bash
docker run -d --restart unless-stopped \
-e SERVER_URL=https://your-domain.com \
-v gcp_egg_data:/data \
git.hexadual.io/rocobo/gcp-dot-egg:latest
```
The egg:
- Reads 200-bit trials from the OS hardware-entropy pool (`os.urandom`) once per second
- Sends the trial count (0200) to the server
- Persists its ID across restarts via `/data/egg_id`
## Images (built automatically by Gitea Actions)
Every push to `main` builds and publishes both images to the Gitea container registry:
| Image | Pull command |
|-------|-------------|
| Server | `docker pull git.hexadual.io/rocobo/gcp-dot-server:latest` |
| Egg | `docker pull git.hexadual.io/rocobo/gcp-dot-egg:latest` |
## How the analysis works
Every 60 seconds the server analyses the past hour of data:
1. **Normalise** each trial to a Z-score: `z = (trial 100) / √50`
(expected mean = 100, variance = 50 for Binomial(200, 0.5))
2. **Stouffer Z** per second across all active eggs: `S_t = Σzᵢₜ / √N`
3. **Network variance**: `V = Σ S_t²` — follows χ²(T) under H₀
4. **Index** = lower-tail CDF × 100:
- **High index (> 95)** → small variance → eggs are more coherent than chance → **blue**
- **Low index (< 5)** → large variance → eggs are noisier than chance → **red**
- **Middle (4090)** → normal random behavior → **green**
### Color table
| Color | Index | Meaning |
|--------|-----------|---------|
| Blue | > 95% | Significantly small variance — deep coherence |
| Cyan | 9095% | Small variance — probable coherence |
| Green | 4090% | Normal random behavior |
| Yellow | 1040% | Slightly elevated variance |
| Orange | 510% | Strongly elevated variance |
| Red | < 5% | Significantly large variance |
## Embed the dot
```html
<iframe src="https://your-domain.com/gcp.html"
height="48" width="48" scrolling="no" frameborder="0"></iframe>
```
## API
| Endpoint | Description |
|----------|-------------|
| `POST /api/data` | Submit a trial `{egg_id, timestamp, trial}` |
| `GET /api/status` | Latest analysis result |
| `GET /api/history?limit=60` | Last N analysis records |
| `GET /api/eggs` | Eggs active in the last 2 minutes |
## Environment variables
### Server
| Variable | Default | Description |
|----------|---------|-------------|
| `DB_PATH` | `/data/gcp.db` | SQLite database path |
### Egg
| Variable | Default | Description |
|----------|---------|-------------|
| `SERVER_URL` | `http://localhost:8000` | Server to send data to |
| `EGG_ID` | auto-generated | Override the egg's identifier |