diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index e524f2fa..485a2759 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -19,6 +19,30 @@ env: jobs: + helm: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Find latest tag + uses: oprypin/find-latest-tag@v1 + id: latest-tag + with: + repository: ${{ github.repository }} + regex: '^[0-9]+.[0-9]+.[0-9]+$' + releases-only: false + + - name: Package Helm chart + run: helm package ./charts/openshock/ --app-version ${{ steps.latest-tag.outputs.tag }} + + - name: Helm registry login + run: echo ${{ github.token }} | helm registry login $REGISTRY/${{ github.actor }} --username ${{ github.actor }} --password-stdin + + - name: Push Helm chart + run: helm push ./openshock-0.1.0.tgz oci://$REGISTRY/${{ github.actor }} + build: runs-on: ubuntu-latest @@ -146,7 +170,7 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} platforms: linux/amd64,linux/arm64 - + deploy-production: runs-on: ubuntu-latest needs: containerize diff --git a/README.md b/README.md index 89428469..0e84ffd2 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,135 @@ Run with `docker compose up -d` You could also bring your own reverse proxy. You would need to remove traefik from the `docker-compose.yml` and route the traffic in your reverse proxy. +## Using Kubernetes and Helm +Kubernetes and Helm are very powerful and well liked but they are not beginner friendly. Use docker compose if you want something easy. + +Openshock has some dependencies. It's not Openshock's place to tell you how to install them. +Dependencies are: +- A Postgres database. This is used for storing user data including passwords. The Openshock API needs a connection string. +- A Redis cluster. This is used for storing session data and as a messaging bus. It needs ReJson, RediSearch + and an extra argument: "--notify-keyspace-events KEA" +
+ Example Redis + Here is a very basic but not necessarily good deployment of Redis that works. + + ```yaml + apiVersion: apps/v1 + kind: Deployment + metadata: + name: redis + spec: + replicas: 1 + selector: + matchLabels: + app: redis + template: + metadata: + labels: + app: redis + spec: + containers: + - name: redis + image: redis/redis-stack + env: + - name: REDIS_ARGS + value: '--notify-keyspace-events KEA' + ports: + - name: redis + containerPort: 6379 + protocol: TCP + --- + apiVersion: v1 + kind: Service + metadata: + name: redis + spec: + type: ClusterIP + ports: + - port: 6379 + targetPort: redis + protocol: TCP + name: redis + selector: + app: redis + ``` + +
+ +Steps: +1. Create a Kubernetes Secret containing the database connection string: + ```sh + kubectl create secret generic openshock --from-literal=databaseConnection='Host=10.0.0.5;Port=5432;Database=openshock;Username=openshock;Password=password123' + ``` + Also include any other secrets you may want to use in the deployment. Such as a Redis password and mail credentials. See [values.yaml](./charts/openshock/values.yaml) for more. +1. Create a yaml file for your Helm values. See [values.yaml](./charts/openshock/values.yaml) for details. +
+ Example values.yaml + + ```yaml + appConfig: + database: + connectionSecretName: openshock + connectionSecretKey: databaseConnection + redis: + host: redis + frontend: + name: MyOpenshock + baseUrl: https://myopenshock.com + shortUrl: https://myopenshock.com + cookieDomain: myopenshock.com + apiUrl: https://api.myopenshock.com + liveControllerGateway: + countryCode: NZ + fcdn: lcg.myopenshock.com + + api: + ingress: + enabled: true + hosts: + - host: api.myopenshock.com + paths: + - path: / + pathType: Prefix + tls: + - secretName: openshock-api-tls + hosts: + - api.myopenshock.com + + liveControllerGateway: + ingress: + enabled: true + hosts: + - host: lcg.myopenshock.com + paths: + - path: / + pathType: Prefix + tls: + - secretName: openshock-lcg-tls + hosts: + - lcg.myopenshock.com + + webUi: + enabled: true + ingress: + enabled: true + hosts: + - host: myopenshock.com + paths: + - path: / + pathType: Prefix + tls: + - secretName: openshock-webui-tls + hosts: + - myopenshock.com + ``` +
+ +1. Create a Helm release: + ```sh + helm upgrade --install openshock oci://ghcr.io/OpenShock/openshock -f values.yaml + ``` + ## Support development! You can support the OpenShock Dev Team here: [Sponsor OpenShock](https://github.com/sponsors/OpenShock)