diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml deleted file mode 100644 index a59e9d7c..00000000 --- a/.github/workflows/CD.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: CD - -on: - push: - branches: [main] - -jobs: - deploy: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Rust - uses: actions/setup-rust@v1 - with: - rust-version: stable - - # Deploy to AWS EC2 Or another instance diff --git a/docs/deployment-environment-doc.md b/docs/deployment-environment-doc.md new file mode 100644 index 00000000..67e3aa20 --- /dev/null +++ b/docs/deployment-environment-doc.md @@ -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 + ``` + +--- + +## **5. Accessing the Application** +- **Port Forwarding**: + - Steps to forward the service ports locally for testing: + ```bash + kubectl port-forward service/ 8080: + ``` +- **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 -n didcomm-mediator + ``` +- **Monitoring Tools**: + - Mention tools used (e.g., Prometheus, Grafana, ELK Stack). + - Steps to configure and access monitoring dashboards. + diff --git a/docs/environment-setup.md b/docs/environment-setup.md deleted file mode 100644 index d44a4c90..00000000 --- a/docs/environment-setup.md +++ /dev/null @@ -1,47 +0,0 @@ -# DIDComm Mediator Integration Environment Setup - -This guide provides step-by-step instructions to set up the integration environment for deploying, testing, and interacting with the Rust-based DIDComm mediator server. - -## Prerequisites -Before you begin, ensure the following are installed on your system: -- Docker: version 20+([install docker](https://docs.docker.com/engine/install/debian/)) -- Rust: latest stable version ([install rust](https://www.rust-lang.org/tools/install)) -- MongoDB: latest stable version ([install mongodb](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/)) - -This documentation assumes you have clone the [mediator](https://github.com/adorsys/didcomm-mediator-rs) and are in the root of the project - -## step 1: Setup the environment variables -Modify the ```.env``` file with the right values for the variables - -## Step 2: Start The Environment - -```sh - docker-compose up -d -``` -Verify that all containers are running by executing -```sh -docker-compose ps -``` -## Step 3: Test Connectivity -Use a tool like Postman or curl to verify that the server is running and responding. -```sh -curl -X GET http://0.0.0.0:8080/ \ --H "Content-Type: application/json" \ -``` -Expected Response: A JSON object indicating the mediator is operational - -## Step 4: Logging And Monitoring -For real time monitoring of the logs run the command -```sh -docker logs -f didcomm-mediator -``` -Or save them in a file using the command -```sh -docker logs didcommm-mediator > mediator.log -``` - -## Step 5: Cleanup -To Stop and remove the environment -```sh -docker-compose down -``` \ No newline at end of file diff --git a/mediator-charts/templates/env-configmap.yaml b/mediator-charts/templates/env-configmap.yaml index f8456a29..fffe7876 100644 --- a/mediator-charts/templates/env-configmap.yaml +++ b/mediator-charts/templates/env-configmap.yaml @@ -1,12 +1,13 @@ apiVersion: v1 data: - MONGO_DBN: mediator-coordination - MONGO_URI: mongodb://mongodb:27017 - SERVER_LOCAL_PORT: "3000" - SERVER_PUBLIC_DOMAIN: http://alice-mediator.com - STORAGE_DIRPATH: crates/generic-server/target/storage + MONGO_DBN: {{ .Values.envConfig.MONGO_DBN }} + MONGO_URI: {{ .Values.envConfig.MONGO_URI }} + SERVER_LOCAL_PORT: {{ .Values.envConfig.SERVER_LOCAL_PORT }} + SERVER_PUBLIC_DOMAIN: {{ .Values.envConfig.SERVER_PUBLIC_DOMAIN }} + kind: ConfigMap metadata: + namespace: {{ .Values.namespace }} creationTimestamp: null labels: io.kompose.service: mediator-env diff --git a/mediator-charts/templates/ingress.yaml b/mediator-charts/templates/ingress.yaml index 215fcf12..06f1ec14 100644 --- a/mediator-charts/templates/ingress.yaml +++ b/mediator-charts/templates/ingress.yaml @@ -2,7 +2,7 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: didcomm-mediator-ingress - namespace: default + namespace: {{ .Values.namespace }} annotations: nginx.ingress.kubernetes.io/rewrite-target: "/" # Rewrite paths if necessary spec: diff --git a/mediator-charts/templates/mediator-deployment.yaml b/mediator-charts/templates/mediator-deployment.yaml index 7b2d3edb..1ac64b2f 100644 --- a/mediator-charts/templates/mediator-deployment.yaml +++ b/mediator-charts/templates/mediator-deployment.yaml @@ -2,6 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ .Release.Name }}-mediator-deployment + namespace: {{ .Values.namespace }} spec: replicas: {{ .Values.replicaCount }} selector: @@ -27,7 +28,7 @@ spec: - name: MONGO_PASSWORD valueFrom: secretKeyRef: - name: {{ .Release.Name }}-mongo-password + name: {{ .Release.Name }}-secret key: password - name: MONGO_HOST value: {{ .Release.Name }}-mongodb-service diff --git a/mediator-charts/templates/mediator-service.yaml b/mediator-charts/templates/mediator-service.yaml index 3631b565..7b5f4fab 100644 --- a/mediator-charts/templates/mediator-service.yaml +++ b/mediator-charts/templates/mediator-service.yaml @@ -2,6 +2,7 @@ apiVersion: v1 kind: Service metadata: name: {{ .Release.Name }}-mediator-service + namespace: {{ .Values.namespace }} spec: selector: app: {{ .Release.Name }}-mediator diff --git a/mediator-charts/templates/mongodb-deployment.yaml b/mediator-charts/templates/mongodb-deployment.yaml index 3d0e755b..8c295769 100644 --- a/mediator-charts/templates/mongodb-deployment.yaml +++ b/mediator-charts/templates/mongodb-deployment.yaml @@ -2,6 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ .Release.Name }}-mongodb-deployment + namespace: {{ .Values.namespace }} spec: replicas: 1 selector: @@ -27,7 +28,7 @@ spec: - name: MONGO_PASSWORD valueFrom: secretKeyRef: - name: {{ .Release.Name }}-mongo-password + name: {{ .Release.Name }}-secret key: password volumeMounts: - name: {{ .Release.Name }}-mongo-persistent-storage diff --git a/mediator-charts/templates/mongodb-pv.yaml b/mediator-charts/templates/mongodb-pv.yaml index b76f9bb6..3472270e 100644 --- a/mediator-charts/templates/mongodb-pv.yaml +++ b/mediator-charts/templates/mongodb-pv.yaml @@ -2,6 +2,7 @@ apiVersion: v1 kind: PersistentVolume metadata: name: {{ .Release.Name }}-mongo-pv + namespace: {{ .Values.namespace }} spec: capacity: storage: {{ .Values.mongoVolume.persistentVolume.storageSize }} diff --git a/mediator-charts/templates/mongodb-pvc.yaml b/mediator-charts/templates/mongodb-pvc.yaml index 83fbdcb9..9a4034e7 100644 --- a/mediator-charts/templates/mongodb-pvc.yaml +++ b/mediator-charts/templates/mongodb-pvc.yaml @@ -2,6 +2,7 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: name: {{ .Release.Name }}-mongo-pvc + namespace: {{ .Values.namespace }} spec: accessModes: - ReadWriteOnce diff --git a/mediator-charts/templates/mongodb-service.yaml b/mediator-charts/templates/mongodb-service.yaml index de934932..2e5a72b8 100644 --- a/mediator-charts/templates/mongodb-service.yaml +++ b/mediator-charts/templates/mongodb-service.yaml @@ -2,6 +2,7 @@ apiVersion: v1 kind: Service metadata: name: {{ .Release.Name }}-mongodb-service + namespace: {{ .Values.namespace }} spec: selector: app: {{ .Release.Name }}-mongodb diff --git a/mediator-charts/templates/secrets.yaml b/mediator-charts/templates/secrets.yaml index 75e5c5c8..1fd01f05 100644 --- a/mediator-charts/templates/secrets.yaml +++ b/mediator-charts/templates/secrets.yaml @@ -1,15 +1,8 @@ apiVersion: v1 kind: Secret metadata: - name: {{ .Release.Name }}-mongo-username + name: {{ .Release.Name }}-secret + namespace: {{ .Values.namespace }} type: Opaque stringData: - username: root - -apiVersion: v1 -kind: Secret -metadata: - name: {{ .Release.Name }}-mongo-password -type: Opaque -stringData: - password: root \ No newline at end of file + password: root diff --git a/mediator-charts/values.yaml b/mediator-charts/values.yaml index 4ad1d13b..4c024b26 100644 --- a/mediator-charts/values.yaml +++ b/mediator-charts/values.yaml @@ -1,4 +1,5 @@ replicaCount: 1 +namespace: didcomm-mediator mongodb: databaseName: mongodb @@ -18,4 +19,10 @@ mongoVolume: pathOnHost: /var/lib/mongodb - mountPath: /var/lib/mongodb \ No newline at end of file + mountPath: /var/lib/mongodb + +envConfig: + MONGO_DBN: mediator-coordination + MONGO_URI: mongodb://mongodb:27017 + SERVER_LOCAL_PORT: "3000" + SERVER_PUBLIC_DOMAIN: http://alice-mediator.com \ No newline at end of file