-
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
245 integration environment for didcomm mediator server deployment e6 #264
Closed
Christiantyemele
wants to merge
38
commits into
main
from
245-integration-environment-for-didcomm-mediator-server-deployment-e6
Closed
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
2b0ad66
feat(): init mediator integration environment setup
Christiantyemele c0126bf
feat(): polish intergration evironment
Christiantyemele 9e812b1
Merge branch 'main' of https://github.com/adorsys/didcomm-mediator-rs…
Christiantyemele 8f790a3
fix(): fix on reviews
Christiantyemele 85dd48a
update(intergration environment): added more description to doc
Christiantyemele ed3b710
Merge branch 'main' of https://github.com/adorsys/didcomm-mediator-rs…
Christiantyemele fccc753
merged main into intergration environment
Christiantyemele 1b70cc0
feat(): init kubernetes setup
Christiantyemele 805f954
feat(): Polish k8s integration environment
Christiantyemele 1ef2f73
fix(): moved k8s folder
Christiantyemele 605bfd5
feat(): publishing docker containers to ghcr with action
Christiantyemele 0a62147
feat(): added workflow file for ghcr
Christiantyemele 6d4dd79
update yml
Christiantyemele 10d9a79
update(release): updated release with compose
Christiantyemele a0e12ff
update release.yml
Christiantyemele 8fa870c
feat(): updated workflow
Christiantyemele 6b85b63
update changed pcakage version version
Christiantyemele 9642d2e
update workflow verification
Christiantyemele 22a7e5f
feat(package): update config
Christiantyemele 12927bd
updated pacakage
Christiantyemele 420e1c0
fix(package): typos fix
Christiantyemele 7a68793
fix(package): correcting yaml
Christiantyemele 165516d
fix(): typos fix
Christiantyemele 6fc8251
fix(): added path env for compose
Christiantyemele 5f9bf20
fix(): removed env form .gitignore
Christiantyemele 4d5998e
fix(): updated compose
Christiantyemele 93db614
fix(package): fixing mediator package
Christiantyemele d507fa6
fix(package): added env path
Christiantyemele 426a1a7
fix(package): changed branch for action
Christiantyemele 7a35312
fix(): update .env
Christiantyemele a2425c8
fix(): debugging yml
Christiantyemele 0085807
fix(): updated yml
Christiantyemele 26997ea
fix(): update yml
Christiantyemele abbe3b0
fix(): handled error when reading env
Christiantyemele 3870bf0
fix(global): updated configs for packaging
Christiantyemele 1b22c59
fix(): update package.yml
Christiantyemele 355563f
updat(): updated package.yml
Christiantyemele 723c8ae
fix(): removed port specification form compose
Christiantyemele File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
target/ | ||
**/target/ | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SERVER_PUBLIC_DOMAIN="http://didcomm-mediator.com" | ||
Christiantyemele marked this conversation as resolved.
Show resolved
Hide resolved
|
||
SERVER_LOCAL_PORT="8080" | ||
STORAGE_DIRPATH="crates/generic-server/target/storage" | ||
Christiantyemele marked this conversation as resolved.
Show resolved
Hide resolved
|
||
MONGO_DBN="mediator-coordination" | ||
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 choose 'mediator-coordination' as the database name? A straightforward name like 'mongodb' might make more sense. |
||
MONGO_URI="mongodb://localhost:27017/" | ||
Christiantyemele marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Create and publish a Docker image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- v* | ||
pull_request: | ||
|
||
env: | ||
IMAGE_NAME: ghcr.io/adorsys/didcomm-mediator-rs | ||
|
||
jobs: | ||
push: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Docker Compose | ||
run: | | ||
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | ||
sudo chmod +x /usr/local/bin/docker-compose | ||
|
||
- name: Log in to GitHub Container Registry | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
|
||
- name: Build Docker image | ||
run: | | ||
echo "Checking for .env file..." | ||
if [ -f .env ]; then | ||
echo ".env file exists." | ||
else | ||
echo ".env file does not exist." | ||
exit 1 | ||
fi | ||
|
||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
[[ "${{ github.ref }}" == "refs/heads/main" ]] && VERSION=latest | ||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | ||
|
||
echo "Building image with version: $VERSION" | ||
docker-compose build | ||
docker tag ${IMAGE_NAME}:latest ${IMAGE_NAME}:${VERSION} | ||
|
||
- name: Push Docker image | ||
run: | | ||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
[[ "${{ github.ref }}" == "refs/heads/main" ]] && VERSION=latest | ||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | ||
|
||
echo "Pushing image ${IMAGE_NAME}:${VERSION}" | ||
docker push ${IMAGE_NAME}:${VERSION} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
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" | ||
|
||
# Copy the built binary | ||
COPY --from=builder /app/target/release/didcomm-mediator /usr/local/bin/didcomm-mediator | ||
|
||
# Copy the default .env file | ||
COPY .env /app/.env | ||
|
||
# Expose the necessary port | ||
EXPOSE 8080 | ||
|
||
# Set an entrypoint script to handle the environment file | ||
ENTRYPOINT ["/bin/sh", "-c", "env $(cat ${ENV_FILE:-/app/.env} | xargs) didcomm-mediator"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
version: "3.8" | ||
services: | ||
mediator: | ||
build: | ||
context: . | ||
container_name: didcomm-mediator | ||
image: ghcr.io/adorsys/didcomm-mediator-rs:latest | ||
ports: | ||
- 3000:8080 | ||
env_file: | ||
- .env | ||
depends_on: | ||
- mongodb | ||
mongodb: | ||
image: mongo:latest | ||
container_name: mongodb | ||
env_file: | ||
- .env | ||
volumes: | ||
- mongo-data:/data/db | ||
volumes: | ||
mongo-data: null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# 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 | ||
Christiantyemele marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
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" \ | ||
``` | ||
Christiantyemele marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: elasticsearch | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: elasticsearch | ||
serviceName: es-headless | ||
template: | ||
metadata: | ||
labels: | ||
app: elasticsearch | ||
spec: | ||
containers: | ||
- name: elasticsearch | ||
image: docker.elastic.co/elasticsearch/elasticsearch:7.10.2 | ||
ports: | ||
- containerPort: 9200 | ||
volumeMounts: | ||
- name: es-data | ||
mountPath: /usr/share/elasticsearch/data | ||
resources: | ||
requests: | ||
memory: "2Gi" # Minimum memory for the container | ||
cpu: "1" # Minimum CPU for the container | ||
limits: | ||
memory: "4Gi" # Maximum memory for the container | ||
cpu: "2" # Maximum CPU for the container | ||
volumeClaimTemplates: | ||
- metadata: | ||
name: es-data | ||
spec: | ||
accessModes: ["ReadWriteOnce"] | ||
resources: | ||
requests: | ||
storage: 10Gi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v1 | ||
data: | ||
MONGO_DBN: mediator-coordination | ||
MONGO_URI: mongodb://localhost:27017/ | ||
SERVER_LOCAL_PORT: "8080" | ||
SERVER_PUBLIC_DOMAIN: http://alice-mediator.com | ||
STORAGE_DIRPATH: crates/generic-server/target/storage | ||
kind: ConfigMap | ||
metadata: | ||
creationTimestamp: null | ||
labels: | ||
io.kompose.service: mediator-env | ||
name: env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: es-data | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 10Gi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: fluentd-config | ||
data: | ||
fluent.conf: | | ||
<match **> | ||
@type elasticsearch | ||
host elasticsearch.default.svc.cluster.local | ||
port 9200 | ||
logstash_format true | ||
</match> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: fluentd | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: fluentd | ||
template: | ||
metadata: | ||
labels: | ||
app: fluentd | ||
spec: | ||
containers: | ||
- name: fluentd | ||
image: fluent/fluentd:v1.12 | ||
volumeMounts: | ||
- name: config | ||
mountPath: /fluentd/etc | ||
volumes: | ||
- name: config | ||
configMap: | ||
name: fluentd-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: didcomm-mediator-ingress | ||
namespace: default | ||
annotations: | ||
nginx.ingress.kubernetes.io/rewrite-target: "/" # Rewrite paths if necessary | ||
spec: | ||
ingressClassName: nginx # Specifies the NGINX Ingress Controller | ||
rules: | ||
- host: didcomm-mediator.com | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: mediator | ||
port: | ||
number: 8080 | ||
tls: | ||
- hosts: | ||
- mediator.example.com # Same as the host in rules | ||
secretName: mediator-tls # Replace with your TLS secret name for HTTPS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: kibana | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: kibana | ||
template: | ||
metadata: | ||
labels: | ||
app: kibana | ||
spec: | ||
containers: | ||
- name: kibana | ||
image: docker.elastic.co/kibana/kibana:7.10.2 | ||
ports: | ||
- containerPort: 5601 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: kibana | ||
spec: | ||
selector: | ||
app: kibana | ||
ports: | ||
- protocol: TCP | ||
port: 5601 | ||
targetPort: 5601 | ||
type: NodePort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
annotations: | ||
kompose.cmd: kompose convert -f ../docker-compose.yml | ||
kompose.version: 1.27.0 (b0ed6a2c9) | ||
creationTimestamp: null | ||
labels: | ||
io.kompose.service: mediator | ||
name: mediator | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
io.kompose.service: mediator | ||
strategy: {} | ||
template: | ||
metadata: | ||
annotations: | ||
kompose.cmd: kompose convert -f ../docker-compose.yml | ||
kompose.version: 1.27.0 (b0ed6a2c9) | ||
creationTimestamp: null | ||
labels: | ||
io.kompose.service: mediator | ||
spec: | ||
containers: | ||
- env: | ||
- name: MONGO_DBN | ||
valueFrom: | ||
configMapKeyRef: | ||
key: MONGO_DBN | ||
name: env | ||
- name: MONGO_URI | ||
valueFrom: | ||
configMapKeyRef: | ||
key: MONGO_URI | ||
name: env | ||
- name: SERVER_LOCAL_PORT | ||
valueFrom: | ||
configMapKeyRef: | ||
key: SERVER_LOCAL_PORT | ||
name: env | ||
- name: SERVER_PUBLIC_DOMAIN | ||
valueFrom: | ||
configMapKeyRef: | ||
key: SERVER_PUBLIC_DOMAIN | ||
name: env | ||
- name: STORAGE_DIRPATH | ||
valueFrom: | ||
configMapKeyRef: | ||
key: STORAGE_DIRPATH | ||
name: env | ||
image: ghcr.io/adorsys/didcomm-mediator-rs:merge | ||
name: didcomm-mediator | ||
ports: | ||
- containerPort: 8080 | ||
resources: {} | ||
restartPolicy: Always | ||
status: {} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The excluded files should be more than just these.