4 Commits
Author SHA1 Message Date
Mateusz PstruchaandClaude Opus 5.5 4affa135cd Bump to 0.8.3
CI / build (push) Successful in 20s
Release / release (push) Successful in 18s
Release / deploy (push) Successful in 15s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 13:12:31 +02:00
Mateusz PstruchaandClaude Opus 5.5 f2a9e1762f Deploy tern-web on its own, calling the API on its own origin
CI / build (push) Successful in 12s
The webapp now deploys from its own release as a static-server Swarm
stack (deploy/static.yml, tern.mtps.pl on 11902) instead of driving the
server's deployment. It's built with VITE_TERN_API — the
TERN_API_URL repository variable, defaulting to
https://tern-api.mtps.pl — and sends REST calls and the live-update
socket there. Empty (development), it stays same-origin behind Vite's
proxy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 12:44:22 +02:00
Mateusz PstruchaandClaude Opus 5.5 c1a80cc7c7 Bump to 0.8.2
CI / build (push) Successful in 23s
Release / release (push) Successful in 14s
Release / deploy (push) Failing after 21s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 21:24:03 +02:00
Mateusz PstruchaandClaude Opus 5.5 77f15ed7c3 Check workflow files parse in CI
CI / build (push) Successful in 16s
Gitea rejects an unparsable workflow without running anything, which
for release.yml only surfaces when a tag is pushed. Parsing them all in
CI catches it on master first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 21:08:35 +02:00
8 changed files with 71 additions and 37 deletions

No files matched your search

+12
View File
@@ -19,6 +19,18 @@ jobs:
- name: Check out source
uses: actions/checkout@v4
# Gitea rejects a workflow file it can't parse without running
# anything, which for release.yml only shows up when a tag is pushed.
# Parsing them all here catches that on master, before tagging.
- name: Check workflow files parse
run: |
python3 - <<'PY'
import glob, yaml
for f in sorted(glob.glob(".gitea/workflows/*.yml")):
yaml.safe_load(open(f))
print("ok", f)
PY
- name: Set up Node.js
uses: actions/setup-node@v4
with:
+9 -31
View File
@@ -23,8 +23,12 @@ jobs:
- name: Type check
run: npm run check
# The API is its own origin when deployed. Overridable with the
# TERN_API_URL repository variable.
- name: Build
run: npm run build
env:
VITE_TERN_API: ${{ vars.TERN_API_URL || 'https://tern-api.mtps.pl' }}
- name: Create release archive
run: |
@@ -45,39 +49,14 @@ jobs:
tern-web-*.tgz
tern-web-*.tgz.sha256
# Deploys the release to tern.mtps.pl (kara, deploy/compose). It lives
# here rather than in tern-server because tags are pushed server-first and
# the single runner works through them in order, so by the time this runs
# both the server image and this webapp release exist. A deploy job in
# tern-server would have to wait for this repo's release while holding
# the only runner.
# Deploys the release just published to tern.mtps.pl (deploy/static on
# the swarm; see deploy/static.yml).
deploy:
needs: release
runs-on: rocky-10
steps:
# The deployment definition is versioned with the server it deploys.
- name: Check out deployment definition
- name: Check out source
uses: actions/checkout@v4
with:
repository: mtps/tern-server
ref: ${{ gitea.ref_name }}
- name: Check the server image exists
env:
IMAGE: git.app.ygg/mtps/tern-server
TAG: ${{ gitea.ref_name }}
run: |
# Fails fast with a clear message if the server release didn't
# publish this version (failed, or still running on another
# runner), instead of a deploy that can't pull its image.
VERSION="${TAG#v}"
for i in $(seq 1 20); do
docker manifest inspect "$IMAGE:$VERSION" >/dev/null 2>&1 && exit 0
echo "waiting for $IMAGE:$VERSION ($i/20)"
sleep 30
done
echo "::error::$IMAGE:$VERSION not found in the registry — did the tern-server release succeed?"
exit 1
- name: Derive version
id: version
@@ -88,10 +67,9 @@ jobs:
- name: Deploy
uses: https://git.app.ygg/ygg/actions/deploy@v2
with:
type: compose
dist-path: deploy/tern.yml
type: static
dist-path: deploy/static.yml
extra-vars: |
version=${{ steps.version.outputs.version }}
ssh-key: ${{ secrets.DEPLOY_SSH_KEY }}
known-hosts: ${{ secrets.DEPLOY_KNOWN_HOSTS }}
+32
View File
@@ -0,0 +1,32 @@
# tern-web's deployment: a Swarm stack of ygg/static-server serving this
# version's release asset, on tern.mtps.pl (deploy/static in the ygg
# management repo). Run by this repo's release workflow through
# ygg/actions/deploy; `version` arrives as an extra var (the tag without
# its v) and is templated in by Ansible.
#
# The webapp talks to tern-server at tern-api.mtps.pl, baked in at build
# time (VITE_TERN_API in the release workflow).
static_stack_name: tern-web
domain: tern.mtps.pl
cert: mtps.pl
static_service:
name: static
image: git.app.ygg/ygg/static-server:latest
environment:
GITEA_REPOSITORY_URL: https://git.app.ygg/mtps/tern-web
GITEA_RELEASE: "v{{ version }}"
GITEA_ASSET_NAME: "tern-web-{{ version }}.tgz"
SSL_CERT_FILE: /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
volumes:
- /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem:/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem:ro
ports:
- target: 8080
published: 11902
protocol: tcp
mode: ingress
replicas: 2
restart_policy:
condition: on-failure
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "tern-web",
"version": "0.8.1",
"version": "0.8.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "tern-web",
"version": "0.8.1",
"version": "0.8.3",
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^4.0.0",
"@tsconfig/svelte": "^5.0.4",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "tern-web",
"private": true,
"version": "0.8.1",
"version": "0.8.3",
"type": "module",
"scripts": {
"dev": "vite",
+8 -1
View File
@@ -4,6 +4,13 @@
const SESSION_KEY = 'tern-session-token';
/**
* Where tern-server lives, fixed at build time (VITE_TERN_API). Deployed,
* the webapp and the API are separate origins; in development it's empty
* and Vite's proxy forwards /api on the same origin.
*/
export const API_ORIGIN = (import.meta.env.VITE_TERN_API ?? '').replace(/\/+$/, '');
export function getSessionToken(): string | null {
return localStorage.getItem(SESSION_KEY);
}
@@ -18,7 +25,7 @@ export function clearSessionToken(): void {
async function request<T>(path: string, init?: RequestInit): Promise<T> {
const token = getSessionToken();
const res = await fetch(`/api${path}`, {
const res = await fetch(`${API_ORIGIN}/api${path}`, {
...init,
headers: {
'Content-Type': 'application/json',
+2 -2
View File
@@ -2,7 +2,7 @@
// polling the same event log while it isn't. Both carry the same cursor,
// so switching between them neither drops nor repeats a change.
import { getSessionToken, pollEvents, type LiveEvent } from './api';
import { API_ORIGIN, getSessionToken, pollEvents, type LiveEvent } from './api';
export type LiveStatus = 'connecting' | 'live' | 'polling';
@@ -55,7 +55,7 @@ export function startLive(handlers: LiveHandlers): () => void {
return;
}
handlers.onStatus(cursor === null ? 'connecting' : 'polling');
const url = new URL('/api/ws', location.href);
const url = new URL('/api/ws', API_ORIGIN || location.href);
url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:';
const ws = new WebSocket(url);
socket = ws;
+5
View File
@@ -1,2 +1,7 @@
/// <reference types="svelte" />
/// <reference types="vite/client" />
interface ImportMetaEnv {
/** tern-server's origin, e.g. https://tern-api.mtps.pl. Empty: same origin. */
readonly VITE_TERN_API?: string;
}