9 Commits

Author SHA1 Message Date
billisdead 336ad5bd38 chore(values): set explicit passwords for local deployment
Helm Chart CI/CD / lint-test (push) Waiting to run
Helm Chart CI/CD / publish (push) Blocked by required conditions
Required since temporal-secret.yaml now validates via required().
Values match the credentials used at initial cluster install.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-17 08:41:56 +02:00
billisdead 92ceb76f23 fix(helm): address CodeRabbit review findings
NOTES.txt:
- Detect ingress scheme dynamically (http/https based on .Values.ingress.tls)
- Include first path in ingress URL output
- Use .Values.service.port in port-forward example instead of hardcoded 80
- Add -n {{ .Release.Namespace }} to all kubectl commands

postiz-config.yaml:
- Merge temporal enabled/external branches: external address now also emits
  TEMPORAL_NAMESPACE and TEMPORAL_TLS, not just TEMPORAL_ADDRESS

temporal-init-job.yaml:
- Use .Values.temporal.postgresql.seeds as PGHOST source (with fallback to
  bitnami sub-chart service name) so init job and runtime use the same host
- Switch to quoted heredoc (<<-'SQL') + psql --set to pass credentials as
  psql variables, preventing shell expansion from breaking on special chars

temporal-secret.yaml:
- Add required validation: temporal.postgresql.password must be set explicitly
  when temporal.enabled=true

values.yaml:
- Remove hardcoded default passwords (postgresPassword, temporal.postgresql.password)
  replaced with empty strings to avoid predictable default credentials

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-17 08:41:15 +02:00
billisdead 98231d5eaf fix(helm): skip temporal init job when reusing postgresql main user
Helm Chart CI/CD / lint-test (push) Has been cancelled
Helm Chart CI/CD / publish (push) Has been cancelled
When temporal.postgresql.user == postgresql.auth.username, the user
already exists with CREATEDB — temporalio/auto-setup handles database
creation itself. The init job only runs for a distinct dedicated user.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-16 18:38:05 +02:00
billisdead 6b0e1ff5f3 chore: ignore SQL dump files 2026-06-16 18:17:02 +02:00
billisdead b3f447d0a7 feat: merge feat/temporal-support into main
Helm Chart CI/CD / lint-test (push) Has been cancelled
Helm Chart CI/CD / publish (push) Has been cancelled
- Temporal support (temporalio/auto-setup:1.28.1, PostgreSQL-only, no ES)
- Init job creates temporal user via postgres superuser
- ~100 env/secrets vars added to cover full Postiz v2.21.8 documentation
- NOTES.txt with post-install guidance and warnings
- ROLLBACK.md with 4 rollback scenarios + branch/tag structure

Chart: v1.0.5 → v1.1.0 | appVersion: 1.3.0 → v2.21.8

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-16 18:13:59 +02:00
billisdead df80f0e46e docs: document branch structure and upstream tag reference
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-16 18:13:52 +02:00
billisdead 6738a6a8be Revert "docs: add rollback guide to official GitHub chart"
This reverts commit 104bc7a56f.
2026-06-16 18:11:13 +02:00
billisdead 104bc7a56f docs: add rollback guide to official GitHub chart
Covers 4 scenarios: normal ArgoCD rollback, Gitea outage emergency,
image rollback with/without DB restore, and rollback to a specific Gitea commit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-16 18:06:42 +02:00
billisdead c5b3c3b8a0 docs: add rollback guide to official GitHub chart
Covers 4 scenarios: normal ArgoCD rollback, Gitea outage emergency,
image rollback with/without DB restore, and rollback to a specific Gitea commit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-16 18:06:13 +02:00
7 changed files with 218 additions and 21 deletions
+1
View File
@@ -1 +1,2 @@
.DS_Store
*.sql
+194
View File
@@ -0,0 +1,194 @@
# Rollback — Retour vers la chart officielle GitHub
Ce document couvre le retour de la source ArgoCD depuis ce fork Gitea
(`homegit.gyozamancave.fr/billisdead/postiz-helmchart`) vers la chart officielle
(`github.com/gitroomhq/postiz-helmchart`).
---
## Structure des branches et référence upstream
```
Tag upstream-1.0.5 → commit 5d6a9de2 (upstream exact, immuable)
gitroomhq/postiz-helmchart, chart v1.0.5, jan 2025
main → contenu fonctionnellement identique à upstream
(source déployée par ArgoCD)
feat/temporal-support → 5d6a9de2 → Temporal + env → ROLLBACK.md
(branche de travail pour l'upgrade v2.21.8)
```
### Inspecter le delta entre upstream et notre travail
```bash
# Tout ce qui a changé par rapport à l'upstream dans la chart
git diff upstream-1.0.5 feat/temporal-support -- charts/
# Juste les fichiers modifiés (sans le contenu)
git diff --name-only upstream-1.0.5 feat/temporal-support
# Comparer main avec upstream (doit être vide sur charts/)
git diff upstream-1.0.5 main -- charts/
```
### Synchroniser le tag upstream si l'upstream GitHub évolue
```bash
# Ajouter le remote GitHub si absent
git remote add upstream https://github.com/gitroomhq/postiz-helmchart
# Récupérer le nouvel upstream
git fetch upstream
# Créer un nouveau tag pour la nouvelle version upstream
git tag -a upstream-<version> upstream/main -m "Upstream gitroomhq à <version>"
git push origin upstream-<version>
```
---
## Contexte de référence
| Paramètre | Fork Gitea (actuel) | Chart officielle (cible rollback) |
|---|---|---|
| `repoURL` | `https://homegit.gyozamancave.fr/billisdead/postiz-helmchart` | `https://github.com/gitroomhq/postiz-helmchart` |
| `targetRevision` | `main` | `HEAD` |
| `path` | `charts/postiz` | `charts/postiz` |
Les `values` inline dans l'Application ArgoCD ne changent pas.
---
## Scénario 1 — Rollback normal (ArgoCD accessible)
```bash
kubectl patch application postiz -n argocd --type='json' -p='[
{"op": "replace", "path": "/spec/source/repoURL", "value": "https://github.com/gitroomhq/postiz-helmchart"},
{"op": "replace", "path": "/spec/source/targetRevision", "value": "HEAD"}
]'
kubectl annotate application postiz -n argocd \
argocd.argoproj.io/refresh=hard --overwrite
```
Vérification :
```bash
kubectl get application postiz -n argocd \
-o jsonpath='{"sync: "}{.status.sync.status}{"\nhealth: "}{.status.health.status}{"\nrevision: "}{.status.sync.revision}{"\n"}'
```
Résultat attendu : `sync: Synced`, `health: Healthy`, revision = dernier commit GitHub.
---
## Scénario 2 — Gitea inaccessible (rollback d'urgence)
Si `homegit.gyozamancave.fr` est down et qu'ArgoCD est bloqué en erreur de fetch,
appliquer le patch de la même façon — ArgoCD re-tentera depuis GitHub immédiatement.
```bash
# Même commande que le scénario 1 — ArgoCD abandonne le fetch Gitea dès que repoURL change
kubectl patch application postiz -n argocd --type='json' -p='[
{"op": "replace", "path": "/spec/source/repoURL", "value": "https://github.com/gitroomhq/postiz-helmchart"},
{"op": "replace", "path": "/spec/source/targetRevision", "value": "HEAD"}
]'
```
Si ArgoCD lui-même ne répond plus, patcher le CRD directement via le control plane :
```bash
# Requiert un accès direct à k3s-master
KUBECONFIG=/etc/rancher/k3s/k3s.yaml kubectl patch application postiz -n argocd \
--type='json' -p='[
{"op": "replace", "path": "/spec/source/repoURL", "value": "https://github.com/gitroomhq/postiz-helmchart"},
{"op": "replace", "path": "/spec/source/targetRevision", "value": "HEAD"}
]'
```
---
## Scénario 3 — Rollback après upgrade image (ex. v2.11.2 → v2.21.8 cassé)
Le rollback de la source chart ne suffit pas si l'image Postiz a aussi été changée
**et que Prisma a migré le schéma DB**. Dans ce cas, la séquence est :
### 3a. Rollback image seule (si DB non migrée)
Éditer les values inline de l'Application ArgoCD et remettre le tag d'origine :
```yaml
image:
tag: "v2.11.2"
```
```bash
# Puis forcer le sync
kubectl annotate application postiz -n argocd \
argocd.argoproj.io/refresh=hard --overwrite
```
### 3b. Rollback image + restauration DB (si Prisma a migré)
> **Toujours faire un `pg_dump` avant tout upgrade.**
```bash
# 1. Scale down pour éviter les écritures pendant la restauration
kubectl scale deployment postiz-postiz-app --replicas=0 -n default
# 2. Identifier le pod PostgreSQL
PGPOD=$(kubectl get pod -n default -l app.kubernetes.io/name=postgresql -o jsonpath='{.items[0].metadata.name}')
# 3. Vider le schéma (le dump pg_dump sans --clean ne contient pas de DROP TABLE)
kubectl exec -n default "$PGPOD" -- bash -c \
'PGPASSWORD="<password>" psql -U postiz postiz -c \
"DROP SCHEMA public CASCADE; CREATE SCHEMA public; \
GRANT ALL ON SCHEMA public TO postiz; \
GRANT ALL ON SCHEMA public TO public;"'
# 4. Restaurer depuis le backup local
kubectl exec -i -n default "$PGPOD" -- bash -c \
'PGPASSWORD="<password>" psql -U postiz postiz' \
< /path/to/postiz-backup-YYYYMMDD.sql
# 5. Remettre le tag image v2.11.2 dans les values ArgoCD, puis scale up
kubectl scale deployment postiz-postiz-app --replicas=1 -n default
```
---
## Scénario 4 — Rollback vers un commit Gitea précis (pas GitHub)
Si le problème vient d'un commit spécifique sur le fork mais que la branche `main`
reste valide, pointer sur le SHA du dernier commit stable :
```bash
# Trouver le SHA stable (ex. avant le commit problématique)
git -C /home/billisdead/gitea-trucs/postiz-helm log --oneline main | head -10
# Patcher vers ce SHA
kubectl patch application postiz -n argocd --type='json' -p='[
{"op": "replace", "path": "/spec/source/targetRevision", "value": "<SHA>"}
]'
```
---
## Vérification post-rollback (tous scénarios)
```bash
# Source effective
kubectl get application postiz -n argocd \
-o jsonpath='{.spec.source.repoURL}{"\n"}{.spec.source.targetRevision}{"\n"}'
# État de santé
kubectl get application postiz -n argocd \
-o jsonpath='{"sync: "}{.status.sync.status}{"\nhealth: "}{.status.health.status}{"\n"}'
# Pod toujours Running sans restart
kubectl get pods -n default -l "app.kubernetes.io/name=postiz-app"
# Logs démarrage (vérifier absence d'erreur Temporal/DB/Redis)
kubectl logs -n default deployment/postiz-postiz-app --tail=30
```
+6 -6
View File
@@ -2,11 +2,11 @@ Postiz has been deployed!
Access URL:
{{- if .Values.ingress.enabled }}
https://{{ (first .Values.ingress.hosts).host }}
{{ if .Values.ingress.tls }}https{{ else }}http{{ end }}://{{ (first .Values.ingress.hosts).host }}{{ (first (first .Values.ingress.hosts).paths).path }}
{{- else if eq .Values.service.type "NodePort" }}
http://<node-ip>:{{ .Values.service.nodePort }}
{{- else }}
kubectl port-forward svc/{{ include "postiz.fullname" . }} 5000:80
kubectl port-forward svc/{{ include "postiz.fullname" . }} 5000:{{ .Values.service.port }}
http://localhost:5000
{{- end }}
@@ -14,11 +14,11 @@ Access URL:
Temporal:
Internal address : {{ include "postiz.fullname" . }}-temporal:7233
Status : kubectl get pods -l app.kubernetes.io/component=temporal
Init job logs : kubectl logs job/{{ include "postiz.fullname" . }}-temporal-init
Status : kubectl -n {{ .Release.Namespace }} get pods -l app.kubernetes.io/component=temporal
Init job logs : kubectl -n {{ .Release.Namespace }} logs job/{{ include "postiz.fullname" . }}-temporal-init
After first deploy, create Temporal search attributes:
kubectl exec deploy/{{ include "postiz.fullname" . }}-temporal -- \
kubectl -n {{ .Release.Namespace }} exec deploy/{{ include "postiz.fullname" . }}-temporal -- \
temporal operator search-attribute create \
--namespace {{ .Values.temporal.namespace | default "default" }} \
--name organizationId --type Keyword \
@@ -41,6 +41,6 @@ WARNING: replicaCount={{ .Values.replicaCount }} with STORAGE_PROVIDER=local is
Upgrade reminder:
Always back up the PostgreSQL database before upgrading Postiz:
kubectl exec -n <namespace> <postgresql-pod> -- \
kubectl exec -n {{ .Release.Namespace }} <postgresql-pod> -- \
pg_dump -U {{ .Values.postgresql.auth.username }} {{ .Values.postgresql.auth.database }} \
> postiz-backup-$(date +%Y%m%d).sql
+1 -3
View File
@@ -8,10 +8,8 @@ data:
{{- range $key, $value := .Values.env }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- if .Values.temporal.enabled }}
{{- if or .Values.temporal.enabled .Values.temporal.address }}
TEMPORAL_ADDRESS: {{ default (printf "%s-temporal:7233" (include "postiz.fullname" .)) .Values.temporal.address | quote }}
TEMPORAL_NAMESPACE: {{ .Values.temporal.namespace | default "default" | quote }}
TEMPORAL_TLS: {{ .Values.temporal.tls | toString | quote }}
{{- else if .Values.temporal.address }}
TEMPORAL_ADDRESS: {{ .Values.temporal.address | quote }}
{{- end }}
+14 -10
View File
@@ -1,5 +1,6 @@
{{- if .Values.temporal.enabled }}
{{- if .Values.postgresql.enabled }}
{{- if ne .Values.temporal.postgresql.user .Values.postgresql.auth.username }}
apiVersion: batch/v1
kind: Job
metadata:
@@ -31,7 +32,7 @@ spec:
done
env:
- name: PGHOST
value: {{ printf "%s-postgresql" .Release.Name | quote }}
value: {{ default (printf "%s-postgresql" .Release.Name) .Values.temporal.postgresql.seeds | splitList "," | first | quote }}
containers:
- name: create-temporal-user
image: postgres:16-alpine
@@ -40,23 +41,25 @@ spec:
- -c
- |
export PGPASSWORD="$POSTGRES_PASSWORD"
psql -h "$PGHOST" -U postgres <<-SQL
DO \$\$ BEGIN
IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = '$TEMPORAL_USER') THEN
psql -h "$PGHOST" -U postgres \
--set=temporal_user="$TEMPORAL_USER" \
--set=temporal_pwd="$TEMPORAL_PWD" <<-'SQL'
DO $$ BEGIN
IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = :'temporal_user') THEN
EXECUTE format(
'CREATE ROLE %I WITH LOGIN PASSWORD %L CREATEDB',
'$TEMPORAL_USER',
'$TEMPORAL_PWD'
:'temporal_user',
:'temporal_pwd'
);
RAISE NOTICE 'Role $TEMPORAL_USER created.';
RAISE NOTICE 'Role created.';
ELSE
RAISE NOTICE 'Role $TEMPORAL_USER already exists, skipping.';
RAISE NOTICE 'Role already exists, skipping.';
END IF;
END \$\$;
END $$;
SQL
env:
- name: PGHOST
value: {{ printf "%s-postgresql" .Release.Name | quote }}
value: {{ default (printf "%s-postgresql" .Release.Name) .Values.temporal.postgresql.seeds | splitList "," | first | quote }}
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
@@ -71,3 +74,4 @@ spec:
key: POSTGRES_PWD
{{- end }}
{{- end }}
{{- end }}
+1 -1
View File
@@ -7,7 +7,7 @@ metadata:
{{- include "postiz.labels" . | nindent 4 }}
type: Opaque
data:
POSTGRES_PWD: {{ .Values.temporal.postgresql.password | b64enc | quote }}
POSTGRES_PWD: {{ required "temporal.postgresql.password is required when temporal.enabled=true" .Values.temporal.postgresql.password | b64enc | quote }}
{{- if .Values.temporal.apiKey }}
TEMPORAL_API_KEY: {{ .Values.temporal.apiKey | b64enc | quote }}
{{- end }}
+1 -1
View File
@@ -67,7 +67,7 @@ postgresql:
# postgresPassword is used by the temporal init job to create the temporal user.
# Set this explicitly; if left empty, Bitnami generates a random password
# that the init job cannot retrieve.
postgresPassword: postgres-admin-password
postgresPassword: "postgres-admin-password"
service:
ports:
postgresql: 5432