From 02b71862a088c7623ae18e33dd1600e4de513eab Mon Sep 17 00:00:00 2001 From: Hexadual Date: Thu, 30 Apr 2026 17:35:40 -0500 Subject: [PATCH] removed server --- .claude/settings.local.json | 7 ++ .gitea/workflows/docker.yml | 11 +- egg/Dockerfile => Dockerfile | 0 README.md | 125 +++++++++++------------ egg/egg.py => egg.py | 0 egg/requirements.txt => requirements.txt | 0 6 files changed, 70 insertions(+), 73 deletions(-) create mode 100644 .claude/settings.local.json rename egg/Dockerfile => Dockerfile (100%) rename egg/egg.py => egg.py (100%) rename egg/requirements.txt => requirements.txt (100%) diff --git a/.claude/settings.local.json b/.claude/settings.local.json new file mode 100644 index 0000000..7cb5ff9 --- /dev/null +++ b/.claude/settings.local.json @@ -0,0 +1,7 @@ +{ + "permissions": { + "allow": [ + "Bash(git push *)" + ] + } +} diff --git a/.gitea/workflows/docker.yml b/.gitea/workflows/docker.yml index 5a640a7..88a29d7 100644 --- a/.gitea/workflows/docker.yml +++ b/.gitea/workflows/docker.yml @@ -30,21 +30,12 @@ jobs: echo "${{ secrets.REGISTRY_TOKEN }}" | \ docker login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin - - name: Build & push server - run: | - docker build \ - -t ${{ env.REGISTRY }}/rocobo/gcp-dot-server:latest \ - -t ${{ env.REGISTRY }}/rocobo/gcp-dot-server:${{ github.sha }} \ - ./server - docker push ${{ env.REGISTRY }}/rocobo/gcp-dot-server:latest - docker push ${{ env.REGISTRY }}/rocobo/gcp-dot-server:${{ github.sha }} - - name: Build & push egg run: | docker build \ -t ${{ env.REGISTRY }}/rocobo/gcp-dot-egg:latest \ -t ${{ env.REGISTRY }}/rocobo/gcp-dot-egg:${{ github.sha }} \ - ./egg + . docker push ${{ env.REGISTRY }}/rocobo/gcp-dot-egg:latest docker push ${{ env.REGISTRY }}/rocobo/gcp-dot-egg:${{ github.sha }} diff --git a/egg/Dockerfile b/Dockerfile similarity index 100% rename from egg/Dockerfile rename to Dockerfile diff --git a/README.md b/README.md index a42a0a8..0415391 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ -# Global Consciousness Project — Self-Hosted +# GCP Egg -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. +Distributed client for the **Global Consciousness Project** — a self-hosted network variance tracker inspired by the [Global Consciousness Project](https://global-mind.org). + +Each "egg" container draws 200 random bits per second from the OS hardware-entropy pool and submits the count of 1-bits to a central server, which runs Stouffer Z-score analysis and displays a live colored dot. ## Architecture @@ -10,26 +11,16 @@ 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 + │ Stouffer Z network variance analysis every 60 s ▼ Website → animated dot + history chart + embeddable iframe ``` -## Quick start — run the server +The server is maintained separately. This repo contains only the egg client. -```bash -git clone -cd gcp -docker compose up -d -``` +## Run an Egg -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: +One Docker command is all it takes: ```bash docker run -d --restart unless-stopped \ @@ -38,72 +29,80 @@ docker run -d --restart unless-stopped \ 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 (0–200) to the server -- Persists its ID across restarts via `/data/egg_id` +The egg will immediately start sending one trial per second and persist its ID across restarts. -## Images (built automatically by Gitea Actions) +## Environment Variables -Every push to `main` builds and publishes both images to the Gitea container registry: +| Variable | Default | Description | +|---|---|---| +| `SERVER_URL` | `http://localhost:8000` | Server to send trials to | +| `EGG_ID` | auto-generated | Override the egg's unique identifier | -| Image | Pull command | -|-------|-------------| +The auto-generated ID is derived from a SHA-256 hash stored at `/data/egg_id` — mount a volume there to keep it stable across restarts. + +## Build from Source + +```bash +docker build -t gcp-egg . +docker run -d --restart unless-stopped \ + -e SERVER_URL=https://your-domain.com \ + -v gcp_egg_data:/data \ + gcp-egg +``` + +## Project Structure + +``` +GCP/ +├── egg.py # Egg client — all logic (~70 lines) +├── requirements.txt # requests==2.31.0 +├── Dockerfile +└── .gitea/workflows/ + └── docker.yml # CI: builds and pushes egg image on every push to main +``` + +## Published Images + +Every push to `main` builds and publishes to the Gitea container registry via Gitea Actions: + +| Image | Pull | +|---|---| +| Egg | `docker pull git.hexadual.io/rocobo/gcp-dot-egg:latest` | | 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 +## How the Analysis Works -Every 60 seconds the server analyses the past hour of data: +The server analyses the past hour of data every 60 seconds: 1. **Normalise** each trial to a Z-score: `z = (trial − 100) / √50` - (expected mean = 100, variance = 50 for Binomial(200, 0.5)) + (Binomial(200, 0.5) has mean = 100, variance = 50) +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 -2. **Stouffer Z** per second across all active eggs: `S_t = Σzᵢₜ / √N` +### Color Table -3. **Network variance**: `V = Σ S_t²` — follows χ²(T) under H₀ +| Color | Index | Meaning | +|---|---|---| +| Blue | > 95% | Significantly small variance — deep coherence | +| Cyan | 90–95% | Small variance — probable coherence | +| Green | 40–90% | Normal random behavior | +| Yellow | 10–40% | Slightly elevated variance | +| Orange | 5–10% | Strongly elevated variance | +| Red | < 5% | Significantly large variance | -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 (40–90)** → normal random behavior → **green** - -### Color table - -| Color | Index | Meaning | -|--------|-----------|---------| -| Blue | > 95% | Significantly small variance — deep coherence | -| Cyan | 90–95% | Small variance — probable coherence | -| Green | 40–90% | Normal random behavior | -| Yellow | 10–40% | Slightly elevated variance | -| Orange | 5–10% | Strongly elevated variance | -| Red | < 5% | Significantly large variance | - -## Embed the dot +## Embed the Dot ```html ``` -## API +## Server API Reference | 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 | diff --git a/egg/egg.py b/egg.py similarity index 100% rename from egg/egg.py rename to egg.py diff --git a/egg/requirements.txt b/requirements.txt similarity index 100% rename from egg/requirements.txt rename to requirements.txt