CodeScoring.Save PostgreSQL Installation

PostgreSQL installation is intended for production use, larger teams, availability requirements, scaling, and performance requirements.

Preparing Infrastructure

PostgreSQL

By default, PostgreSQL is deployed as a Helm chart dependency. To use it, enable postgres.enabled=true in values.yaml and set connection parameters:

postgres:
  enabled: true
  fullnameOverride: postgres
  auth:
    database: save_db
    username: save_user
    password: <STRONG_PASSWORD>

When built-in PostgreSQL is used, backend and auth must connect to host postgres.

For external PostgreSQL, disable the built-in dependency:

postgres:
  enabled: false

Then set the external PostgreSQL host in envs.DATABASE_HOST.

Prepare the database and user in external PostgreSQL:

CREATE DATABASE save_db;
CREATE USER save_user WITH PASSWORD '<STRONG_PASSWORD>';
GRANT ALL PRIVILEGES ON DATABASE save_db TO save_user;

Object Storage

By default, MinIO is deployed as a Helm chart dependency. To use it, enable minio.enabled=true in values.yaml. The service will be available as save-minio.

minio:
  enabled: true
  fullnameOverride: save-minio
  auth:
    rootUser: <ACCESS_KEY>
    rootPassword: <SECRET_KEY>
  provisioning:
    enabled: true
    buckets:
      - save

For a stateful installation, enable persistence for PostgreSQL and MinIO:

postgres:
  persistence:
    enabled: true
    storageClassName: default
    mountPath: /var/lib/postgresql/data
    size: 5Gi

minio:
  persistence:
    enabled: true
    storageClassName: default
    mountPath: /data
    size: 20Gi

The common pvcs block must not be used for PostgreSQL and MinIO in the provided chart. If postgres.persistence.enabled or minio.persistence.enabled is disabled, the corresponding service data is not preserved after Pod recreation.

For built-in MinIO, use endpoint http://save-minio:9000 in envs. The minio.provisioning section creates the bucket during chart installation, so S3_BUCKET must match one of the values from minio.provisioning.buckets.

For external S3-compatible storage, disable built-in MinIO:

minio:
  enabled: false

Then set S3_ENDPOINT, S3_BUCKET, S3_ACCESS_KEY, and S3_SECRET_KEY in envs.

CodeScoring.Save Configuration

Use the base values.yaml from the chart and change the required parameters.

For built-in PostgreSQL and MinIO, use these values:

image:
  registry: <REGISTRY_HOST>
  tag: <SAVE_VERSION>
  pullSecrets:
    - name: codescoring-pvt-regcred

envs:
  DATABASE_DRIVER: postgres
  DATABASE_HOST: postgres
  DATABASE_PORT: "5432"
  DATABASE_NAME: save_db
  DATABASE_USER: save_user
  DATABASE_PASSWORD: <STRONG_PASSWORD>

  STORAGE_TYPE: s3
  S3_ENDPOINT: http://save-minio:9000
  S3_BUCKET: save
  S3_ACCESS_KEY: <ACCESS_KEY>
  S3_SECRET_KEY: <SECRET_KEY>

  AUTH_SERVICE_URL: http://cs-auth.example.com:9100
  AUTH_JWKS_URL: http://cs-auth.example.com:9100/internal/v1/jwks
  AUTH_ADMIN_PASSWORD: <STRONG_PASSWORD>
  AUTH_INTERNAL_SECRET: <STRONG_SECRET>

configMaps:
  envs:
    enabled: true

deploymentsGeneral:
  envConfigmaps:
    - envs

postgres:
  enabled: true
  fullnameOverride: postgres
  auth:
    database: save_db
    username: save_user
    password: <STRONG_PASSWORD>
  persistence:
    enabled: true
    storageClassName: default
    mountPath: /var/lib/postgresql/data
    size: 5Gi

minio:
  enabled: true
  fullnameOverride: save-minio
  auth:
    rootUser: <ACCESS_KEY>
    rootPassword: <SECRET_KEY>
  provisioning:
    enabled: true
    buckets:
      - save
  persistence:
    enabled: true
    storageClassName: default
    mountPath: /data
    size: 20Gi

The AUTH_INTERNAL_SECRET value is used for internal interaction between Save services. The minio.provisioning section creates the bucket for built-in MinIO, and S3_BUCKET must match one of the values from minio.provisioning.buckets.

The values of DATABASE_PASSWORD, S3_ACCESS_KEY, and S3_SECRET_KEY, as well as the postgres.auth.password and minio.auth parameters, must match the corresponding values specified in the Helm chart.

Additional Argo CD Configuration

When deploying via Argo CD, add the following parameters to the configuration file:

minio:
  enabled: true
  fullnameOverride: save-minio

annotations:
  minioResources:
    argocd.argoproj.io/sync-wave: "-2"
  provisioningJob:
    argocd.argoproj.io/sync-wave: "-1"

Installation

helm install codescoring-save codescoring/save \
  --namespace codescoring-save \
  --create-namespace \
  --values values.yaml

Installation Check

# Check pod status
kubectl get pods -n codescoring-save -w

# Check all resources
kubectl get all -n codescoring-save

# Check backend logs
kubectl logs -n codescoring-save -l app=backend --tail=100

# Check auth logs
kubectl logs -n codescoring-save -l app=auth --tail=100

# Check frontend logs
kubectl logs -n codescoring-save -l app=frontend --tail=100

# Check readiness
kubectl get pods -n codescoring-save -o wide

Next Steps

After installation:

  1. Create the first repository
  2. Configure cleanup policies
  3. Create users and assign roles
Was this page helpful?