Add Immich application deployment files and configuration
- Create README.md for Immich app description - Add example.env for configuration settings - Implement deployment.yaml for Immich server and microservices - Set up ingress.yaml for public access with DNS annotations - Introduce db-init-job.yaml for database initialization - Configure kustomization.yaml for resource management - Define manifest.yaml for Immich app installation details - Create namespace.yaml for isolating Immich resources - Establish PVCs in pvc.yaml for storage management - Set up services in service.yaml for server and machine learning components - Update CoreDNS custom config to handle AAAA records
This commit is contained in:
62
apps/immich/init/db-init-job.yaml
Normal file
62
apps/immich/init/db-init-job.yaml
Normal file
@@ -0,0 +1,62 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: immich-db-init
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: db-init
|
||||
image: postgres:15
|
||||
command: ["/bin/bash", "-c"]
|
||||
args:
|
||||
- |
|
||||
PGPASSWORD=${POSTGRES_ADMIN_PASSWORD} psql -h ${DB_HOSTNAME} -U postgres <<EOF
|
||||
DO \$\$
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = '${DB_USERNAME}') THEN
|
||||
CREATE USER ${DB_USERNAME} WITH ENCRYPTED PASSWORD '${DB_PASSWORD}';
|
||||
ELSE
|
||||
ALTER USER ${DB_USERNAME} WITH ENCRYPTED PASSWORD '${DB_PASSWORD}';
|
||||
END IF;
|
||||
END
|
||||
\$\$;
|
||||
|
||||
SELECT 'CREATE DATABASE ${DB_DATABASE_NAME}' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '${DB_DATABASE_NAME}')\gexec
|
||||
ALTER DATABASE ${DB_DATABASE_NAME} OWNER TO ${DB_USERNAME};
|
||||
GRANT ALL PRIVILEGES ON DATABASE ${DB_DATABASE_NAME} TO ${DB_USERNAME};
|
||||
EOF
|
||||
|
||||
# Connect to the immich database and enable required extensions
|
||||
PGPASSWORD=${POSTGRES_ADMIN_PASSWORD} psql -h ${DB_HOSTNAME} -U postgres -d ${DB_DATABASE_NAME} <<EOF
|
||||
CREATE EXTENSION IF NOT EXISTS vector;
|
||||
CREATE EXTENSION IF NOT EXISTS cube;
|
||||
CREATE EXTENSION IF NOT EXISTS earthdistance;
|
||||
EOF
|
||||
env:
|
||||
- name: POSTGRES_ADMIN_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: secrets
|
||||
key: POSTGRES_ADMIN_PASSWORD
|
||||
- name: DB_HOSTNAME
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: config
|
||||
key: DB_HOSTNAME
|
||||
- name: DB_DATABASE_NAME
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: config
|
||||
key: DB_DATABASE_NAME
|
||||
- name: DB_USERNAME
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: config
|
||||
key: DB_USERNAME
|
||||
- name: DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: secrets
|
||||
key: DB_PASSWORD
|
||||
restartPolicy: OnFailure
|
4
apps/immich/init/kustomization.yaml
Normal file
4
apps/immich/init/kustomization.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- db-init-job.yaml
|
Reference in New Issue
Block a user