Skip to content

Commit a4fd039

Browse files
authored
Merge pull request #53 from stack127labs/chore/check-handoff-file
Complete ad network directory, data reports, and refresh workflows
2 parents 26146c5 + 0c21cd1 commit a4fd039

669 files changed

Lines changed: 23605 additions & 1164 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.env.deploy.example‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ Google_Search_Console=
2929

3030
# Administrative production token, scoped to the production Supabase project.
3131
SUPABASE_ACCESS_TOKEN=
32+
33+
# Reused by ad-network runtime and homelab niche failure notifications.
34+
GITHUB_ALERT_TOKEN=
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Activate ad-network jobs runtime
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
release_sha:
6+
description: Exact deployed main commit to package (unused when pausing)
7+
required: false
8+
type: string
9+
confirm:
10+
description: Type stack127-production to authorize activation and automatic production data writes
11+
required: true
12+
type: string
13+
enabled_jobs:
14+
description: Comma-separated jobs; empty stops the existing jobs service without website or Storage checks
15+
required: false
16+
default: snapshot,platform,domain-age,ads-txt-summary,discovery,publisher-names,traffic,backup,verification,rdap-import
17+
type: string
18+
permissions:
19+
contents: read
20+
packages: write
21+
concurrency:
22+
group: stack127-production
23+
cancel-in-progress: false
24+
queue: max
25+
jobs:
26+
pause:
27+
if: inputs.enabled_jobs == ''
28+
environment: production
29+
runs-on: ubuntu-latest
30+
timeout-minutes: 15
31+
env:
32+
CONFIRM: ${{ inputs.confirm }}
33+
DOKPLOY_API_URL: ${{ vars.STACK127_DOKPLOY_API_URL }}
34+
DOKPLOY_API_KEY: ${{ secrets.DOKPLOY_API_KEY }}
35+
CF_ACCESS_CLIENT_ID: ${{ secrets.CF_ACCESS_CLIENT_ID }}
36+
CF_ACCESS_CLIENT_SECRET: ${{ secrets.CF_ACCESS_CLIENT_SECRET }}
37+
steps:
38+
- name: Require explicit confirmation
39+
run: |
40+
test "$GITHUB_REF" = refs/heads/main
41+
test "$CONFIRM" = stack127-production
42+
- uses: actions/checkout@v4
43+
- uses: actions/setup-node@v4
44+
with:
45+
node-version: 22
46+
cache: npm
47+
- run: npm ci --omit=dev --ignore-scripts
48+
- name: Verify service identity, stop containers and persist paused admissions
49+
run: node --experimental-strip-types scripts/ad-networks/deploy-runtime.mjs pause
50+
activate:
51+
if: inputs.enabled_jobs != ''
52+
environment: production
53+
runs-on: ubuntu-latest
54+
timeout-minutes: 75
55+
env:
56+
AD_NETWORKS_RUNTIME_ENVIRONMENT: production
57+
CONFIRM: ${{ inputs.confirm }}
58+
RELEASE_SHA: ${{ inputs.release_sha }}
59+
DEPLOYMENT_ID: ${{ github.run_id }}-${{ github.run_attempt }}
60+
ENABLED_JOBS: ${{ inputs.enabled_jobs }}
61+
DOKPLOY_API_URL: ${{ vars.STACK127_DOKPLOY_API_URL }}
62+
DOKPLOY_API_KEY: ${{ secrets.DOKPLOY_API_KEY }}
63+
CF_ACCESS_CLIENT_ID: ${{ secrets.CF_ACCESS_CLIENT_ID }}
64+
CF_ACCESS_CLIENT_SECRET: ${{ secrets.CF_ACCESS_CLIENT_SECRET }}
65+
DATABASE_POOLER_URL: ${{ secrets.DATABASE_POOLER_URL }}
66+
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
67+
SUPABASE_SECRET_KEY: ${{ secrets.SUPABASE_SECRET_KEY }}
68+
GITHUB_ALERT_TOKEN: ${{ secrets.AD_NETWORKS_ALERT_TOKEN }}
69+
GHCR_DOKPLOY_USERNAME: ${{ vars.GHCR_DOKPLOY_USERNAME }}
70+
GHCR_DOKPLOY_TOKEN: ${{ secrets.GHCR_DOKPLOY_TOKEN }}
71+
steps:
72+
- name: Require explicit confirmation
73+
run: |
74+
test "$GITHUB_REF" = refs/heads/main
75+
test "$CONFIRM" = stack127-production
76+
- uses: actions/checkout@v4
77+
with:
78+
ref: ${{ inputs.release_sha }}
79+
fetch-depth: 0
80+
- name: Check released main commit
81+
run: |
82+
[[ "$RELEASE_SHA" =~ ^[a-f0-9]{40}$ ]]
83+
test "$(git rev-parse HEAD)" = "$RELEASE_SHA"
84+
test "$(git rev-parse origin/main)" = "$RELEASE_SHA"
85+
- uses: actions/setup-node@v4
86+
with:
87+
node-version: 22
88+
cache: npm
89+
- run: npm ci --omit=dev --ignore-scripts
90+
- name: Read-only capacity, seed and publication preflight
91+
run: node --experimental-strip-types scripts/ad-networks/deploy-runtime.mjs preflight
92+
- uses: docker/setup-buildx-action@v3
93+
- uses: docker/login-action@v3
94+
with:
95+
registry: ghcr.io
96+
username: ${{ github.actor }}
97+
password: ${{ secrets.GITHUB_TOKEN }}
98+
- name: Build the jobs image locally on the GitHub runner
99+
uses: docker/build-push-action@v6
100+
with:
101+
context: .
102+
file: scripts/ad-networks/runtime/Dockerfile
103+
load: true
104+
push: false
105+
tags: ghcr.io/stack127labs/stack127-ad-networks:${{ inputs.release_sha }}
106+
labels: |
107+
org.opencontainers.image.revision=${{ inputs.release_sha }}
108+
org.opencontainers.image.source=https://github.com/stack127labs/stack127
109+
cache-from: type=gha,scope=ad-networks-runtime
110+
cache-to: type=gha,mode=max,scope=ad-networks-runtime
111+
- name: Smoke required executables and scheduler health before pushing
112+
run: |
113+
docker run --rm --network none --read-only --tmpfs /tmp:rw,size=128m,mode=1777 \
114+
--entrypoint node "ghcr.io/stack127labs/stack127-ad-networks:$RELEASE_SHA" \
115+
--experimental-strip-types scripts/ad-networks/runtime/smoke.mjs
116+
- name: Push the tested jobs image
117+
run: docker push "ghcr.io/stack127labs/stack127-ad-networks:$RELEASE_SHA"
118+
- name: Recheck admission, create or update Compose, deploy and wait healthy
119+
run: node --experimental-strip-types scripts/ad-networks/deploy-runtime.mjs activate

‎.github/workflows/stack127-ci.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030
cache: npm
3131
- run: npm ci
3232
- run: npm run test:core
33+
- name: Check ad-network data and report behavior
34+
run: npm run test:focused -- tests/pages/ad-networks/*.test.mjs
3335
- name: Check page publishing and recovery
3436
run: npm run test:focused -- tests/stack127/page-publishing.test.mjs tests/stack127/page-publishing-database.test.mjs tests/stack127/frontend-content-queue.test.mjs tests/stack127/frontend-static.test.mjs tests/stack127/cache-process-hosting.test.mjs
3537

‎AGENTS.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ Read `stack127_docs/quality-workflow.md`.
123123

124124
## Homelab
125125

126+
Scheduled ad-networks collectors, syncs, snapshots, and backups run on OVH. Weekly niche sorting runs on homelab. Other scheduled project automation stays on homelab.
127+
126128
- Development uses managed Supabase from `.env.local`. Do not start a local Docker Supabase stack.
127129
- `npm run dev` and `npm run start` bind to `0.0.0.0:3333`.
128130
- Long-running servers are background services, not failed commands. Start one, wait for readiness, reuse it, and stop it when finished.

‎app/(site)/(components-ui)/components-ui/[section]/page.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { notFound } from "next/navigation";
33
import { ActionsAndFormsExamples } from "../examples/actions-and-forms";
44
import { CardsExamples } from "../examples/cards";
55
import { ContentExamples } from "../examples/content";
6+
import { DataVisualsExamples } from "../examples/data-visuals";
67
import { FeedbackAndDialogsExamples } from "../examples/feedback-and-dialogs";
78
import { FileUploadsExamples } from "../examples/file-uploads";
89
import { FiltersAndSortingExamples } from "../examples/filters-and-sorting";
@@ -26,6 +27,7 @@ const examples: Record<string, ComponentType> = {
2627
"filters-and-sorting": FiltersAndSortingExamples,
2728
results: ResultsExamples,
2829
tables: TablesExamples,
30+
"data-visuals": DataVisualsExamples,
2931
cards: CardsExamples,
3032
content: ContentExamples,
3133
prose: ProseExamples,
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
"use client";
2+
3+
import { useState } from "react";
4+
import type { AdNetworkSitesResponse } from "@/lib/ad-networks-types";
5+
import { SitesTable } from "@/app/ui/ad-networks/sites-table";
6+
import { TableToolbar, ToolbarSearch, ToolbarSelect, ToolbarSwitch } from "@/app/ui/table-toolbar";
7+
8+
// Working demos for the gallery. The sites table's first page is sample data; searching or
9+
// paging asks the real development API.
10+
11+
export function ToolbarDemo() {
12+
const [hero, setHero] = useState("");
13+
const [query, setQuery] = useState("");
14+
const [sort, setSort] = useState("sites");
15+
const [niche, setNiche] = useState("");
16+
const [order, setOrder] = useState("used");
17+
return (
18+
<div style={{ display: "grid", gap: 24 }}>
19+
<div style={{ maxWidth: 760 }}>
20+
<ToolbarSearch label="Search ad networks, sites, and niches" onChange={setHero} placeholder="Network, site, or niche" size="large" value={hero} />
21+
</div>
22+
<TableToolbar label="Search and sort the example list">
23+
<ToolbarSearch label="Search sites" onChange={setQuery} placeholder="Search sites" value={query} />
24+
<ToolbarSelect label="Niche" onChange={setNiche} options={[{ value: "", label: "All" }, { value: "food", label: "Food" }, { value: "travel", label: "Travel" }, { value: "gaming", label: "Gaming" }]} value={niche} />
25+
<ToolbarSelect label="Sort" onChange={setSort} options={[{ value: "sites", label: "Most sites" }, { value: "join", label: "Easiest to join" }, { value: "niche", label: "By niche" }]} value={sort} />
26+
</TableToolbar>
27+
<ToolbarSwitch label="Order" onChange={setOrder} options={[{ value: "used", label: "Most used" }, { value: "join", label: "Easiest to join" }]} value={order} />
28+
</div>
29+
);
30+
}
31+
32+
const sample: AdNetworkSitesResponse = {
33+
page: 1,
34+
pageSize: 30,
35+
total: 3,
36+
totalPages: 1,
37+
effectiveSort: "traffic",
38+
availableColumns: ["domain", "niche", "traffic", "domain_age", "platform", "manager", "checked", "publisher"],
39+
availableSorts: ["traffic", "oldest", "newest"],
40+
availableFilters: ["niche"],
41+
filters: { niches: [], networks: [] },
42+
rows: [
43+
{ domain: "tinykitchenlab.com", publisher_name: "Tiny Kitchen Lab LLC", niche: "food", traffic_group: "top-10k", domain_created_on: "2014-03-02", platform: "WordPress", managed_by: { slug: "mediavine", name: "Mediavine" }, manager_domain: "mediavine.com", last_checked_at: "2026-10-12T08:00:00Z", favicon: null, networks: [{ slug: "mediavine", name: "Mediavine" }] },
44+
{ domain: "wanderwithmara.com", publisher_name: null, niche: "travel", traffic_group: "top-100k", domain_created_on: "2016-07-21", platform: "WordPress", managed_by: { slug: "mediavine", name: "Mediavine" }, manager_domain: "mediavine.com", last_checked_at: "2026-10-11T08:00:00Z", favicon: null, networks: [{ slug: "mediavine", name: "Mediavine" }] },
45+
{ domain: "budgetpantry.net", publisher_name: "Pantry Press Ltd", niche: "food", traffic_group: "top-1m", domain_created_on: "2012-01-10", platform: "Next.js", managed_by: null, manager_domain: null, last_checked_at: "2026-10-10T08:00:00Z", favicon: null, networks: [{ slug: "mediavine", name: "Mediavine" }] },
46+
],
47+
};
48+
49+
export function SitesTableDemo() {
50+
return (
51+
<SitesTable
52+
columns={["niche", "traffic", "age", "platform", "manager", "checked"]}
53+
defaultSort="traffic"
54+
heading="Sites using Mediavine"
55+
headingId="sites-demo"
56+
initial={sample}
57+
nicheFilter
58+
route="/components-ui/tables"
59+
scope={{ network: "mediavine" }}
60+
sorts={["traffic", "oldest", "newest"]}
61+
/>
62+
);
63+
}

‎app/(site)/(components-ui)/components-ui/examples/cards.tsx‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { ToolCard } from "@/app/ui/cards/tool-card";
88
import { DirectoryAppCard } from "@/app/ui/directories/directory-app-card";
99
import { HardwareFactCardContent, hardwareFactCardClassName } from "@/app/ui/directories/hardware-fact-card";
1010
import type { DirectoryAppCardData } from "@/lib/apps-card";
11+
import { NetworkCard, NetworkGrid, SortNote } from "@/app/ui/ad-networks/network-card";
12+
import { NetworkLogo } from "@/app/ui/ad-networks/network-logo";
1113
import { Example } from "../gallery";
1214
import styles from "../components-ui.module.css";
1315

@@ -78,6 +80,37 @@ export function CardsExamples() {
7880
</Link>
7981
</div>
8082
</Example>
83+
<Example
84+
components={["NetworkLogo", "networkLogo"]}
85+
note="An ad network's square icon on a white tile, so any icon reads in both themes. card is the 32px tile for cards and table rows; title sits in an h1 in place of the title icon. Without a logo file the tile shows the name's first letter. networkLogo(slug) finds public/ad-networks/logos/<slug>.png on the server."
86+
source="app/ui/ad-networks/network-logo.tsx, app/ui/ad-networks/network-logo-src.ts"
87+
title="Network logo"
88+
>
89+
<div style={{ alignItems: "center", display: "flex", flexWrap: "wrap", gap: 16 }}>
90+
<NetworkLogo logo={{ src: "/ad-networks/logos/mediavine.png" }} name="Mediavine" />
91+
<NetworkLogo logo={{ src: "/ad-networks/logos/raptive.png" }} name="Raptive" />
92+
<NetworkLogo logo={{ src: "/ad-networks/logos/newor-media.png" }} name="Newor Media" />
93+
<NetworkLogo logo={null} name="Sparteo" />
94+
<span style={{ font: "var(--weight-bold) var(--text-h1) / var(--line-h1) var(--font-display)", letterSpacing: "var(--tracking-display)" }}>
95+
<NetworkLogo logo={{ src: "/ad-networks/logos/mediavine.png" }} name="Mediavine" size="title" />Mediavine
96+
</span>
97+
</div>
98+
</Example>
99+
<Example
100+
components={["NetworkCard", "NetworkGrid", "SortNote"]}
101+
note="One ad network in the directory: logo, name, the confirmed-share ring, the site count, and what it takes to join. The whole card links to the network. Hover or focus the ring for its bubble; on touch screens a tap opens it. Leave join out to hide the footer. The grid goes four, three, two, then one across."
102+
source="app/ui/ad-networks/network-card.tsx, app/ui/ad-networks/confirmed-ring.tsx"
103+
title="Network card"
104+
>
105+
<SortNote>Sorted by how many <b>Food</b> sites use each network.</SortNote>
106+
<NetworkGrid>
107+
<NetworkCard confirmed={7492} href="/components-ui/cards" join="No traffic minimum" logo={{ src: "/ad-networks/logos/ezoic.png" }} name="Ezoic" sites={8144} />
108+
<NetworkCard confirmed={7459} href="/components-ui/cards" join="50,000 sessions a month" logo={{ src: "/ad-networks/logos/mediavine.png" }} name="Mediavine" sites={7852} />
109+
<NetworkCard confirmed={6437} href="/components-ui/cards" join="100,000 pageviews a month" logo={{ src: "/ad-networks/logos/raptive.png" }} name="Raptive" sites={7152} />
110+
<NetworkCard confirmed={6119} href="/components-ui/cards" join="1,000 sessions a month" logo={{ src: "/ad-networks/logos/journey-by-mediavine.png" }} name="Journey by Mediavine" sites={6953} />
111+
<NetworkCard confirmed={1} href="/components-ui/cards" logo={null} name="Publir" sites={1} />
112+
</NetworkGrid>
113+
</Example>
81114
</>
82115
);
83116
}

0 commit comments

Comments
 (0)