Compare commits
8 Commits
feature/pp
...
feat/forte
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94c7924e65 | ||
|
|
dd9819bdbe | ||
|
|
178bf8cc78 | ||
|
|
47d1f1ec39 | ||
|
|
69848e42f0 | ||
|
|
416615a9e0 | ||
|
|
3ce93017f9 | ||
| 0582cd9917 |
@@ -1,40 +0,0 @@
|
|||||||
apiVersion: kyverno.io/v1
|
|
||||||
kind: ClusterPolicy
|
|
||||||
metadata:
|
|
||||||
name: require-labels
|
|
||||||
annotations:
|
|
||||||
policies.kyverno.io/title: Require Labels
|
|
||||||
policies.kyverno.io/category: Best Practices
|
|
||||||
policies.kyverno.io/minversion: 1.6.0
|
|
||||||
policies.kyverno.io/severity: medium
|
|
||||||
policies.kyverno.io/subject: Pod, Label
|
|
||||||
policies.kyverno.io/description: Define and use labels that identify semantic attributes of your application or Deployment. A common set of labels allows tools to work collaboratively, describing objects in a common manner that all tools can understand. The recommended labels describe applications in a way that can be queried. This policy validates that the label `app.kubernetes.io/name` is specified with some value.
|
|
||||||
spec:
|
|
||||||
validationFailureAction: Audit
|
|
||||||
background: true
|
|
||||||
rules:
|
|
||||||
- name: check-for-labels
|
|
||||||
skipBackgroundRequests: true
|
|
||||||
exclude:
|
|
||||||
any:
|
|
||||||
- resources:
|
|
||||||
namespaces:
|
|
||||||
- kube-system
|
|
||||||
- istio-system
|
|
||||||
- argocd
|
|
||||||
- cert-manager
|
|
||||||
- monitoring
|
|
||||||
- secrets
|
|
||||||
- kyverno
|
|
||||||
match:
|
|
||||||
any:
|
|
||||||
- resources:
|
|
||||||
kinds:
|
|
||||||
- Pod
|
|
||||||
validate:
|
|
||||||
message: The label `app.kubernetes.io/name` is required.
|
|
||||||
allowExistingViolations: true
|
|
||||||
pattern:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app.kubernetes.io/name: "?*"
|
|
||||||
143
infra/overlays/upc-dev/forte-drop-postgresql/RESTORE.md
Normal file
143
infra/overlays/upc-dev/forte-drop-postgresql/RESTORE.md
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
# forte-drop Postgres — backup & restore runbook
|
||||||
|
|
||||||
|
## What gets backed up
|
||||||
|
|
||||||
|
A CronJob (`forte-drop-pg-backup`, namespace `forte-drop`) runs nightly at **02:00 UTC**:
|
||||||
|
|
||||||
|
1. `pg_dump` of the `drops` database → gzip.
|
||||||
|
2. Upload to **UpCloud Managed Object Storage**: `s3://drops/_pgbackups/forte-drop-<TS>.sql.gz`
|
||||||
|
(the `_pgbackups/` prefix is collision-proof: app slugs match `/^[a-z0-9][a-z0-9-]{0,62}$/`
|
||||||
|
and can never start with `_`).
|
||||||
|
3. Retention: dumps older than **30 days** are pruned.
|
||||||
|
|
||||||
|
S3 creds come from the `forte-drop-secrets` Secret (`S3_ENDPOINT` / `S3_KEY` / `S3_SECRET`).
|
||||||
|
Postgres creds from `forte-drop-pg-creds` (`pgusername` / `pgpassword`).
|
||||||
|
|
||||||
|
> **Object storage is the durable tier.** App data + DB backups both live in UpCloud
|
||||||
|
> Managed Object Storage (replicated by UpCloud). The in-cluster Postgres PVC is the
|
||||||
|
> live working copy; the nightly dump is the recovery point. The PVC carries
|
||||||
|
> `Prune=false,Delete=false` so ArgoCD never deletes it.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export KUBECONFIG=~/Downloads/dev-fd-no-svg1_kubeconfig.yaml
|
||||||
|
# Confirm the namespace + DB pod are up:
|
||||||
|
kubectl -n forte-drop get pods -l app.kubernetes.io/name=postgresql
|
||||||
|
```
|
||||||
|
|
||||||
|
## List available backups
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run an ephemeral mc pod with the app's S3 creds:
|
||||||
|
kubectl -n forte-drop run mc-list --rm -it --restart=Never \
|
||||||
|
--image=quay.io/minio/mc:RELEASE.2024-11-21T17-21-54Z \
|
||||||
|
--overrides='{"spec":{"containers":[{"name":"mc","image":"quay.io/minio/mc:RELEASE.2024-11-21T17-21-54Z","command":["sh","-c","mc alias set obj \"$S3_ENDPOINT\" \"$S3_KEY\" \"$S3_SECRET\" >/dev/null && mc ls obj/drops/_pgbackups/"],"envFrom":[{"secretRef":{"name":"forte-drop-secrets"}}]}]}}'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Manually trigger a backup (before risky changes)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl -n forte-drop create job --from=cronjob/forte-drop-pg-backup pg-backup-manual-$(date +%s)
|
||||||
|
# Watch:
|
||||||
|
kubectl -n forte-drop get jobs -l app.kubernetes.io/component=backup
|
||||||
|
kubectl -n forte-drop logs -l app.kubernetes.io/component=backup --tail=40
|
||||||
|
```
|
||||||
|
|
||||||
|
## Restore a dump
|
||||||
|
|
||||||
|
> **Destructive.** This overwrites the live `drops` database. Take a fresh manual
|
||||||
|
> backup first (above) and confirm with whoever owns the data before proceeding.
|
||||||
|
|
||||||
|
### 1. Pick the dump to restore
|
||||||
|
|
||||||
|
List backups (above), choose `forte-drop-<TS>.sql.gz`.
|
||||||
|
|
||||||
|
### 2. Run a restore pod that pulls the dump and pipes it into Postgres
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DUMP="forte-drop-20260530T020000Z.sql.gz" # <-- set to the chosen file
|
||||||
|
|
||||||
|
kubectl -n forte-drop run pg-restore --rm -it --restart=Never \
|
||||||
|
--image=postgres:16-alpine \
|
||||||
|
--overrides='{
|
||||||
|
"spec": {
|
||||||
|
"containers": [{
|
||||||
|
"name": "restore",
|
||||||
|
"image": "postgres:16-alpine",
|
||||||
|
"command": ["sh","-c","set -euo pipefail; \
|
||||||
|
apk add --no-cache curl >/dev/null; \
|
||||||
|
# download via mc is simpler — use a 2-step instead (see note). \
|
||||||
|
echo placeholder"],
|
||||||
|
"envFrom": [
|
||||||
|
{"secretRef":{"name":"forte-drop-pg-creds"}},
|
||||||
|
{"secretRef":{"name":"forte-drop-secrets"}}
|
||||||
|
]
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
```
|
||||||
|
|
||||||
|
**Simpler 2-pod approach (recommended — avoids cramming mc + psql in one image):**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DUMP="forte-drop-20260530T020000Z.sql.gz"
|
||||||
|
|
||||||
|
# (a) Download the dump from object storage to a local file:
|
||||||
|
kubectl -n forte-drop run mc-get --rm -it --restart=Never \
|
||||||
|
--image=quay.io/minio/mc:RELEASE.2024-11-21T17-21-54Z \
|
||||||
|
--overrides='{"spec":{"containers":[{"name":"mc","image":"quay.io/minio/mc:RELEASE.2024-11-21T17-21-54Z","command":["sh","-c","mc alias set obj \"$S3_ENDPOINT\" \"$S3_KEY\" \"$S3_SECRET\" >/dev/null && mc cat obj/drops/_pgbackups/'"$DUMP"'"],"envFrom":[{"secretRef":{"name":"forte-drop-secrets"}}]}]}}' \
|
||||||
|
> /tmp/$DUMP
|
||||||
|
|
||||||
|
# (b) Pipe it into the live Postgres via the service:
|
||||||
|
gunzip -c /tmp/$DUMP | kubectl -n forte-drop run pg-restore --rm -i --restart=Never \
|
||||||
|
--image=postgres:16-alpine \
|
||||||
|
--overrides='{"spec":{"containers":[{"name":"psql","image":"postgres:16-alpine","stdin":true,"command":["sh","-c","PGPASSWORD=\"$pgpassword\" psql -h forte-drop-postgresql.forte-drop.svc -U \"$pgusername\" -d drops"],"env":[{"name":"pgusername","valueFrom":{"secretKeyRef":{"name":"forte-drop-pg-creds","key":"pgusername"}}},{"name":"pgpassword","valueFrom":{"secretKeyRef":{"name":"forte-drop-pg-creds","key":"pgpassword"}}}]}]}}'
|
||||||
|
```
|
||||||
|
|
||||||
|
> The app's schema is created idempotently on boot (`CREATE TABLE IF NOT EXISTS` +
|
||||||
|
> `ALTER TABLE ... ADD COLUMN IF NOT EXISTS` in `src/repo/pg.ts`), and `pg_dump`
|
||||||
|
> output includes the data. For a clean restore into a fresh DB this just works.
|
||||||
|
> To restore over an existing DB with conflicting rows, drop/recreate the `drops`
|
||||||
|
> database first (coordinate downtime — scale the web Deployment to 0 during the
|
||||||
|
> restore so the app isn't writing).
|
||||||
|
|
||||||
|
### 3. Verify
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl -n forte-drop run pg-check --rm -it --restart=Never \
|
||||||
|
--image=postgres:16-alpine \
|
||||||
|
--env="PGPASSWORD=$(kubectl -n forte-drop get secret forte-drop-pg-creds -o jsonpath='{.data.pgpassword}' | base64 -d)" \
|
||||||
|
--command -- psql -h forte-drop-postgresql.forte-drop.svc -U drops -d drops \
|
||||||
|
-c "SELECT count(*) AS drops FROM drops;" -c "SELECT count(*) AS view_hits FROM view_hits;"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Bring the app back
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# If you scaled web to 0 for the restore:
|
||||||
|
kubectl -n forte-drop scale deploy/forte-drop --replicas=2
|
||||||
|
```
|
||||||
|
|
||||||
|
## Object data (uploaded drop files)
|
||||||
|
|
||||||
|
Drop files live in `s3://drops/<slug>/...` in the same managed bucket. They are
|
||||||
|
**not** part of the pg backup (the dump only holds metadata). Object storage is
|
||||||
|
UpCloud-managed/replicated, so no separate file backup is configured. If a
|
||||||
|
file-level backup is later required, mirror the bucket to a second bucket/region:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mc mirror --overwrite obj/drops/ backup-target/drops-mirror/
|
||||||
|
```
|
||||||
|
|
||||||
|
(Exclude `_pgbackups/` from the app-data mirror if you split them.)
|
||||||
|
|
||||||
|
## Disaster scenarios
|
||||||
|
|
||||||
|
| Scenario | Recovery |
|
||||||
|
|---|---|
|
||||||
|
| Postgres pod crash / reschedule | StatefulSet reattaches the PVC; ~1–2 min downtime; no data loss. |
|
||||||
|
| PVC lost / corrupted | Recreate StatefulSet, restore latest nightly dump (above). Data since last dump is lost. |
|
||||||
|
| Accidental `drops` table data loss | Restore latest dump; or `pg_restore` a single table from a dump. |
|
||||||
|
| Namespace deleted | PVC has `Prune=false,Delete=false`; recreate Applications, PVC re-binds, app recovers. Backups in object storage are independent. |
|
||||||
|
| Object storage bucket lost | UpCloud-managed (replicated). If the IAM key is rotated, update `forte-drop-secrets` (re-seal). |
|
||||||
@@ -1,19 +1,13 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Namespace
|
|
||||||
metadata:
|
|
||||||
name: passwordpusher
|
|
||||||
---
|
|
||||||
|
|
||||||
apiVersion: argoproj.io/v1alpha1
|
apiVersion: argoproj.io/v1alpha1
|
||||||
kind: Application
|
kind: Application
|
||||||
metadata:
|
metadata:
|
||||||
name: passwordpusher-postgresql
|
name: forte-drop-postgresql
|
||||||
namespace: argocd
|
namespace: argocd
|
||||||
annotations:
|
annotations:
|
||||||
argocd.argoproj.io/sync-wave: "0"
|
argocd.argoproj.io/sync-wave: "0"
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: passwordpusher-postgresql
|
app.kubernetes.io/name: forte-drop-postgresql
|
||||||
app.kubernetes.io/part-of: security
|
app.kubernetes.io/part-of: apps
|
||||||
app.kubernetes.io/managed-by: argocd
|
app.kubernetes.io/managed-by: argocd
|
||||||
finalizers:
|
finalizers:
|
||||||
- resources-finalizer.argocd.argoproj.io
|
- resources-finalizer.argocd.argoproj.io
|
||||||
@@ -23,11 +17,11 @@ spec:
|
|||||||
source:
|
source:
|
||||||
repoURL: ssh://git@git.forteapps.net:2222/Forte/launchpad.git
|
repoURL: ssh://git@git.forteapps.net:2222/Forte/launchpad.git
|
||||||
targetRevision: HEAD
|
targetRevision: HEAD
|
||||||
path: infra/overlays/upc-dev/passwordpusher-postgresql/resources
|
path: infra/overlays/upc-dev/forte-drop-postgresql/resources
|
||||||
|
|
||||||
destination:
|
destination:
|
||||||
server: https://kubernetes.default.svc
|
server: https://kubernetes.default.svc
|
||||||
namespace: passwordpusher
|
namespace: forte-drop
|
||||||
|
|
||||||
syncPolicy:
|
syncPolicy:
|
||||||
automated:
|
automated:
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- passwordpusher.yaml
|
- forte-drop-postgresql.yaml
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
apiVersion: bitnami.com/v1alpha1
|
||||||
|
kind: SealedSecret
|
||||||
|
metadata:
|
||||||
|
name: forte-drop-pg-creds
|
||||||
|
namespace: forte-drop
|
||||||
|
spec:
|
||||||
|
encryptedData:
|
||||||
|
pgpassword: AgBYokuQRCTmPGC8soB7n8W39nmSAZDTV97i77NmdMh5ndaZNtCtXxhMcpM2z8kaGv2tCWIh47dr38a5tGPZ0TsmeEQOF9Rbbtq1fyR7pJwT8S+N2Z2zu354wNWQlltEAVvTvthe2wTer/BpyRofeSZprxihmfNpuHUP8rLsnIXln5tOWDzJ8hnRWoYZFITaihC2qrJj/kFE0Rfdcmzt1tSq3jCB/rWijVaJF9XSh4rzQoqZDiUNjDPUjyERILw59JWU4zf9OKcqNHDnmpXBR4LSjLhd9waN6ElEzO4gGcVaHISKrTwewX1ONwPHDnw6lqkQObyBPx8aUsGzxLkUhNDtvIYDkB4BKWP5Qu4bNcSztIbrxi6l7Lr/DWC9qTbKm1/p83rc6r8VqRMURUyQg8/vBlCHOIUbZ8DM1OfNlMd8gvcSkaxEVIdCDUjguCvE3cGyG4cqv2unllZQ+9417WwLNJecT6x1EL3nQyAlK5c9vUIbcVyaFlbSUcGB7xmPgZrZ6/3RDyOH6Tmew1ssV9gLvdaehscUE0fjnnFnJpczkwdyxIOSNLIkjlWetCKEbhowJbzk05h3M2p6XQQOuNTnsYjAADMGD72GUgAQlY8KXmDELtv09KELcXbeYS4gABPpMrVmvZymq8lqQ13Py8o+cIqbrU5V86WxASTfQ5gMo/ymYabuhTBIapcnaKR1dFCCfu8deh5f2HJ6/1NjdWR+XvEshg+EF5OkTUInukX4vA==
|
||||||
|
pgusername: AgCs6vyQ8CIv5OneP/jMltIPGdZQbpq/BFmQM1mkBD61Ve+anzve5K0Gkg+zsNfbZf0pOPAXtu4C4aL1Lwv7gqpoe4Hp/UEb/X9uLfJ1b8ZitmM1XsPmmSiCskHjrc2BLkAvfrVIXkHc3LOY2uZ/E5stc6Ss2WFE8/uzzVXW0B8fdEK0criludQ8iwR1gypulEcDNomXgkK/1gmmCWosUcVv4jDMDhqBD+b9WYnBB6J73gUclWVMvYDFdNas2PuoRzu5Twc9TAZrTxN5lvLOXAonOo0YiUbUhEC83sfMWYDT5/9OxqcJhAxtgFe9j83MpCwLSwfeLZm7UsUapWDb60MxPJLGvoGD/ZOhkeYt/YCZYROa57TMslVIL5YU1KCiNWvtRjIqnvdiBxI7MRvPUfAoawS4ktT5PDhTTfrixFbaF95jul2kKBXV+OYB1UNsFhcCgZx9rzYRt4lNmBv4m4HeXIp3EYY8VlGLQ45BVVqjJ4QkISvb7ifQWH1aPMQllj+J3GwW0KJN0dEgsh1LT+C7W5I5mq461NOTF1eih/XRBeuPoLlgApxiGXvFCTx8lji2/JIdOaqcg29hdabSprxa0YMStChi2pbtHhRzAuFCp8mInGt8Q406vu67Y4/51yuwI40YeDVu0lf010TB+/v2Zy3OrNyjlqrD5JNynsLuRl3UhuAKC14Xhg/MiDLvTzfsYE8aog==
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
name: forte-drop-pg-creds
|
||||||
|
namespace: forte-drop
|
||||||
@@ -2,5 +2,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
|
|||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- postgresql.yaml
|
- postgresql.yaml
|
||||||
- passwordpusher-db-secret-sealed.yaml
|
- forte-drop-pg-creds-sealed.yaml
|
||||||
- passwordpusher-smtp-secret-sealed.yaml
|
- pg-backup-cronjob.yaml
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
# Nightly logical backup of the forte-drop Postgres → UpCloud Managed Object Storage.
|
||||||
|
# Dumps to s3://drops/_pgbackups/ (the `_` prefix is collision-proof: app slugs match
|
||||||
|
# /^[a-z0-9][a-z0-9-]{0,62}$/ and can never start with `_`). Retains 30 days.
|
||||||
|
#
|
||||||
|
# Pod shape: initContainer pg_dump → shared emptyDir → mc upload + retention prune.
|
||||||
|
# Both images pinned. S3 creds reuse forte-drop-secrets (the app's UpCloud user has
|
||||||
|
# s3:* on the drops bucket). PG creds from forte-drop-pg-creds.
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: CronJob
|
||||||
|
metadata:
|
||||||
|
name: forte-drop-pg-backup
|
||||||
|
namespace: forte-drop
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: postgresql
|
||||||
|
app.kubernetes.io/instance: forte-drop
|
||||||
|
app.kubernetes.io/component: backup
|
||||||
|
spec:
|
||||||
|
schedule: "0 2 * * *" # 02:00 UTC daily
|
||||||
|
concurrencyPolicy: Forbid
|
||||||
|
successfulJobsHistoryLimit: 3
|
||||||
|
failedJobsHistoryLimit: 3
|
||||||
|
jobTemplate:
|
||||||
|
spec:
|
||||||
|
backoffLimit: 2
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: postgresql
|
||||||
|
app.kubernetes.io/instance: forte-drop
|
||||||
|
app.kubernetes.io/component: backup
|
||||||
|
spec:
|
||||||
|
restartPolicy: Never
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
runAsUser: 65532
|
||||||
|
fsGroup: 65532
|
||||||
|
volumes:
|
||||||
|
- name: work
|
||||||
|
emptyDir: {}
|
||||||
|
initContainers:
|
||||||
|
- name: dump
|
||||||
|
image: postgres:16-alpine
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
set -euo pipefail
|
||||||
|
TS=$(date -u +%Y%m%dT%H%M%SZ)
|
||||||
|
echo "dumping to /work/forte-drop-${TS}.sql.gz"
|
||||||
|
PGPASSWORD="$PGPASSWORD" pg_dump \
|
||||||
|
-h forte-drop-postgresql.forte-drop.svc \
|
||||||
|
-p 5432 -U "$PGUSER" -d drops \
|
||||||
|
--no-owner --no-privileges \
|
||||||
|
| gzip -9 > "/work/forte-drop-${TS}.sql.gz"
|
||||||
|
echo "dump complete: $(ls -lh /work/)"
|
||||||
|
env:
|
||||||
|
- name: PGUSER
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef: { name: forte-drop-pg-creds, key: pgusername }
|
||||||
|
- name: PGPASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef: { name: forte-drop-pg-creds, key: pgpassword }
|
||||||
|
volumeMounts:
|
||||||
|
- name: work
|
||||||
|
mountPath: /work
|
||||||
|
containers:
|
||||||
|
- name: upload
|
||||||
|
image: quay.io/minio/mc:RELEASE.2024-11-21T17-21-54Z
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
set -euo pipefail
|
||||||
|
mc alias set obj "$S3_ENDPOINT" "$S3_KEY" "$S3_SECRET"
|
||||||
|
mc cp /work/*.sql.gz "obj/${S3_BUCKET}/_pgbackups/"
|
||||||
|
echo "uploaded. pruning backups older than 30d:"
|
||||||
|
mc rm --recursive --force --older-than 30d "obj/${S3_BUCKET}/_pgbackups/" || true
|
||||||
|
echo "backup retention pass complete"
|
||||||
|
env:
|
||||||
|
- name: S3_ENDPOINT
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef: { name: forte-drop-secrets, key: S3_ENDPOINT }
|
||||||
|
- name: S3_BUCKET
|
||||||
|
value: "drops"
|
||||||
|
- name: S3_KEY
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef: { name: forte-drop-secrets, key: S3_KEY }
|
||||||
|
- name: S3_SECRET
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef: { name: forte-drop-secrets, key: S3_SECRET }
|
||||||
|
volumeMounts:
|
||||||
|
- name: work
|
||||||
|
mountPath: /work
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: passwordpusher-postgresql
|
name: forte-drop-postgresql
|
||||||
namespace: passwordpusher
|
namespace: forte-drop
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: postgresql
|
app.kubernetes.io/name: postgresql
|
||||||
app.kubernetes.io/instance: passwordpusher
|
app.kubernetes.io/instance: forte-drop
|
||||||
app.kubernetes.io/component: database
|
app.kubernetes.io/component: database
|
||||||
spec:
|
spec:
|
||||||
type: ClusterIP
|
type: ClusterIP
|
||||||
@@ -15,34 +15,38 @@ spec:
|
|||||||
targetPort: tcp-postgresql
|
targetPort: tcp-postgresql
|
||||||
selector:
|
selector:
|
||||||
app.kubernetes.io/name: postgresql
|
app.kubernetes.io/name: postgresql
|
||||||
app.kubernetes.io/instance: passwordpusher
|
app.kubernetes.io/instance: forte-drop
|
||||||
---
|
---
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: StatefulSet
|
kind: StatefulSet
|
||||||
metadata:
|
metadata:
|
||||||
name: passwordpusher-postgresql
|
name: forte-drop-postgresql
|
||||||
namespace: passwordpusher
|
namespace: forte-drop
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: postgresql
|
app.kubernetes.io/name: postgresql
|
||||||
app.kubernetes.io/instance: passwordpusher
|
app.kubernetes.io/instance: forte-drop
|
||||||
app.kubernetes.io/component: database
|
app.kubernetes.io/component: database
|
||||||
spec:
|
spec:
|
||||||
serviceName: passwordpusher-postgresql
|
serviceName: forte-drop-postgresql
|
||||||
replicas: 1
|
replicas: 1
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app.kubernetes.io/name: postgresql
|
app.kubernetes.io/name: postgresql
|
||||||
app.kubernetes.io/instance: passwordpusher
|
app.kubernetes.io/instance: forte-drop
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: postgresql
|
app.kubernetes.io/name: postgresql
|
||||||
app.kubernetes.io/instance: passwordpusher
|
app.kubernetes.io/instance: forte-drop
|
||||||
app.kubernetes.io/component: database
|
app.kubernetes.io/component: database
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: postgresql
|
- name: postgresql
|
||||||
image: postgres:16-alpine
|
image: postgres:16-alpine
|
||||||
|
# NOTE: no securityContext. The official postgres image's entrypoint must
|
||||||
|
# start as root to chown a fresh /var/lib/postgresql/data, then drops to
|
||||||
|
# the postgres user (uid 70 in alpine) via gosu. Forcing runAsNonRoot here
|
||||||
|
# breaks initdb on a fresh PVC. Matches the vaultwarden-postgresql pattern.
|
||||||
ports:
|
ports:
|
||||||
- name: tcp-postgresql
|
- name: tcp-postgresql
|
||||||
containerPort: 5432
|
containerPort: 5432
|
||||||
@@ -50,15 +54,15 @@ spec:
|
|||||||
- name: POSTGRES_USER
|
- name: POSTGRES_USER
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: passwordpusher-db-creds
|
name: forte-drop-pg-creds
|
||||||
key: pgusername
|
key: pgusername
|
||||||
- name: POSTGRES_PASSWORD
|
- name: POSTGRES_PASSWORD
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: passwordpusher-db-creds
|
name: forte-drop-pg-creds
|
||||||
key: pgpassword
|
key: pgpassword
|
||||||
- name: POSTGRES_DB
|
- name: POSTGRES_DB
|
||||||
value: passwordpusher
|
value: drops
|
||||||
- name: PGDATA
|
- name: PGDATA
|
||||||
value: /var/lib/postgresql/data/pgdata
|
value: /var/lib/postgresql/data/pgdata
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
@@ -69,7 +73,7 @@ spec:
|
|||||||
command:
|
command:
|
||||||
- sh
|
- sh
|
||||||
- -c
|
- -c
|
||||||
- pg_isready -U "$POSTGRES_USER" -d passwordpusher
|
- pg_isready -U "$POSTGRES_USER" -d drops
|
||||||
initialDelaySeconds: 30
|
initialDelaySeconds: 30
|
||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
@@ -77,7 +81,7 @@ spec:
|
|||||||
command:
|
command:
|
||||||
- sh
|
- sh
|
||||||
- -c
|
- -c
|
||||||
- pg_isready -U "$POSTGRES_USER" -d passwordpusher
|
- pg_isready -U "$POSTGRES_USER" -d drops
|
||||||
initialDelaySeconds: 5
|
initialDelaySeconds: 5
|
||||||
periodSeconds: 5
|
periodSeconds: 5
|
||||||
resources:
|
resources:
|
||||||
@@ -90,9 +94,12 @@ spec:
|
|||||||
volumeClaimTemplates:
|
volumeClaimTemplates:
|
||||||
- metadata:
|
- metadata:
|
||||||
name: data
|
name: data
|
||||||
|
annotations:
|
||||||
|
argocd.argoproj.io/sync-options: Prune=false,Delete=false
|
||||||
spec:
|
spec:
|
||||||
accessModes:
|
accessModes:
|
||||||
- ReadWriteOnce
|
- ReadWriteOnce
|
||||||
|
storageClassName: upcloud-block-storage-maxiops
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
storage: 2Gi
|
storage: 5Gi
|
||||||
@@ -4,8 +4,7 @@ resources:
|
|||||||
- ../../base
|
- ../../base
|
||||||
- vaultwarden-postgresql
|
- vaultwarden-postgresql
|
||||||
- vaultwarden
|
- vaultwarden
|
||||||
- passwordpusher-postgresql
|
- forte-drop-postgresql
|
||||||
- passwordpusher
|
|
||||||
|
|
||||||
# No patches needed — base already has "upc-dev" paths
|
# No patches needed — base already has "upc-dev" paths
|
||||||
# upc-dev is the default/base cluster
|
# upc-dev is the default/base cluster
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
||||||
kind: Kustomization
|
|
||||||
resources:
|
|
||||||
- passwordpusher-postgresql.yaml
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
---
|
|
||||||
apiVersion: bitnami.com/v1alpha1
|
|
||||||
kind: SealedSecret
|
|
||||||
metadata:
|
|
||||||
creationTimestamp: null
|
|
||||||
name: passwordpusher-db-creds
|
|
||||||
namespace: passwordpusher
|
|
||||||
spec:
|
|
||||||
encryptedData:
|
|
||||||
DATABASE_URL: AgBeCVhdJoq18FFbP/8CUFFHBu3cUHisStmqeU3stH33qRgm0sh1Agw87QaiECBlKGp9yEjDVgQEjU/h9vEqs5L13vnzTvzmzEIMy23m1nWEyX6pY06O/ISDD6AVeW73SX6ctgZ4wabv8zZhEQ/GiKTLq8indTrNglINpItUKdjpZ5IhJWNScOkykZdIN/OyJxxzKQ5fM48ZVfL8HnTNQ+sqEJQ/P4CEHVwJQaEuIKsS+P1PKNmOxzI7IB7PegkZwORMKA83r1oufiV5q+/wY2eMujt/PkZxkokj9jdI9ATGwXfOVgPR16BXrKRIKO2AwObL1ter+Y0LnNGxl9gAz8q65b4KHdM//sKSscLo9rPWKq0R0y4octiC1FlQEvsbMZnNntDLR1vBiqRUz5YaoKcEH6nlLpubCrBpIve8f5Ty3w2YUk7k4dpQzITgZqpJirmw5RAY9OIQQldB8NHjfmKkTtlHxW1Bif/yo+XqCKX4+1xh4nbWb6z2VQtUeQHm++ITZokxAV5as/EEZyEfCfqLbQbQkk5xuPpc3B6VjyGNbAIyQQz3Ktx5t2bqa/qf2YQQTVMZaBijHV6jaK3YzyWyheefZAqliF3xUY8mm2zrOAK4+JaKbRKSQzvCzpYtcwxVO5hCV0Wki4qbMXCWbLV0SmUgiJeL/SC/iXSPBmdQIw2P8Pao1gPzhtJl/rGzdw+Nx0VtYeCID8PlsvjUO3oiv3wYFVE/Xb9oYkoQnadOrnBmUNoXATvPLb6bN/cxlZ6c5bDAReY5M5k4Im9XMWDUDiH/9bIk+V8C
|
|
||||||
pgpassword: AgBneCXX9h7cFbvVcqk9bNSgHqPGpYQmDxDHmI2CdgIPXwogVA/HxGpaR/HnByUwXbk9PBzHuNJHTWB5XtbEgd7EVvhmhNkEuW9cfBpO6RhSYWr4yQsEQ4tRIDicCMnCh3qWFxMJKPxhN4+gB+KY0HxVQXlr/TkPEnHGNILCrwJsSP9JYufYy5xcL25c949X6M2iSi1i8OFDOYC7s72VZmS2iAEIdnY01yDJ/pW5UYNi53rtAYWZ0tzRJbl55NdWeZGJdmKEQ0OvywW50So97R0ceC6QCkBzzRin4IP5dWuWbqm/D9FL4pxUfIvNuXbMd2fGbn1DjgqfeiN9QSfgLeHqMWbFAmelA/ETKGZBJJkp8MQta7PYk30yDo9cD147AnfLSjR74plGCZBFt0tn/8fGE00G70ymo1FPqWqnVMvlrnaWwdgdlKeKbamPWw0Uo6ZHcglFlHq5ke2kEhRG4yFvk8PuuUygHShGe7uQAlWcqLw4H4/WZyy/bBVTyUfmXTg0ArEKdbb7iI/izGgGMv2NtSiV9/DutkiqmrGoc+gO6fYGfUc66XJMpAlH/FUs3Ebqk0ZSIR4j8NyygwgY+1Jm3yuSQCs6+MVH5nrf1VoAYGadMiB40lfmn1FkZwrkdWm+C00/exVqT2dys+AjMfpAFfmGY2LDjSavvqJXKYyX1x/kZ6D+gndhP2FcT9qscnScGjys8JrH
|
|
||||||
pgusername: AgBUzpTtG8uIRRCjX3xN5UEvCybo2sgMk2v6SwoaO0TDVNMwZNKEjNigWeaD0nOX/gXu14X2KPX12YfXyaag+1CmaprUAVZzQDmF3Rseaz5MzqQnJlYfYdlWM4O+x0j2KLj+hKiw30P0T3IxZyngRw+T5c8hevYA2tXU0dvdmXZhs7L5M1mO1DJcef0tH/170RQ/8klUxaj/reWibK3DNxqCU/BOkJvUMoDkmb+hGlX4i4f0cPWEIYRjjXejDtL+LO7bMxzESqmb8VDPlDiIBvCYyBNdkN/F4ngfIAWxKBiMQTvsD8O7W3qdMDy55qHW3gPZY6ugLEyw/un6MtsaYSBame6kbjjEoy0pyyjB+SGWB6xxUIZ2Lfzflu8rZBnKEi2fkxsIAE71vhnLzcXn0WYjF3Hgh/fWQ6GYqJK9M5Ieiq6WVnWvztvWKuscZmVlHtRO9HtucCyiArvZE2yLRUDwI6NAws4R6gELadfjSECp1CRaOc53MrPHvYjIE/WWq1uI+0f0spaPV09mYEl5qGgcPW7V5ADXcmxIXHqtOfhEevrckILr9U9G/FU2q3ohveUiUUxBaMOzgAJ9mO64oDfLbit2WJqaqmdKy4xiVWwzxVDmWmNKFAs3DHNK7y9QNvYmrbM6370Pw2zsxc89yl0PvqCtzj57uUDh3ohNE3ZrTUHWsHkEniKiSCVRZD5LG9dEJKMD1nE=
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
creationTimestamp: null
|
|
||||||
name: passwordpusher-db-creds
|
|
||||||
namespace: passwordpusher
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
---
|
|
||||||
apiVersion: bitnami.com/v1alpha1
|
|
||||||
kind: SealedSecret
|
|
||||||
metadata:
|
|
||||||
creationTimestamp: null
|
|
||||||
name: passwordpusher-smtp-creds
|
|
||||||
namespace: passwordpusher
|
|
||||||
spec:
|
|
||||||
encryptedData:
|
|
||||||
PWP__MAIL_SMTP_PASSWORD: AgBgRYGOS6O5u6WDXxfqkLsVClufJe8O0K3/NBWKEnwKFKd/yeQVnkB/sd2apIFADK6auge+G5uFv9TejWJuqkU3QHbkvmnjnMtinRkt/lh0GrrCygmvzvwTQKCXefeqWHT5yvGtN0z6mLP73yOLoJmAMnZk9/QGHuw9jfuLEDREZ3cSrdYAAIWhospSPpvau2UNN2/yanjhmH0Yux2fZVkwKtDcS6YHFtL+s4VR7wcB/cvMaCX4vSezMtyQJhgHcmFLNHnNjjVdMEQVGMtrZ7XocbWJ0ZkvKotkuOFf/XMq5AM9ZVgaJB9di39JLweqpsfGVQJftgGW/f/edDSlbiOTjDO2cM93xY9OD9T2kts5MkeX1jLD+Q+V0OXL7+nor1jAfv/CwZ5sBibnQFKYaQpCRCw4c4pYX73VjbRsEcTHXJyfUpTJdlw8Jd3yPPL1Uqb6ga5xxUO7YsgfdH4HZYWuLR/x8Pk1Ne/qpctzHZcUkRto6MKPhkK1IW83qSJPGT3wNHgYcx6uMW9f9L/ox7k00GGWZ3Pj79khv9NJ8PXO0thsTuZktjskHYBmZk044CWpSiill0318pCaIXW6mpg5adGbeZLa+LZ9GNxMWP+iOJIcFyYNZs3GmlV08OQ741S2cbumOQhxppJkcWTdpkZrZlAanLa4XZsmW+PXmsujOsMLEuto3PpJxpujYAt3s6Nv7O79FlGqrfisRipdFw==
|
|
||||||
PWP__MAIL_SMTP_USER_NAME: AgAli4SWEtNSiuRvbhuAYdRtBPpPYQfVp1cjiPXUqX7CxBG6bOdlMFzUPnjmZ3RVDq8UaRbwF1eJisnLt1nRCh5+DzpOXNgiU8ex2uZx7mQPf/nr/5p1HwJHbMZUo6Qieqo8NIwA0fwapQPsLizI90wI2J8f4m4nk4SXb0FW0h23SpulEJV99w92TPdOd/KuovVzEFltWeCWOsaHdVufKDsKLMFc4SNrkBwYxaCkuGnM6zICiLc7+5lF7cza8JukfGXsF12U04CkqgMDOOQG4GNNIeGSOc2GGtngpmYbuKZA1vk8ZnG3K+nVyD12bW2JhvWOBpNSc+29gLbizkNGI8QLhlxet3HznjYal9aqiIR2/glZgIUsnmgwmVg+VpxnM6A/R47sljeIzyzY0dkVxDyG1fDfKiWmXIWQU/7750Ct8XgMsVIkyDGQAK2g8o97a75lSnTngGq88VvTBLCiSEgumhPrMYf4n7ot4tSM1lfGuxmYdrOKXqXNkhBF+jxe27pd4ayCzcXniibZKRqhCozZZkAoYoo+V8tnIlewrTJhzm9THgKL849Df3Va9tI7EOvqHy82FjwTL++jCpUrOe1Emp11WpUJElnn+PUWRJnW02Xz+a0vP+mJMjC1XsylDM78i31a6Tw8Rfu7W4G7yuwzgU9GDCDL6dt7nsGUSNuucZz7CVx2pePFLWJBC8DmcuuWh/UlnrNp8IY/9kC34DAbwuBTQuFhYne1xWSA
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
creationTimestamp: null
|
|
||||||
name: passwordpusher-smtp-creds
|
|
||||||
namespace: passwordpusher
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
apiVersion: argoproj.io/v1alpha1
|
|
||||||
kind: Application
|
|
||||||
metadata:
|
|
||||||
name: passwordpusher
|
|
||||||
namespace: argocd
|
|
||||||
annotations:
|
|
||||||
argocd.argoproj.io/sync-wave: "1"
|
|
||||||
labels:
|
|
||||||
app.kubernetes.io/name: passwordpusher
|
|
||||||
app.kubernetes.io/part-of: security
|
|
||||||
app.kubernetes.io/managed-by: argocd
|
|
||||||
finalizers:
|
|
||||||
- resources-finalizer.argocd.argoproj.io
|
|
||||||
spec:
|
|
||||||
project: default
|
|
||||||
|
|
||||||
sources:
|
|
||||||
- repoURL: https://pglombardo.github.io/passwordpusher-charts
|
|
||||||
chart: password-pusher
|
|
||||||
targetRevision: "1.4.4"
|
|
||||||
helm:
|
|
||||||
releaseName: passwordpusher
|
|
||||||
valueFiles:
|
|
||||||
- $values/infra/values/base/passwordpusher-values.yaml
|
|
||||||
- $values/infra/values/upc-dev/passwordpusher-values.yaml
|
|
||||||
|
|
||||||
- repoURL: ssh://git@git.forteapps.net:2222/Forte/launchpad.git
|
|
||||||
targetRevision: HEAD
|
|
||||||
ref: values
|
|
||||||
|
|
||||||
destination:
|
|
||||||
server: https://kubernetes.default.svc
|
|
||||||
namespace: passwordpusher
|
|
||||||
|
|
||||||
syncPolicy:
|
|
||||||
automated:
|
|
||||||
prune: true
|
|
||||||
selfHeal: true
|
|
||||||
allowEmpty: false
|
|
||||||
syncOptions:
|
|
||||||
- CreateNamespace=true
|
|
||||||
- Validate=true
|
|
||||||
- ServerSideApply=true
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
image:
|
|
||||||
repository: docker.io/pglombardo/pwpush
|
|
||||||
tag: "release-1.51.0"
|
|
||||||
|
|
||||||
# Disable the bundled postgresql subchart — we run our own StatefulSet
|
|
||||||
postgresql:
|
|
||||||
enabled: false
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
env:
|
|
||||||
PWP__HOST_DOMAIN: pwpush.forteapps.net
|
|
||||||
PWP__HOST_PROTOCOL: https
|
|
||||||
PWP__ENABLE_LOGINS: "true"
|
|
||||||
PWP__ALLOW_ANONYMOUS: "false"
|
|
||||||
PWP__SIGNUPS_ENABLED: "false"
|
|
||||||
PWP__MAIL_RAISE_DELIVERY_ERRORS: "false"
|
|
||||||
PWP__MAIL_SMTP_ADDRESS: smtp.office365.com
|
|
||||||
PWP__MAIL_SMTP_PORT: "587"
|
|
||||||
PWP__MAIL_SMTP_AUTHENTICATION: login
|
|
||||||
PWP__MAIL_SMTP_STARTTLS: "true"
|
|
||||||
PWP__MAIL_SMTP_DOMAIN: fortedigital.com
|
|
||||||
PWP__MAIL_SENDER: noreply@fortedigital.com
|
|
||||||
|
|
||||||
envFrom:
|
|
||||||
- secretRef:
|
|
||||||
name: passwordpusher-db-creds
|
|
||||||
- secretRef:
|
|
||||||
name: passwordpusher-smtp-creds
|
|
||||||
|
|
||||||
ingress:
|
|
||||||
enabled: true
|
|
||||||
className: traefik
|
|
||||||
annotations:
|
|
||||||
cert-manager.io/cluster-issuer: letsencrypt-prod
|
|
||||||
gethomepage.dev/enabled: "true"
|
|
||||||
gethomepage.dev/name: "PasswordPusher"
|
|
||||||
gethomepage.dev/description: "Share passwords securely with expiring links"
|
|
||||||
gethomepage.dev/group: "Security"
|
|
||||||
gethomepage.dev/icon: "passwordpusher"
|
|
||||||
gethomepage.dev/href: "https://pwpush.forteapps.net"
|
|
||||||
hosts:
|
|
||||||
- host: pwpush.forteapps.net
|
|
||||||
paths:
|
|
||||||
- path: /
|
|
||||||
pathType: Prefix
|
|
||||||
tls:
|
|
||||||
- secretName: passwordpusher-tls
|
|
||||||
hosts:
|
|
||||||
- pwpush.forteapps.net
|
|
||||||
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: 100m
|
|
||||||
memory: 256Mi
|
|
||||||
limits:
|
|
||||||
cpu: 500m
|
|
||||||
memory: 512Mi
|
|
||||||
|
|
||||||
replicaCount: 1
|
|
||||||
Reference in New Issue
Block a user