Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85aa3fc5b1 | ||
|
|
19e5badc07 | ||
|
|
cf4d419e52 | ||
|
|
d63cdf737a |
@@ -24,3 +24,7 @@ TAG=latest
|
||||
# worker-ai: analyses and answers written at the same time.
|
||||
# QUICK_CONCURRENCY=2 # summaries and answers
|
||||
# ANALYSIS_CONCURRENCY=4 # detailed analyses and forecasts
|
||||
|
||||
# Beszel monitoring agent (deploy/README.md): the hub's public key.
|
||||
# COMPOSE_PROFILES=monitoring
|
||||
# BESZEL_KEY=ssh-ed25519 AAAA...
|
||||
|
||||
+2
-1
@@ -87,5 +87,6 @@ A Google OAuth kliensnél a `https://sorsfonalak.hu` címet fel kell venni az en
|
||||
- Deploy és futó feladatok: leállításkor a worker nem vesz fel újat, a futókat befejezi (`SHUTDOWN_DRAIN_SECS`: `worker` 40 s, `worker-ai` 270 s, `stop_grace_period` 1, illetve 5 perc); ami addig nem készül el, visszakerül a sorba, a próbálkozás nem számít. Ha éppen elemzés készül, a deploy ennyivel tovább tarthat.
|
||||
- A worker két konténerben fut, ugyanabból az image-ből: a `worker` küldi az e-maileket és takarít (`WORKER_TASKS=email,cleanup`, ide kerülnek a további háttérfeladatok is), a `worker-ai` írja az elemzéseket és a válaszokat (`WORKER_TASKS=analyses`, gyors és lassú sáv). A sávok mérete a szerver `.env` fájljában állítható (`QUICK_CONCURRENCY`, `ANALYSIS_CONCURRENCY`).
|
||||
- Visszaállás korábbi verzióra: `.env`-ben `TAG=<régebbi hash>`, utána `docker compose up -d`
|
||||
- Mentés: naponta egy `pg_dump` a `/opt/sorsfonalak/backups` mappába, 14 napig megmarad. A mentéseket érdemes a szerverről is elvinni (DigitalOcean backup, vagy `rsync` otthonra).
|
||||
- Mentés: naponta egy `pg_dump` a `/opt/sorsfonalak/backups` mappába, 14 napig megmarad. Az otthoni TrueNAS naponta lehúzza (Rsync Task, Pull, SSH) a `nasbackup` felhasználóval, aki csak ezt a mappát olvashatja (`authorized_keys`: `command="/usr/bin/rrsync -ro /opt/sorsfonalak/backups",restrict`); a NAS-on a régi mentések is megmaradnak.
|
||||
- Monitorozás: a `beszel-agent` (Beszel, CPU/memória/lemez/konténerek) a NAS-on futó Beszel hubnak ad adatot, Tailscale-en át. Csak a szerver Tailscale-címén figyel (`100.69.226.118:45876`), az internet felé nem nyit portot; a hub kapcsolódik hozzá. Bekapcsolás a `.env`-ben: `COMPOSE_PROFILES=monitoring` és `BESZEL_KEY=<a hub nyilvános kulcsa>`, utána `docker compose up -d beszel-agent`. A hubban a rendszer címe `100.69.226.118`, port `45876`.
|
||||
- Visszatöltés: `gunzip -c backups/sorsfonalak-<dátum>.sql.gz | docker compose exec -T postgres psql -U sorsfonalak sorsfonalak`
|
||||
|
||||
@@ -196,9 +196,27 @@ services:
|
||||
logging: *logging
|
||||
restart: unless-stopped
|
||||
|
||||
# Beszel agent: CPU, memory, disk, network and per-container stats for the
|
||||
# Beszel hub on the home NAS. Off unless COMPOSE_PROFILES=monitoring and
|
||||
# BESZEL_KEY (the hub's public key) are in .env. It listens only on the
|
||||
# server's Tailscale address, so nothing is opened to the internet.
|
||||
beszel-agent:
|
||||
image: henrygd/beszel-agent:0.21.2
|
||||
profiles: [monitoring]
|
||||
network_mode: host
|
||||
environment:
|
||||
KEY: ${BESZEL_KEY:-}
|
||||
LISTEN: ${BESZEL_LISTEN:-100.69.226.118:45876}
|
||||
volumes:
|
||||
- beszel-agent:/var/lib/beszel-agent
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
logging: *logging
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
# Backend and worker logs (backend.YYYY-MM-DD.log, worker…, worker-ai…).
|
||||
logs:
|
||||
caddy-data:
|
||||
caddy-config:
|
||||
beszel-agent:
|
||||
|
||||
@@ -1104,3 +1104,13 @@ span.tarot-fan-card { cursor: default; }
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.tarot-flip-inner, .tarot-fan-card, .tarot-demo-text { transition: none; animation: none; }
|
||||
}
|
||||
|
||||
/* Birth date and time: our own Hungarian fields (not the browser's date and time inputs) */
|
||||
.birth-fields { border: 0; margin: 0; padding: 0; min-width: 0; }
|
||||
.birth-fields legend { padding: 0; margin-bottom: 8px; }
|
||||
.birth-row { display: flex; align-items: center; gap: 8px; }
|
||||
.birth-year { width: 5.5em; flex: none; }
|
||||
.birth-month { flex: 1 1 auto; min-width: 0; }
|
||||
.birth-day { width: 5.2em; flex: none; }
|
||||
.birth-time { width: 4.4em; flex: none; text-align: center; }
|
||||
.birth-colon { color: var(--muted); font-weight: 600; }
|
||||
|
||||
@@ -16,6 +16,41 @@ const ERRORS: Record<string, string> = {
|
||||
invalid_date: "Érvénytelen dátum.",
|
||||
};
|
||||
|
||||
const MONTHS = [
|
||||
"január",
|
||||
"február",
|
||||
"március",
|
||||
"április",
|
||||
"május",
|
||||
"június",
|
||||
"július",
|
||||
"augusztus",
|
||||
"szeptember",
|
||||
"október",
|
||||
"november",
|
||||
"december",
|
||||
];
|
||||
|
||||
const pad = (n: number) => String(n).padStart(2, "0");
|
||||
const daysIn = (year: number, month: number) => new Date(Date.UTC(year || 2000, month, 0)).getUTCDate();
|
||||
|
||||
/** "YYYY-MM-DD" from the three fields, or null while it is not a real date. */
|
||||
function composeDate(year: string, month: string, day: string): string | null {
|
||||
const y = Number(year);
|
||||
const m = Number(month);
|
||||
const d = Number(day);
|
||||
if (!/^\d{4}$/.test(year) || y < 1000 || !m || !d || d > daysIn(y, m)) return null;
|
||||
return `${year}-${pad(m)}-${pad(d)}`;
|
||||
}
|
||||
|
||||
/** "HH:MM" from the two fields, or null while it is not a real time. */
|
||||
function composeTime(hour: string, minute: string): string | null {
|
||||
if (!/^\d{1,2}$/.test(hour) || !/^\d{1,2}$/.test(minute)) return null;
|
||||
const h = Number(hour);
|
||||
const m = Number(minute);
|
||||
return h <= 23 && m <= 59 ? `${pad(h)}:${pad(m)}` : null;
|
||||
}
|
||||
|
||||
/** Someone else's chart: added with a name, or (with `chartId`) corrected. */
|
||||
export type PersonTarget = { chartId?: string; name?: string };
|
||||
|
||||
@@ -32,8 +67,16 @@ export function BirthForm({
|
||||
onSaved: (chartId: string) => void;
|
||||
}) {
|
||||
const [name, setName] = useState(person?.name ?? "");
|
||||
const [date, setDate] = useState(initial?.date ?? "");
|
||||
const [time, setTime] = useState(initial?.time?.slice(0, 5) ?? "");
|
||||
// Our own fields, not the browser's date and time inputs: those follow the
|
||||
// operating system's or the browser's region (US order, AM/PM in Safari).
|
||||
const [year, setYear] = useState(initial?.date?.slice(0, 4) ?? "");
|
||||
const [month, setMonth] = useState(initial?.date ? String(Number(initial.date.slice(5, 7))) : "");
|
||||
const [day, setDay] = useState(initial?.date ? String(Number(initial.date.slice(8, 10))) : "");
|
||||
const [hour, setHour] = useState(initial?.time?.slice(0, 2) ?? "");
|
||||
const [minute, setMinute] = useState(initial?.time?.slice(3, 5) ?? "");
|
||||
const minuteRef = useRef<HTMLInputElement>(null);
|
||||
const date = composeDate(year, month, day) ?? "";
|
||||
const time = composeTime(hour, minute) ?? "";
|
||||
const [timeUnknown, setTimeUnknown] = useState(initial ? !initial.time : false);
|
||||
const [country, setCountry] = useState(initial?.country ?? "HU");
|
||||
const [place, setPlace] = useState<Place | null>(
|
||||
@@ -57,8 +100,11 @@ export function BirthForm({
|
||||
e.preventDefault();
|
||||
setError(null);
|
||||
if (person && !name.trim()) return setError("Add meg a nevét.");
|
||||
if (!date) return setError("Add meg a születési dátumot.");
|
||||
if (!timeUnknown && !time) return setError("Add meg a születési időt, vagy jelöld, hogy nem tudod.");
|
||||
if (!year && !month && !day) return setError("Add meg a születési dátumot.");
|
||||
if (!date) return setError("Ellenőrizd a dátumot: az év négy számjegy, és a nap legyen az adott hónapban.");
|
||||
if (date > today) return setError("A születési dátum nem lehet a jövőben.");
|
||||
if (!timeUnknown && !hour && !minute) return setError("Add meg a születési időt, vagy jelöld, hogy nem tudod.");
|
||||
if (!timeUnknown && !time) return setError("Ellenőrizd az időt: óra 0–23, perc 0–59.");
|
||||
if (!place) return setError("Válaszd ki a születési helyet a listából.");
|
||||
setBusy(true);
|
||||
try {
|
||||
@@ -120,37 +166,106 @@ export function BirthForm({
|
||||
</div>
|
||||
)}
|
||||
<div className="grid-2">
|
||||
<div className="field">
|
||||
<label htmlFor="birth-date">Születési dátum</label>
|
||||
<fieldset className="field birth-fields">
|
||||
<legend className="label">Születési dátum</legend>
|
||||
<div className="birth-row">
|
||||
<label className="sr-only" htmlFor="birth-year">
|
||||
Év
|
||||
</label>
|
||||
<input
|
||||
id="birth-date"
|
||||
type="date"
|
||||
className="inp"
|
||||
min="1000-01-01"
|
||||
max={today}
|
||||
value={date}
|
||||
onChange={(e) => setDate(e.target.value)}
|
||||
required
|
||||
id="birth-year"
|
||||
className="inp birth-year"
|
||||
inputMode="numeric"
|
||||
autoComplete="bday-year"
|
||||
placeholder="év"
|
||||
maxLength={4}
|
||||
value={year}
|
||||
onChange={(e) => setYear(e.target.value.replace(/\D/g, ""))}
|
||||
/>
|
||||
<label className="sr-only" htmlFor="birth-month">
|
||||
Hónap
|
||||
</label>
|
||||
<select
|
||||
id="birth-month"
|
||||
className="inp birth-month"
|
||||
autoComplete="bday-month"
|
||||
value={month}
|
||||
onChange={(e) => setMonth(e.target.value)}
|
||||
>
|
||||
<option value="">hónap</option>
|
||||
{MONTHS.map((m, i) => (
|
||||
<option key={m} value={i + 1}>
|
||||
{m}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<label className="sr-only" htmlFor="birth-day">
|
||||
Nap
|
||||
</label>
|
||||
<select
|
||||
id="birth-day"
|
||||
className="inp birth-day"
|
||||
autoComplete="bday-day"
|
||||
value={day}
|
||||
onChange={(e) => setDay(e.target.value)}
|
||||
>
|
||||
<option value="">nap</option>
|
||||
{Array.from({ length: month ? daysIn(Number(year), Number(month)) : 31 }, (_, i) => (
|
||||
<option key={i + 1} value={i + 1}>
|
||||
{i + 1}.
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<div className="field">
|
||||
<label htmlFor="birth-time">Születési idő (helyi idő)</label>
|
||||
</fieldset>
|
||||
<fieldset className="field birth-fields">
|
||||
<legend className="label">Születési idő (helyi idő)</legend>
|
||||
<div className="birth-row">
|
||||
<label className="sr-only" htmlFor="birth-hour">
|
||||
Óra
|
||||
</label>
|
||||
<input
|
||||
id="birth-time"
|
||||
type="time"
|
||||
className="inp"
|
||||
value={timeUnknown ? "" : time}
|
||||
id="birth-hour"
|
||||
className="inp birth-time"
|
||||
inputMode="numeric"
|
||||
placeholder="óra"
|
||||
maxLength={2}
|
||||
value={timeUnknown ? "" : hour}
|
||||
disabled={timeUnknown}
|
||||
onChange={(e) => {
|
||||
setTime(e.target.value);
|
||||
const v = e.target.value.replace(/\D/g, "");
|
||||
setHour(v);
|
||||
setAmbiguous(false);
|
||||
// Two digits (or one that cannot start a valid hour): on to the minutes.
|
||||
if (v.length === 2 || (v.length === 1 && Number(v) > 2)) minuteRef.current?.focus();
|
||||
}}
|
||||
/>
|
||||
<span className="birth-colon" aria-hidden="true">
|
||||
:
|
||||
</span>
|
||||
<label className="sr-only" htmlFor="birth-minute">
|
||||
Perc
|
||||
</label>
|
||||
<input
|
||||
id="birth-minute"
|
||||
ref={minuteRef}
|
||||
className="inp birth-time"
|
||||
inputMode="numeric"
|
||||
placeholder="perc"
|
||||
maxLength={2}
|
||||
value={timeUnknown ? "" : minute}
|
||||
disabled={timeUnknown}
|
||||
onChange={(e) => {
|
||||
setMinute(e.target.value.replace(/\D/g, ""));
|
||||
setAmbiguous(false);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<label className="check">
|
||||
<input type="checkbox" checked={timeUnknown} onChange={(e) => setTimeUnknown(e.target.checked)} />
|
||||
Nem tudom a születési időt
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div className="grid-2">
|
||||
|
||||
Reference in New Issue
Block a user