add redis to staging
ci / build (push) Failing after 2m2s Details

This commit is contained in:
CJ_Clippy 2024-07-18 04:37:36 -08:00
parent 4569267cad
commit 72e370e5b8
12 changed files with 62 additions and 19 deletions

View File

@ -44,7 +44,7 @@ chisel:
clean:
kind delete cluster
dotenvx run -f .env.$(ENV) -- node ./packages/infra/vultr-delete-orphaned-resources.js
node ./packages/infra/vultr-delete-orphaned-resources.js
deps:
echo "Some of the install methods for these dependencies are not cross-platform compatible. Some of the install methods are not tested. Expect this to fail. Please consult the Makefile for URLs to project sources."
@ -57,8 +57,9 @@ deps:
sudo systemctl start docker
usermod -aG docker cj
newgrp docker
npm i -g pnpm
pnpm install -g @dotenvx/dotenvx
curl -OL 'https://github.com/vmware-tanzu/velero/releases/download/v1.13.2/velero-v1.13.2-linux-amd64.tar.gz'
npm install -g @dotenvx/dotenvx
OS=$(go env GOOS); ARCH=$(go env GOARCH); curl -fsSL -o cmctl https://github.com/cert-manager/cmctl/releases/latest/download/cmctl_${OS}_${ARCH}
chmod +x cmctl
sudo mv cmctl /usr/local/bin

View File

@ -414,6 +414,8 @@ k8s_resource(
# ]
# )
## redis is only here for uppy's usage.
## If we can engineer a way to delete redis, let's do it
helm_remote(
'redis',
repo_name='redis',

View File

@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: futureporn
resources:
- repository.yaml

View File

@ -3,4 +3,3 @@ kind: Kustomization
namespace: futureporn
resources:
- release.yaml
- repository.yaml

View File

@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: futureporn
resources:
- release.yaml

View File

@ -0,0 +1,27 @@
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
namespace: futureporn
name: redis
spec:
releaseName: redis
chart:
spec:
version: "19.6.2"
chart: redis
sourceRef:
kind: HelmRepository
name: bitnami
interval: 5m
install:
remediation:
retries: -1
## see https://artifacthub.io/packages/helm/bitnami/redis?modal=values
values:
auth:
existingSecret: redis
existingSecretPasswordKey: password
replica:
persistence:
enabled: false
architecture: standalone

View File

@ -3,6 +3,8 @@ kind: Kustomization
namespace: futureporn
resources:
- ../base/temporal
- ../base/bitnami
- ../base/redis
- ../base/postgresql
- ../base/fp
patches:

View File

@ -2,6 +2,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: futureporn
resources:
- ../base/bitnami
- ../base/redis
- ../base/podinfo
- ../base/temporal
- ../base/postgresql

View File

@ -139,7 +139,7 @@ kubectl --namespace futureporn create secret generic strapi \
--from-literal=adminJwtSecret=${STRAPI_ADMIN_JWT_SECRET} \
--from-literal=apiTokenSalt=${STRAPI_API_TOKEN_SALT} \
--from-literal=appKeys=${STRAPI_APP_KEYS} \
--from-literal=databaseUrl=postgresql-primary.futureporn.svc.cluster.local://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB} \
--from-literal=databaseUrl=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB} \
--from-literal=jwtSecret=${STRAPI_JWT_SECRET} \
--from-literal=muxPlaybackRestrictionId=${MUX_PLAYBACK_RESTRICTION_ID} \
--from-literal=muxSigningKeyPrivateKey=${MUX_SIGNING_KEY_PRIVATE_KEY} \

View File

@ -4,13 +4,13 @@
# source "${bindir}/../.env"
if [ -z $POSTGRES_REALTIME_PASSWORD ]; then
echo "POSTGRES_REALTIME_PASSWORD was missing in env"
if [ -z $POSTGRES_PASSWORD ]; then
echo "POSTGRES_PASSWORD was missing in env"
exit 5
fi
## Create the temporal databases
kubectl -n futureporn exec postgres -- psql -U postgres --command "\
kubectl -n futureporn exec postgresql-primary-0 -- env PGPASSWORD=${POSTGRES_PASSWORD} psql -U postgres --command "\
CREATE DATABASE temporal_visibility \
WITH \
OWNER = postgres \
@ -20,7 +20,7 @@ kubectl -n futureporn exec postgres -- psql -U postgres --command "\
IS_TEMPLATE = False;"
kubectl -n futureporn exec postgres -- psql -U postgres --command "\
kubectl -n futureporn exec postgresql-primary-0 -- env PGPASSWORD=${POSTGRES_PASSWORD} psql -U postgres --command "\
CREATE DATABASE temporal \
WITH \
OWNER = postgres \
@ -29,7 +29,7 @@ kubectl -n futureporn exec postgres -- psql -U postgres --command "\
CONNECTION LIMIT = -1 \
IS_TEMPLATE = False;"
# kubectl -n futureporn exec postgres -- psql -U postgres --command "\
# kubectl -n futureporn exec postgresql-primary-0 -- psql -U postgres --command "\
# CREATE DATABASE trigger \
# WITH \
# OWNER = postgres \
@ -51,7 +51,7 @@ kubectl -n futureporn exec postgres -- psql -U postgres --command "\
## Create the futureporn Strapi database
kubectl -n futureporn exec postgres -- psql -U postgres --command "\
kubectl -n futureporn exec postgresql-primary-0 -- env PGPASSWORD=${POSTGRES_PASSWORD} psql -U postgres --command "\
CREATE DATABASE futureporn_db \
WITH \
OWNER = postgres \
@ -62,7 +62,7 @@ kubectl -n futureporn exec postgres -- psql -U postgres --command "\
## Create the trigger database (for backend tasks)
kubectl -n futureporn exec postgres -- psql -U postgres --command "\
kubectl -n futureporn exec postgresql-primary-0 -- env PGPASSWORD=${POSTGRES_PASSWORD} psql -U postgres --command "\
CREATE DATABASE trigger \
WITH \
OWNER = postgres \
@ -73,7 +73,7 @@ kubectl -n futureporn exec postgres -- psql -U postgres --command "\
## create futureporn user
kubectl -n futureporn exec postgres -- psql -U postgres --command "\
kubectl -n futureporn exec postgresql-primary-0 -- env PGPASSWORD=${POSTGRES_PASSWORD} psql -U postgres --command "\
CREATE ROLE futureporn \
WITH \
LOGIN \
@ -88,13 +88,13 @@ kubectl -n futureporn exec postgres -- psql -U postgres --command "\
## grant futureporn user all privs
kubectl -n futureporn exec postgres -- psql -U postgres --command "\
kubectl -n futureporn exec postgresql-primary-0 -- env PGPASSWORD=${POSTGRES_PASSWORD} psql -U postgres --command "\
GRANT ALL PRIVILEGES ON DATABASE trigger TO futureporn;"
## import schema
## I have a file, schema.psql that I want to import. How do I do that?
# kubectl -n futureporn exec postgres -- psql -U postgres --command "\ ;"
# kubectl -n futureporn exec postgres -- psql -U postgres -f - < "${bindir}/postgres-2024-05-09-futureporn_db-schema-only.psql"
# kubectl -n futureporn exec postgresql-primary-0 -- psql -U postgres --command "\ ;"
# kubectl -n futureporn exec postgresql-primary-0 -- psql -U postgres -f - < "${bindir}/postgres-2024-05-09-futureporn_db-schema-only.psql"

View File

@ -3,11 +3,11 @@
dbname=20240704T204659Z_development.psql
## drop futureporn_db
kubectl -n futureporn exec postgres -- psql -U postgres --command "DROP DATABASE futureporn_db;"
kubectl -n futureporn exec postgresql-primary-0 -- env PGPASSWORD=${POSTGRES_PASSWORD} psql -U postgres --command "DROP DATABASE futureporn_db;"
## create futureporn_db
kubectl -n futureporn exec postgres -- psql -U postgres --command "\
kubectl -n futureporn exec postgresql-primary-0 -- env PGPASSWORD=${POSTGRES_PASSWORD} psql -U postgres --command "\
CREATE DATABASE futureporn_db \
WITH \
OWNER = postgres \
@ -27,6 +27,6 @@ kubectl -n futureporn exec postgres -- psql -U postgres --command "\
# kubectl exec -i POD_NAME -- pg_restore -U USERNAME -C -d DATABASE < dump.sql
kubectl -n futureporn cp /home/cj/Documents/futureporn-meta/backups/$dbname postgres:/tmp/db.psql
kubectl -n futureporn exec -i postgres -- pg_restore -U postgres -d futureporn_db /tmp/db.psql
kubectl -n futureporn cp /home/cj/Documents/futureporn-meta/backups/$dbname postgresql-primary-0:/tmp/db.psql
kubectl -n futureporn exec -i postgresql-primary-0 -- env PGPASSWORD=${POSTGRES_PASSWORD} pg_restore -U postgres -d futureporn_db /tmp/db.psql
# kubectl -n futureporn exec -ti db-postgresql-0 -- rm /tmp/db.psql