{"id":51630160,"url":"https://github.com/subsquid/network-static-server","last_synced_at":"2026-07-13T06:32:49.867Z","repository":{"id":359535756,"uuid":"1185429228","full_name":"subsquid/network-static-server","owner":"subsquid","description":"A cache layer for serving assignment files (NET-237)","archived":false,"fork":false,"pushed_at":"2026-05-22T09:36:58.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-22T16:15:59.046Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/subsquid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-18T15:17:34.000Z","updated_at":"2026-05-22T09:37:02.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/subsquid/network-static-server","commit_stats":null,"previous_names":["subsquid/network-static-server"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/subsquid/network-static-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subsquid%2Fnetwork-static-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subsquid%2Fnetwork-static-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subsquid%2Fnetwork-static-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subsquid%2Fnetwork-static-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/subsquid","download_url":"https://codeload.github.com/subsquid/network-static-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subsquid%2Fnetwork-static-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35413538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-13T02:00:06.543Z","response_time":119,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-07-13T06:32:49.785Z","updated_at":"2026-07-13T06:32:49.857Z","avatar_url":"https://github.com/subsquid.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Static data server for SQD Network\n\nDownloads assignment files from S3 and re-serves them on the localhost.\nIt allows N Workers/Portals to download it over the LAN instead of N direct\ndownloads from the S3 upstream.\n\n## How it works\n\nFor each configured network the service:\n\n1. Polls the upstream `network-state-\u003cnetwork\u003e.json` every `poll-interval`.\n2. When `assignment.id` changes, downloads the file at `assignment.fb_url_v1`\n   into `\u003ccache-dir\u003e/\u003cnetwork\u003e/\u003cid\u003e.fb.1.gz` and deletes the previous file.\n3. Serves the metadata at `/network-state-\u003cnetwork\u003e.json` with `fb_url_v1`\n   rewritten to `http://\u003chost\u003e/data/\u003cnetwork\u003e/\u003cid\u003e.fb.1.gz`.\n4. Streams the cached data file at `/data/\u003cnetwork\u003e/\u003cid\u003e.fb.1.gz` via\n   `http.ServeFile`.\n\nIf a client requests metadata for a network whose data file has not finished\ndownloading yet, the request is transparently proxied to the upstream so the\nclient still gets a usable response.\n\n`GET /ready` returns 200 only once every configured network has its initial\ndata file on disk; otherwise 503. Use it as the Kubernetes readiness probe.\n\n## Building\n\nInstall Go and run\n\n```bash\ngo build\n```\n\n## Running\n\n```bash\nstatic-server --networks mainnet,tethys --cache-dir /var/cache/static-server\n```\n\nOr with docker:\n\n```bash\ndocker run -d --name static-server \\\n  -p 8080:8080 \\\n  -v static-server-cache:/tmp/cache \\\n  subsquid/network-static-server:latest \\\n  --networks mainnet,tethys\n```\n\nAll flags can also be set via environment variables:\n\n| Flag | Env | Default | Description |\n| ---- | --- | ------- | ----------- |\n| `--networks` | `NETWORKS` | *(required)* | Comma-separated network names. |\n| `--poll-interval` | `POLL_INTERVAL` | `60s` | Interval of checking for upstream updates. |\n| `--cache-dir` | `CACHE_DIR` | `/tmp/cache` | Directory for downloaded files. |\n| `--listen-addr` | `LISTEN_ADDR` | `:8080` | HTTP listen address. |\n\nA sample Docker image is built from the included `Dockerfile`. Mount a\npersistent volume at `cache-dir` to avoid re-downloading on pod restart.\n\n## Using from the Portal\n\nIn the Portal config (`portal/src/config.rs`), `assignments_url` is the **base\nURL** — the portal appends `/network-state-\u003cnetwork\u003e.json` itself. Point it at\nthe static-server's cluster-local address:\n\n```yaml\nhostname: ...\nsqd_network:\n  datasets: ...\nassignments_url: http://static-server:8080\n...\n```\n\n## Using from the Worker\n\nIn the worker, `--assignment-url` / `ASSIGNMENT_URL` is the **full URL** including\nthe file name. Set it per network:\n\n```yaml\n# mainnet\nASSIGNMENT_URL: http://static-server:8080/network-state-mainnet.json\n\n# tethys\nASSIGNMENT_URL: http://static-server:8080/network-state-tethys.json\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubsquid%2Fnetwork-static-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsubsquid%2Fnetwork-static-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubsquid%2Fnetwork-static-server/lists"}