Skip to content

Commit

Permalink
Merge pull request #82 from OneLiteFeatherNET/feat/deployment-verific…
Browse files Browse the repository at this point in the history
…ation

Feat/deployment verification
  • Loading branch information
Randoooom authored Jul 9, 2024
2 parents 5ea31c3 + f5a004b commit a05a573
Show file tree
Hide file tree
Showing 17 changed files with 207 additions and 49 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ lib/
target/
common/target/
codegen/target/
tests/
docs/
Makefile.toml
23 changes: 23 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,29 @@ jobs:
push: true
tags: ghcr.io/onelitefeathernet/feedback-fusion:nightly

integration:
needs: [docker]
name: dockerize integration test
runs-on: ubuntu-latest
steps:
- name: Checkout Sources
uses: actions/checkout@v4

- name: Login into repository
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
dockerfile: tests/integration/Dockerfile
tags: ghcr.io/onelitefeathernet/feedback-fusion-integration:nightly

docs:
needs: [docker]
name: docs
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,29 @@ jobs:
push: true
tags: ghcr.io/onelitefeathernet/feedback-fusion:${{env.VERSION}},ghcr.io/onelitefeathernet/feedback-fusion:latest

integration:
needs: [docker]
name: dockerize integration test
runs-on: ubuntu-latest
steps:
- name: Checkout Sources
uses: actions/checkout@v4

- name: Login into repository
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
dockerfile: tests/integration/Dockerfile
tags: ghcr.io/onelitefeathernet/feedback-fusion-integration:${{env.VERSION}},ghcr.io/onelitefeathernet/feedback-fusion-integration:latest

docs:
needs: [docker]
name: docs
Expand Down
28 changes: 27 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "feedback-fusion"
version = "0.1.3"
version = "0.1.4"
edition = "2021"
license = "MIT"

Expand All @@ -24,12 +24,12 @@ kanal = "0.1.0-pre8"
lazy_static = "1.4.0"
log = "0.4.22"
nanoid = "0.4.0"
notify = { version = "6.1.1", default-features = false, features = [
"macos_kqueue",
] }
notify = "6.1.1"
openidconnect = "3.5.0"
opentelemetry = { version = "0.23.0", optional = true }
opentelemetry_sdk = { version = "0.23.0", optional = true, features = ["rt-tokio"] }
opentelemetry_sdk = { version = "0.23.0", optional = true, features = [
"rt-tokio",
] }
opentelemetry-otlp = { version = "0.16.0", optional = true }
opentelemetry-semantic-conventions = { version = "0.15.0", optional = true }
opentelemetry-http = { version = "0.12.0", optional = true }
Expand Down Expand Up @@ -61,6 +61,7 @@ validator = { version = "0.18", features = ["derive"] }
version-compare = "0.2.0"

[dev-dependencies]
lazy_static = "1.4.0"
paste = "1.0.14"
rand = "0.8.5"
reqwest = { version = "0.12.3", features = ["json"] }
Expand All @@ -74,8 +75,8 @@ otlp = [
"opentelemetry-otlp",
"opentelemetry-semantic-conventions",
"opentelemetry_sdk",
"opentelemetry-http",
"tracing-opentelemetry"
"opentelemetry-http",
"tracing-opentelemetry",
]
all-databases = ["postgres", "mysql", "mssql"]
postgres = ["rbdc-pg"]
Expand Down
2 changes: 1 addition & 1 deletion Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ dependencies = ["docker_network"]
script = "docker compose -f tests/_common/oidc-mock/docker-compose.yaml up -d && sleep 5 && curl -s -o /dev/null http://localhost:5151/.well-known/openid-configuration"

[tasks.integration_test]
env = { OIDC_PROVIDER = "http://localhost:5151", OIDC_CLIENT_ID = "client", OIDC_CLIENT_SECRET = "secret", RUST_LOG = "INFO" }
env = { OIDC_PROVIDER = "http://localhost:5151", OIDC_CLIENT_ID = "client", OIDC_CLIENT_SECRET = "secret", RUST_LOG = "INFO", GRPC_ENDPOINT = "http://localhost:8000" }
command = "cargo"
args = ["test", "--no-fail-fast", "--test", "integration_test"]

Expand Down
4 changes: 0 additions & 4 deletions build.rs

This file was deleted.

4 changes: 2 additions & 2 deletions charts/feedback-fusion/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.5
version: 0.1.6

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.1.3"
appVersion: "0.1.4"
16 changes: 16 additions & 0 deletions charts/feedback-fusion/templates/tests/integration-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "feedback-fusion.fullname" . }}-integration-tests"
labels:
{{- include "feedback-fusion.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: integration-tests
image: "{{ .Values.image.testRepository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
envFrom:
- secretRef:
name: {{ .Values.feedbackFusion.testSecret }}
restartPolicy: Never
11 changes: 7 additions & 4 deletions charts/feedback-fusion/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ replicaCount: 1

image:
repository: ghcr.io/onelitefeathernet/feedback-fusion
testRepository: ghcr.io/onelitefeathernet/feedback-fusion-integration
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
Expand Down Expand Up @@ -45,10 +46,10 @@ ingress:
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
# - host: chart-example.local
# paths:
# - path: /
# pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
Expand Down Expand Up @@ -139,4 +140,6 @@ feedbackFusion:
# MSSQL_DATABASE: ""
# MSSQL_ENCRYPT: true
# MSSQL_TRUST_SERVER_CERTIFICATE: true

testSecret: feedback-fusion-integration-test

3 changes: 1 addition & 2 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ export default defineConfig({
{
text: "Deployment", items: [
{ text: "Helm", link: "/docs/deployment/helm" },
{ text: "Docker", link: "/docs/deployment/docker" },
{ text: "Verify deployment", link: "/docs/deployment/verify" }
{ text: "Docker", link: "/docs/deployment/docker" }
]
},
{
Expand Down
29 changes: 29 additions & 0 deletions docs/docs/deployment/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,32 @@ Afterwards start the application:
```sh
docker compose up -d
```

## Verifying Deployment

To verify your deployment you can now run the dockerized integration tests using `ghcr.io/onelitefeathernet/feedback-fusion-integrtion:<version>`.
The image requires the following environment variables to be set:

| Key | Description |
|-----------------|-----------------------------------------------------|
| OIDC_PROVIDER | URL of the OIDC provider |
| OIDC_CLIENT_ID | The client ID |
| OIDC_CLIENT_SECRET | The client secret |
| GRPC_ENDPOINT | The endpoint of the deployed application |

### Run the tests

```sh
docker run --network <network> \
-e OIDC_PROVIDER=<oidc_provider> \
-e OIDC_CLIENT_ID=<oidc_client_id> \
-e OIDC_CLIENT_SECRET=<oidc_client_secret> \
-e GRPC_ENDPOINT=<grpc_endpoint>
--name feedback-fusion-integration-test \
--rm \
ghcr.io/onelitefeathernet/feedback-fusion-integrtion:<version>
```

### On finish

You should now reset your database as the integration test does not delete everything it created.
36 changes: 36 additions & 0 deletions docs/docs/deployment/helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Refer to the [configuration documentation](/docs/configuration) for the fields t
| `feedbackFusion.preset.create` | Create preset configuration | `false` |
| `feedbackFusion.preset.data` | Preset data | `{}` [Preset configuration](/docs/configuration#presets) |
| `feedbackFusion.config.secret` | Name of the secret containing configuration | `feedback-fusion-config` |
| `feedbackFusion.testSecret` | Name of the secret containing configuration for the integration test | `feedback-fusion-integration-test` |

## Install

Expand All @@ -68,3 +69,38 @@ helm install feedback-fusion feedback-fusion/feedback-fusion --wait --atomic
```

Your instance should now be up and running :)

## Verifying Deployment with Helm Test

To verify the deployment of the Helm chart, you can use the `helm test` command. However, before running the test, a secret must be created with the name `feedback-fusion-integration-test`. Alternatively, the name of another secret can be set via the Helm value `feedbackFusion.testSecret`.

The secret should contain the following values:

| Key | Description |
|-----------------|-----------------------------------------------------|
| OIDC_PROVIDER | URL of the OIDC provider |
| OIDC_CLIENT_ID | The client ID |
| OIDC_CLIENT_SECRET | The client secret |
| GRPC_ENDPOINT | The endpoint of the deployed application |

### Creating the Secret

To create the secret, you can use the following `kubectl` command:

```sh
kubectl create -n <namespace> secret generic feedback-fusion-integration-test \
--from-literal=OIDC_PROVIDER=<oidc_provider_url> \
--from-literal=OIDC_CLIENT_ID=<client_id> \
--from-literal=OIDC_CLIENT_SECRET=<client_secret> \
--from-literal=GRPC_ENDPOINT=<grpc_endpoint>
```

### Run the tests

```sh
helm test -n <namespace> <release>
```

### On finish

You should now reset your database as the integration test does not delete everything it created.
20 changes: 0 additions & 20 deletions docs/docs/deployment/verify.md

This file was deleted.

Loading

0 comments on commit a05a573

Please sign in to comment.