Align deploy paths and namespace with current k8s target
This commit is contained in:
@@ -34,23 +34,16 @@ deploy-db.sh
|
|||||||
README.md
|
README.md
|
||||||
```
|
```
|
||||||
|
|
||||||
## Database
|
# Database
|
||||||
|
|
||||||
The app connects to a PostgreSQL database using the `DATABASE_URL` environment variable.
|
The app connects to a PostgreSQL database using the `DATABASE_URL` environment variable.
|
||||||
|
|
||||||
### Deploy / rotate the database secret on Kubernetes
|
Kubernetes runtime uses:
|
||||||
|
|
||||||
Run the helper script. It generates a secure random password, encrypts it to `~/.lahuasca-db-pass.enc`, and applies it to the `la-huasca-db-secrets` secret in the `la-huasca` namespace.
|
- namespace: `lahuasca`
|
||||||
|
- Postgres: 15, PVC-backed
|
||||||
```bash
|
- app secrets: `calendar-db-secrets`, key `url`
|
||||||
./deploy-db.sh
|
- ingress: Traefik on `lahuasca.com`
|
||||||
```
|
|
||||||
|
|
||||||
To reveal the stored password, use the PIN `78963`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./deploy-db.sh reveal
|
|
||||||
```
|
|
||||||
|
|
||||||
### Initialize the database schema and seed data
|
### Initialize the database schema and seed data
|
||||||
|
|
||||||
@@ -66,6 +59,8 @@ To reset everything (drops and recreates tables with seed data):
|
|||||||
curl -X POST "http://localhost:3000/api/db/init?reset=true"
|
curl -X POST "http://localhost:3000/api/db/init?reset=true"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note: database initialization is blocked in production. Use `reset=true` only if you actually want schema reinitialization.
|
||||||
|
|
||||||
## Authentication
|
## Authentication
|
||||||
|
|
||||||
The app includes JWT-based session authentication backed by the database. Demo accounts are seeded automatically:
|
The app includes JWT-based session authentication backed by the database. Demo accounts are seeded automatically:
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ set -euo pipefail
|
|||||||
|
|
||||||
# Deploy Postgres for la-huasca in its own namespace
|
# Deploy Postgres for la-huasca in its own namespace
|
||||||
|
|
||||||
NAMESPACE="la-huasca"
|
NAMESPACE="lahuasca"
|
||||||
SECRET_NAME="la-huasca-db-secrets"
|
SECRET_NAME="la-huasca-db-secrets"
|
||||||
PVC_NAME="postgres-data"
|
PVC_NAME="postgres-data"
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ set -euo pipefail
|
|||||||
# - docker or buildah/push capability (we build locally and push)
|
# - docker or buildah/push capability (we build locally and push)
|
||||||
# - registry secret exists or REGISTRY_USER/REGISTRY_PASS are exported
|
# - registry secret exists or REGISTRY_USER/REGISTRY_PASS are exported
|
||||||
|
|
||||||
NAMESPACE="la-huasca"
|
NAMESPACE="lahuasca"
|
||||||
IMAGE="gitea.ajavasoft.com/muken/la-huasca-ts"
|
IMAGE="gitea.ajavasoft.com/muken/la-huasca-ts"
|
||||||
TAG="${TAG:-$(git rev-parse --short HEAD)}"
|
TAG="${TAG:-$(git rev-parse --short HEAD)}"
|
||||||
HOSTS=("lahuasca.com" "www.lahuasca.com")
|
HOSTS=("lahuasca.com" "www.lahuasca.com")
|
||||||
|
|||||||
+5
-17
@@ -2,7 +2,7 @@ apiVersion: apps/v1
|
|||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: la-huasca-ts
|
name: la-huasca-ts
|
||||||
namespace: la-huasca-ts
|
namespace: lahuasca
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
selector:
|
selector:
|
||||||
@@ -29,18 +29,6 @@ spec:
|
|||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: calendar-db-secrets
|
name: calendar-db-secrets
|
||||||
key: url
|
key: url
|
||||||
readinessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /api/health
|
|
||||||
port: http
|
|
||||||
initialDelaySeconds: 20
|
|
||||||
periodSeconds: 15
|
|
||||||
livenessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /api/health
|
|
||||||
port: http
|
|
||||||
initialDelaySeconds: 60
|
|
||||||
periodSeconds: 30
|
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: 200m
|
cpu: 200m
|
||||||
@@ -53,7 +41,7 @@ apiVersion: v1
|
|||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: la-huasca-ts
|
name: la-huasca-ts
|
||||||
namespace: la-huasca-ts
|
namespace: lahuasca
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- port: 80
|
- port: 80
|
||||||
@@ -67,17 +55,17 @@ apiVersion: networking.k8s.io/v1
|
|||||||
kind: Ingress
|
kind: Ingress
|
||||||
metadata:
|
metadata:
|
||||||
name: la-huasca-ts
|
name: la-huasca-ts
|
||||||
namespace: la-huasca-ts
|
namespace: lahuasca
|
||||||
annotations:
|
annotations:
|
||||||
traefik.ingress.kubernetes.io/router.entrypoints: web,websecure
|
traefik.ingress.kubernetes.io/router.entrypoints: web,websecure
|
||||||
spec:
|
spec:
|
||||||
ingressClassName: traefik
|
ingressClassName: traefik
|
||||||
tls:
|
tls:
|
||||||
- hosts:
|
- hosts:
|
||||||
- la-huasca.ajavasoft.com
|
- lahuasca.com
|
||||||
secretName: la-huasca-ts-tls
|
secretName: la-huasca-ts-tls
|
||||||
rules:
|
rules:
|
||||||
- host: la-huasca.ajavasoft.com
|
- host: lahuasca.com
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- path: /
|
- path: /
|
||||||
|
|||||||
Reference in New Issue
Block a user