Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added helm chart release to build pipeline and docs on how to use it #111

Draft
wants to merge 7 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
129 changes: 129 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
<details>
<summary>Example Redis</summary>
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
```

</details>

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.
<details>
<summary>Example values.yaml</summary>

```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
```
</details>

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)
Loading