-
Notifications
You must be signed in to change notification settings - Fork 0
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
256 integrate health checks and monitoring for the server e5 #297
base: main
Are you sure you want to change the base?
Changes from all commits
2b0ad66
c0126bf
9e812b1
8f790a3
85dd48a
db689f6
ed3b710
fccc753
a2c90bd
1c49cf5
1b70cc0
c751d42
a5fa134
82df5ae
805f954
ac3f894
1ef2f73
605bfd5
0a62147
6d4dd79
10d9a79
a0e12ff
8fa870c
6b85b63
9642d2e
22a7e5f
12927bd
420e1c0
7a68793
165516d
6fc8251
5f9bf20
4d5998e
93db614
d507fa6
426a1a7
7a35312
a2425c8
0085807
26997ea
abbe3b0
3870bf0
1b22c59
355563f
723c8ae
99ec932
b0060b0
d93060b
b1b8bfe
228f25b
b1102d3
f90bb1f
ed412d2
0e59816
d52b96f
a8a11e0
6873ec2
f299970
c46820c
c74694e
13f6426
3b37136
6185c24
e7649d1
1e437d3
5ccf180
b46f9d0
74e898e
8c0f026
2f2ce80
3699500
703dcea
bf9d12b
624e8da
1d64f67
96f19c8
2cfc7d0
9360723
c6c0add
50549d1
2d5eba8
12b4b89
12a68a4
ffb6d6b
35f7968
87e2b76
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
target/ | ||
**/target/ | ||
.idea/ | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SERVER_PUBLIC_DOMAIN="http://didcomm-mediator.com" | ||
SERVER_LOCAL_PORT="8080" | ||
STORAGE_DIRPATH="crates/generic-server/target/storage" | ||
MONGO_DBN="mediator-coordination" | ||
MONGO_URI="mongodb://mongodb:27017" | ||
Comment on lines
+1
to
+5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do not push this too |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Publish Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
tags: | ||
- 'v*' | ||
|
||
env: | ||
IMAGE_NAME: didcomm-mediator-rs | ||
|
||
jobs: | ||
push: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build image | ||
run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" | ||
|
||
- name: Log in to registry | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
|
||
- name: Push image | ||
run: | | ||
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | ||
|
||
# Ensure all uppercase characters are converted to lowercase | ||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | ||
# Strip the git ref prefix from the version | ||
Comment on lines
+1
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this file |
||
VERSION=latest | ||
# Remove the "v" prefix from the tag name | ||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | ||
# Use "latest" tag for the main branch | ||
[ "$VERSION" == "main" ] && VERSION=latest | ||
echo IMAGE_ID=$IMAGE_ID | ||
echo VERSION=$VERSION | ||
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | ||
docker push $IMAGE_ID:$VERSION |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ Cargo.lock | |
|
||
# Environment variables files | ||
.env.example | ||
.env | ||
|
||
|
||
# Reference crate | ||
mediator-server | ||
Comment on lines
27
to
33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also remove this file |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM rust:latest as builder | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
# Build the server | ||
RUN cargo build --release | ||
|
||
# Use a minimal image for running the server | ||
FROM ubuntu | ||
|
||
RUN apt update && apt install -y libpq5 && rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /app | ||
|
||
# Set the storage directory path | ||
ENV STORAGE_DIRPATH="crates/generic-server/target/storage" | ||
|
||
# Install dependencies for Prometheus metrics | ||
RUN apt-get update && apt-get install -y curl | ||
|
||
# Copy the built binary | ||
COPY --from=builder /app/target/release/didcomm-mediator /usr/local/bin/didcomm-mediator | ||
|
||
COPY .env .env | ||
|
||
# Expose the necessary port | ||
EXPOSE 3000 9100 | ||
|
||
# Set an entrypoint script to handle the environment file | ||
ENTRYPOINT ["didcomm-mediator"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
version: "3.8" | ||
|
||
services: | ||
mediator: | ||
build: | ||
context: . | ||
container_name: didcomm-mediator | ||
ports: | ||
- "8080:8080" | ||
env_file: | ||
- .env | ||
environment: | ||
- MONGODB_URI=mongodb://mongodb:27019/your_database_name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not read the MONGO_URI from the env file |
||
depends_on: | ||
- mongodb | ||
- prometheus | ||
- grafana | ||
networks: | ||
- mediator-network | ||
healthcheck: | ||
test: ["CMD", "curl", "-f", "http://localhost:8080/health"] | ||
interval: 30s | ||
timeout: 10s | ||
retries: 3 | ||
|
||
mongodb: | ||
image: mongo:latest | ||
container_name: mongodb | ||
env_file: | ||
- .env | ||
volumes: | ||
- mongo-data:/data/db | ||
networks: | ||
- mediator-network | ||
ports: | ||
- "27019:27019" | ||
|
||
prometheus: | ||
image: prom/prometheus:latest | ||
container_name: prometheus | ||
ports: | ||
- "9091:9090" | ||
command: --config.file=/etc/prometheus/prometheus.yml | ||
volumes: | ||
- ./prometheus.yml:/etc/prometheus/prometheus.yml | ||
- prometheus-data:/prometheus | ||
networks: | ||
- mediator-network | ||
restart: unless-stopped | ||
|
||
grafana: | ||
image: grafana/grafana:latest | ||
container_name: grafana | ||
ports: | ||
- "3001:3000" | ||
depends_on: | ||
- prometheus | ||
environment: | ||
- GF_SECURITY_ADMIN_USER=admin | ||
- GF_SECURITY_ADMIN_PASSWORD | ||
volumes: | ||
- grafana-data:/var/lib/grafana | ||
- ./datasources.yml:/etc/grafana/provisioning/datasources/datasources.yml | ||
- ./dashboards.yml:/etc/grafana/provisioning/dashboards/dashboards.yml | ||
networks: | ||
- mediator-network | ||
restart: unless-stopped | ||
|
||
node-exporter: | ||
image: prom/node-exporter:latest | ||
container_name: node-exporter | ||
ports: | ||
- "9100:9100" | ||
networks: | ||
- mediator-network | ||
volumes: | ||
- /proc:/host/proc:ro | ||
- /sys:/host/sys:ro | ||
- /:/rootfs:ro | ||
command: | ||
- '--path.procfs=/host/proc' | ||
- '--path.sysfs=/host/sys' | ||
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)' | ||
|
||
networks: | ||
mediator-network: | ||
driver: bridge | ||
|
||
volumes: | ||
mongo-data: | ||
prometheus-data: | ||
grafana-data: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
|
||
# **Application Deployment Documentation** | ||
|
||
## **1. Prerequisites** | ||
- **Tools and Software Required**: | ||
- Helm version (e.g., `Helm 3.x`) | ||
- Kubernetes version (e.g., `1.25+`) | ||
- Minikube/Cluster setup | ||
- Other dependencies (e.g., Docker, kubectl, etc.) | ||
- **Environment Setup**: | ||
- Access to the Kubernetes cluster | ||
- Required configurations or credentials | ||
|
||
|
||
## **3. Helm Chart Structure** | ||
- **Chart Overview**: | ||
- Structure of the Helm chart (values.yaml, templates, etc.). | ||
- Purpose of critical templates (e.g., Deployment, Service, ConfigMap). | ||
- Default vs. custom configurations. | ||
- **Customization**: | ||
- How to override values.yaml using custom configurations. | ||
Example: | ||
```bash | ||
helm install mediator ./mediator-charts --values custom-values.yaml | ||
``` | ||
- mandatory values are; | ||
|
||
**MONGO_DBN**, | ||
**MONGO_URI**, | ||
**SERVER_LOCAL_PORT** and | ||
**SERVER_PUBLIC_DOMAIN** | ||
|
||
|
||
## **4. Deployment Guide** | ||
- **Steps to Deploy**: | ||
1. Clone the repository: | ||
```bash | ||
git clone https://github.com/adorsys/didcomm-mediator-rs.git | ||
``` | ||
2. Install dependencies: | ||
```bash | ||
helm dependency update mediator-charts | ||
``` | ||
3. Deploy using Helm: | ||
```bash | ||
helm install mediator mediator-charts --namespace didcomm-mediator | ||
``` | ||
4. Verify deployment status: | ||
```bash | ||
kubectl get pods -n didcomm-mediator | ||
kubectl get services -n didcomm-mediator | ||
``` | ||
- **Notes on Namespaces**: | ||
- Importance of creating and using the correct namespace. | ||
- **Rollback Instructions**: | ||
- How to roll back to a previous release: | ||
```bash | ||
helm rollback my-app <revision> | ||
``` | ||
|
||
--- | ||
|
||
## **5. Accessing the Application** | ||
- **Port Forwarding**: | ||
- Steps to forward the service ports locally for testing: | ||
```bash | ||
kubectl port-forward service/<service-name> 8080:<target-port> | ||
``` | ||
- **Ingress/LoadBalancer Details**: | ||
- Steps to access the application if exposed via Ingress or LoadBalancer. | ||
|
||
## **7. Monitoring and Debugging** | ||
- **Logs**: | ||
- How to fetch logs for debugging: | ||
```bash | ||
kubectl logs <pod-name> -n didcomm-mediator | ||
``` | ||
- **Monitoring Tools**: | ||
- Mention tools used (e.g., Prometheus, Grafana, ELK Stack). | ||
- Steps to configure and access monitoring dashboards. | ||
Comment on lines
+1
to
+80
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This changes are not related to the isssue |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: v2 | ||
name: mediator-charts | ||
description: A Helm chart for Kubernetes | ||
|
||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
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.0 | ||
|
||
# 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.9" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: v1 | ||
data: | ||
MONGO_DBN: mediatorDB | ||
MONGO_URI: mongodb://mongodb:27017 | ||
SERVER_LOCAL_PORT: "3000" | ||
SERVER_PUBLIC_DOMAIN: http://alice-mediator.com | ||
|
||
kind: ConfigMap | ||
metadata: | ||
namespace: {{ .Values.namespace }} | ||
creationTimestamp: null | ||
labels: | ||
io.kompose.service: mediator-env | ||
name: env | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not push this file