Skip to content

Commit cb078d6

Browse files
committed
chore: remove preview environments
1 parent ca613ee commit cb078d6

File tree

8 files changed

+44
-51
lines changed

8 files changed

+44
-51
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
jobs:
1313
ci:
1414
runs-on: ubuntu-latest
15-
environment: preview-testnet
15+
environment: testnet
1616
steps:
1717
- uses: actions/checkout@v4
1818

MIGRATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ curl -I https://validators-api-testnet.pages.dev/api/v1/status
5959
1. Verify Workers fully operational
6060
2. Deploy redirects to Pages projects
6161
3. Monitor for 1-2 weeks
62-
4. (Optional) Deprecate .pages.dev URLs and add custom domain
62+
4. (Optional) Deprecate legacy `.pages.dev` URLs and add a custom domain

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ The Validators API provides endpoints to retrieve validator information for inte
122122
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.je-cf9.workers.dev/
123123

124124
> [!TIP]
125-
> Check also the [deployment](#deployment) section to learn how to access to the `testnet` and `preview` environments.
125+
> Check also the [deployment](#deployment) section to learn how to access the `testnet` environment.
126126
127127
## How the API works
128128

@@ -209,7 +209,7 @@ Deployed via Wrangler CLI with `wrangler.json` config:
209209
pnpm build && npx wrangler --cwd .output deploy [-e env]
210210
```
211211

212-
Where `env`: `preview`, `testnet`, or `testnet-preview` (omit for mainnet production).
212+
Where `env`: `testnet` (omit `-e env` for mainnet production).
213213

214214
**Required secrets:** `ALBATROSS_RPC_NODE_URL`, `NUXT_SLACK_WEBHOOK_URL`
215215

@@ -250,15 +250,13 @@ pnpm db:apply:is-listed:testnet
250250
**Environments** (configured in `wrangler.json`):
251251

252252
- `production`: [Validators API Mainnet](https://validators-api-main.je-cf9.workers.dev) via manual `wrangler deploy`
253-
- `preview`: [Validators API Mainnet Preview](https://validators-api-main.je-cf9.workers.dev) via manual deployment
254253
- `testnet`: [Validators API Testnet](https://validators-api-test.je-cf9.workers.dev) via manual `wrangler deploy --env testnet`
255-
- `testnet-preview`: [Validators API Testnet Preview](https://validators-api-test.je-cf9.workers.dev) via manual deployment
256254

257255
Each environment has its own D1 database, KV cache, and R2 blob. Sync runs every 12 hours via Cloudflare cron triggers (see `server/tasks/sync/`).
258256

259257
### Deployment Migration
260258

261-
Migrated from Cloudflare Pages to Workers for cron job support.
259+
Migrated from Cloudflare Pages to Workers for cron job support. Pages URLs remain legacy redirects only and are not active deployment targets.
262260

263261
**Old URLs (redirect to Workers):**
264262

app/app.vue

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<script setup lang="ts">
2+
import type { EnvItemType } from './utils/environments'
3+
import { environments, getEnvironmentItem } from './utils/environments'
4+
25
const { data: status, status: statusRequest, refresh: refreshStatus, error } = await useFetch('/api/v1/status', { server: true, lazy: false })
36
47
const colorMode = useColorMode()
@@ -10,33 +13,19 @@ const isActivitySync = computed(() => Boolean(status.value?.missingEpochs?.lengt
1013
const isScoreSync = computed(() => status.value?.missingScore === false)
1114
const isSynced = computed(() => isActivitySync.value && isScoreSync.value)
1215
13-
const { gitBranch, nimiqNetwork } = useSafeRuntimeConfig().public
14-
15-
interface EnvItemType { branch: string, network: string, link: string }
16-
17-
const environments: EnvItemType[] = [
18-
{ branch: 'main', network: 'main-albatross', link: 'https://validators-api-main.je-cf9.workers.dev/' },
19-
{ branch: 'main', network: 'test-albatross', link: 'https://validators-api-test.je-cf9.workers.dev/' },
20-
{ branch: 'dev', network: 'main-albatross', link: 'https://dev.validators-api-mainnet.pages.dev/' },
21-
{ branch: 'dev', network: 'test-albatross', link: 'https://dev.validators-api-testnet.pages.dev/' },
22-
23-
]
16+
const { nimiqNetwork } = useSafeRuntimeConfig().public
2417
const [DefineEnvItem, EnvItem] = createReusableTemplate<{ item: EnvItemType, component: string }>()
2518
26-
const currentEnvItem = { branch: gitBranch, network: nimiqNetwork, link: environments.find(env => env.branch === gitBranch && env.network === nimiqNetwork)?.link || '' }
19+
const currentEnvItem = getEnvironmentItem(nimiqNetwork) ?? { network: nimiqNetwork, link: '' }
2720
</script>
2821

2922
<template>
30-
<DefineEnvItem v-slot="{ item: { branch, network, link }, component }">
31-
<component :is="component" :href="component === 'a' ? link : undefined" flex="~ col gap-2" f-px-2xs :title="`Nimiq network: ${network}.\nGit branch: ${branch}.`">
23+
<DefineEnvItem v-slot="{ item: { network, link }, component }">
24+
<component :is="component" :href="component === 'a' ? link : undefined" flex="~ col gap-2" f-px-2xs :title="`Nimiq network: ${network}.`">
3225
<div text="current f-xs" flex="~ gap-4 items-center">
3326
<div i-nimiq:globe scale-80 text-neutral-600 />
3427
<span nq-label text="9 neutral-800">{{ network }}</span>
3528
</div>
36-
<div text="current f-xs" flex="~ gap-4 items-center">
37-
<div i-tabler:git-branch text-neutral-600 />
38-
<span nq-label text="9 neutral-800">{{ branch }}</span>
39-
</div>
4029
</component>
4130
</DefineEnvItem>
4231

@@ -64,7 +53,7 @@ const currentEnvItem = { branch: gitBranch, network: nimiqNetwork, link: environ
6453
</CollapsibleContent>
6554
</CollapsibleRoot>
6655

67-
<div flex="~ items-center gap-8" f-px-2xs py-6 whitespace-nowrap :title="`Status for git+${gitBranch}@nimiq+${nimiqNetwork}`" :class="statusRequest === 'pending' ? 'bg-neutral-400' : isSynced ? 'bg-green-400' : 'bg-red-400'">
56+
<div flex="~ items-center gap-8" f-px-2xs py-6 whitespace-nowrap :title="`Status for nimiq+${nimiqNetwork}`" :class="statusRequest === 'pending' ? 'bg-neutral-400' : isSynced ? 'bg-green-400' : 'bg-red-400'">
6857
<template v-if="statusRequest === 'pending'">
6958
<div i-nimiq:spinner />
7059
Getting health

app/utils/environments.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { describe, expect, it } from 'vitest'
2+
import { environments, getEnvironmentItem } from './environments'
3+
4+
describe('environments', () => {
5+
it('only exposes mainnet and testnet worker deployments', () => {
6+
expect(environments).toEqual([
7+
{ network: 'main-albatross', link: 'https://validators-api-main.je-cf9.workers.dev/' },
8+
{ network: 'test-albatross', link: 'https://validators-api-test.je-cf9.workers.dev/' },
9+
])
10+
})
11+
12+
it('resolves the current environment by network', () => {
13+
expect(getEnvironmentItem('main-albatross')).toEqual({ network: 'main-albatross', link: 'https://validators-api-main.je-cf9.workers.dev/' })
14+
expect(getEnvironmentItem('test-albatross')).toEqual({ network: 'test-albatross', link: 'https://validators-api-test.je-cf9.workers.dev/' })
15+
expect(getEnvironmentItem('unknown-network')).toBeUndefined()
16+
})
17+
})

app/utils/environments.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export interface EnvItemType {
2+
network: string
3+
link: string
4+
}
5+
6+
export const environments: EnvItemType[] = [
7+
{ network: 'main-albatross', link: 'https://validators-api-main.je-cf9.workers.dev/' },
8+
{ network: 'test-albatross', link: 'https://validators-api-test.je-cf9.workers.dev/' },
9+
]
10+
11+
export function getEnvironmentItem(network: string) {
12+
return environments.find(env => env.network === network)
13+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"dev:packages": "nr -C packages -r dev",
1616
"build": "pnpm validators:bundle:generate && nr -r build && NODE_OPTIONS=--max-old-space-size=4096 nuxt build",
1717
"generate": "nuxt generate",
18-
"preview": "npx wrangler --cwd .output dev",
18+
"worker:dev": "npx wrangler --cwd .output dev",
1919
"postinstall": "nuxt prepare",
2020
"prepublishOnly": "nr build",
2121
"typecheck": "nuxt typecheck && nr -r typecheck",

wrangler.json

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,6 @@
1919
"kv_namespaces": [{ "binding": "CACHE", "id": "4be4d10e6d3444eca6e7c02cdbcd275f" }],
2020
"r2_buckets": [{ "binding": "BLOB", "bucket_name": "validators-api-mainnet" }],
2121
"env": {
22-
"preview": {
23-
"name": "validators-api-mainnet-preview",
24-
"main": "dist/server/index.mjs",
25-
"assets": { "directory": "dist/public" },
26-
"compatibility_flags": ["nodejs_compat"],
27-
"observability": { "enabled": true, "logs": { "enabled": true, "invocation_logs": true } },
28-
"triggers": { "crons": ["0 */12 * * *"] },
29-
"vars": { "NUXT_PUBLIC_NIMIQ_NETWORK": "main-albatross" },
30-
"d1_databases": [{ "binding": "DB", "database_id": "dd9fa8b7-f5a1-48ab-b0af-d93d1092b89a", "database_name": "validators-api-mainnet-preview" }],
31-
"kv_namespaces": [{ "binding": "CACHE", "id": "e3497d0c795d46f59473e187d4d70920" }],
32-
"r2_buckets": [{ "binding": "BLOB", "bucket_name": "validators-api-mainnet-preview" }]
33-
},
3422
"testnet": {
3523
"name": "validators-api-test",
3624
"main": "dist/server/index.mjs",
@@ -42,18 +30,6 @@
4230
"d1_databases": [{ "binding": "DB", "database_id": "de14e353-5028-4e52-a383-a9cc200d960d", "database_name": "validators-api-testnet" }],
4331
"kv_namespaces": [{ "binding": "CACHE", "id": "90c1598af92a4e72a767e6601090f014" }],
4432
"r2_buckets": [{ "binding": "BLOB", "bucket_name": "validators-api-testnet" }]
45-
},
46-
"testnet-preview": {
47-
"name": "validators-api-testnet-preview",
48-
"main": "dist/server/index.mjs",
49-
"assets": { "directory": "dist/public" },
50-
"compatibility_flags": ["nodejs_compat"],
51-
"observability": { "enabled": true, "logs": { "enabled": true, "invocation_logs": true } },
52-
"triggers": { "crons": ["0 */12 * * *"] },
53-
"vars": { "NUXT_PUBLIC_NIMIQ_NETWORK": "test-albatross" },
54-
"d1_databases": [{ "binding": "DB", "database_id": "da6931b2-6d06-4598-911b-fba1fa19efd2", "database_name": "validators-api-testnet-preview" }],
55-
"kv_namespaces": [{ "binding": "CACHE", "id": "9ef2ab4420a04df8b5d82825f79620e1" }],
56-
"r2_buckets": [{ "binding": "BLOB", "bucket_name": "validators-api-testnet-preview" }]
5733
}
5834
}
5935
}

0 commit comments

Comments
 (0)