Skip to content

Commit 316ab97

Browse files
committed
docs: update deployment URLs for Workers migration
1 parent 62a42a7 commit 316ab97

File tree

2 files changed

+86
-13
lines changed

2 files changed

+86
-13
lines changed

MIGRATION.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Pages to Workers Migration Guide
2+
3+
## Background
4+
5+
Cloudflare Pages does NOT support scheduled tasks (cron jobs). This project requires hourly syncing, so we migrated to Cloudflare Workers.
6+
7+
## Setting Up Redirects
8+
9+
To maintain backwards compatibility, configure the old Pages deployments to redirect to Workers.
10+
11+
### For Mainnet Pages Project
12+
13+
Create `_redirects` file in the Pages project root:
14+
15+
```
16+
/api/* https://validators-api-main.workers.dev/api/:splat 301
17+
/* https://validators-api-main.workers.dev/:splat 301
18+
```
19+
20+
Deploy this file to `validators-api-mainnet` Pages project.
21+
22+
### For Testnet Pages Project
23+
24+
Create `_redirects` file in the Pages project root:
25+
26+
```
27+
/api/* https://validators-api-test.workers.dev/api/:splat 301
28+
/* https://validators-api-test.workers.dev/:splat 301
29+
```
30+
31+
Deploy this file to `validators-api-testnet` Pages project.
32+
33+
### Alternative: Dashboard Configuration
34+
35+
Go to Cloudflare Dashboard → Pages → [Project] → Rules → Redirects:
36+
37+
**Mainnet:**
38+
39+
- Source: `/*` → Destination: `https://validators-api-main.workers.dev/$1` (301)
40+
41+
**Testnet:**
42+
43+
- Source: `/*` → Destination: `https://validators-api-test.workers.dev/$1` (301)
44+
45+
## Verification
46+
47+
Test redirects work:
48+
49+
```bash
50+
curl -I https://validators-api-mainnet.pages.dev/api/v1/status
51+
# Should return 301 redirect to validators-api-main.workers.dev
52+
53+
curl -I https://validators-api-testnet.pages.dev/api/v1/status
54+
# Should return 301 redirect to validators-api-test.workers.dev
55+
```
56+
57+
## Timeline
58+
59+
1. Verify Workers fully operational
60+
2. Deploy redirects to Pages projects
61+
3. Monitor for 1-2 weeks
62+
4. (Optional) Deprecate .pages.dev URLs and add custom domain

README.md

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
<h2 align="center">Dashboards</h2>
2020

2121
<p align="center">
22-
<a href="https://validators-api-mainnet.pages.dev" target="_blank">Mainnet</a>&nbsp; &nbsp; &nbsp;
23-
<a href="https://validators-api-testnet.pages.dev" target="_blank">Testnet</a>
22+
<a href="https://validators-api-main.workers.dev" target="_blank">Mainnet</a>&nbsp; &nbsp; &nbsp;
23+
<a href="https://validators-api-test.workers.dev" target="_blank">Testnet</a>
2424
</p>
2525

2626
<br />
@@ -43,7 +43,7 @@ If you operate a staking pool and want to be displayed in the Nimiq Wallet, foll
4343
3. Review the [Description Guidelines](#recommendations-for-your-validator-description).
4444
4. Learn about the [JSON Schema](#validator-json-schema).
4545
5. Submit a PR to this repository. A Nimiq team member will review your submission within 3 days.
46-
6. Once the PR is submitted, check that the [API endpoint](https://validators-api-mainnet.pages.dev/api/v1/validators) returns your information. This process may take a few minutes.
46+
6. Once the PR is submitted, check that the [API endpoint](https://validators-api-main.workers.dev/api/v1/validators) returns your information. This process may take a few minutes.
4747

4848
> [!WARNING]
4949
> Nimiq reserves the right to make minor adjustments to the content submitted by validator owners if necessary.
@@ -113,13 +113,13 @@ The VTS is displayed in the Nimiq Wallet, allowing stakers to compare validators
113113
The Validators API provides endpoints to retrieve validator information for integration with tools, dashboards, and other applications.
114114
| Endpoint | Description |
115115
| -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
116-
| [/api/v1/validators](https://validators-api-mainnet.pages.dev/api/v1/validators) | Retrieves the validator list. See [query params](./server/utils/schemas.ts#L54) |
117-
| [/api/v1/validators/:validator_address](https://validators-api-mainnet.pages.dev/api/v1/validators/NQ7700000000000000000000000000000001) | Retrieves the validator information |
118-
| [/api/v1/supply](https://validators-api-mainnet.pages.dev/api/v1/supply) | Retrieves supply status |
116+
| [/api/v1/validators](https://validators-api-main.workers.dev/api/v1/validators) | Retrieves the validator list. See [query params](./server/utils/schemas.ts#L54) |
117+
| [/api/v1/validators/:validator_address](https://validators-api-main.workers.dev/api/v1/validators/NQ7700000000000000000000000000000001) | Retrieves the validator information |
118+
| [/api/v1/supply](https://validators-api-main.workers.dev/api/v1/supply) | Retrieves supply status |
119119

120120
## Validators Dashboard
121121

122-
The Validators Dashboard is a simple Nuxt application that displays all validators along with their scores. You can access the dashboard here: https://validators-api-mainnet.pages.dev/
122+
The Validators Dashboard is a simple Nuxt application that displays all validators along with their scores. You can access the dashboard here: https://validators-api-main.workers.dev/
123123

124124
> [!TIP]
125125
> Check also the [deployment](#deployment) section to learn how to access to the `testnet` and `preview` environments.
@@ -215,13 +215,24 @@ Where `env`: `preview`, `testnet`, or `testnet-preview` (omit for mainnet produc
215215

216216
**Environments** (configured in `wrangler.json`):
217217

218-
| Environment | Dashboard URL | Trigger |
219-
| ----------------- | ------------------------------------------------------------------------------ | ------------------ |
220-
| `production` | [Validators API Mainnet](https://validators-api-mainnet.pages.dev) | Push to `main` |
221-
| `preview` | [Validators API Mainnet Preview](https://dev.validators-api-mainnet.pages.dev) | Push to any branch |
222-
| `testnet` | [Validators API Testnet](https://validators-api-testnet.pages.dev) | Push to `main` |
223-
| `testnet-preview` | [Validators API Testnet Preview](https://dev.validators-api-testnet.pages.dev) | Push to any branch |
218+
| Environment | Dashboard URL | Trigger |
219+
| ----------------- | ------------------------------------------------------------------------- | -------------------------------------- |
220+
| `production` | [Validators API Mainnet](https://validators-api-main.workers.dev) | Manual `wrangler deploy` |
221+
| `preview` | [Validators API Mainnet Preview](https://validators-api-main.workers.dev) | Manual deployment |
222+
| `testnet` | [Validators API Testnet](https://validators-api-test.workers.dev) | Manual `wrangler deploy --env testnet` |
223+
| `testnet-preview` | [Validators API Testnet Preview](https://validators-api-test.workers.dev) | Manual deployment |
224224

225225
Each environment has its own D1 database, KV cache, and R2 blob. Sync runs hourly via Cloudflare cron triggers (see `server/tasks/sync/`).
226226

227+
### Deployment Migration
228+
229+
Migrated from Cloudflare Pages to Workers for cron job support.
230+
231+
**Old URLs (redirect to Workers):**
232+
233+
- `validators-api-mainnet.pages.dev``validators-api-main.workers.dev`
234+
- `validators-api-testnet.pages.dev``validators-api-test.workers.dev`
235+
236+
Setup redirects per [MIGRATION.md](./MIGRATION.md).
237+
227238
**Write operations to `main` are restricted**, only via PR.

0 commit comments

Comments
 (0)