Skip to content

Commit

Permalink
Merge pull request #29 from alkem-io/develop
Browse files Browse the repository at this point in the history
Notifications + Templates
  • Loading branch information
valentinyanakiev authored Nov 4, 2021
2 parents a4d04e2 + 1dbf354 commit be1ea55
Show file tree
Hide file tree
Showing 70 changed files with 2,048 additions and 359 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/build-deploy-k8s-dev-aws.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build & Deploy to Dev on AWS

on:
push:
branches: [develop]

env:
ECR_REGISTRY: ${{ secrets.ECR_DEV_TEST_REGISTRY }}
ECR_REPOSITORY: alkemio-notifications
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA_DEV }}
IMAGE_TAG: ${{ github.sha }}

jobs:
deploy:
name: deploy to cluster
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_DEV_TEST_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DEV_TEST_SECRET_ACCESS_KEY }}
aws-region: eu-west-2

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- run: |
docker build -f Dockerfile . -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
- name: deploy to cluster
uses: kodermax/kubectl-aws-eks@master
with:
args: set image deployment/$ECR_REPOSITORY-deployment $ECR_REPOSITORY=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG

- name: verify deployment
uses: kodermax/kubectl-aws-eks@master
with:
args: rollout status deployment/$ECR_REPOSITORY-deployment
5 changes: 2 additions & 3 deletions .github/workflows/build-deploy-k8s-dev-azure.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: Build & Deploy to Dev

on:
push:
branches: [develop]
workflow_dispatch:

jobs:
build-and-deploy:
Expand Down Expand Up @@ -47,4 +46,4 @@ jobs:
images: |
${{ secrets.REGISTRY_LOGIN_SERVER }}/alkemio-notifications:${{ github.sha }}
imagepullsecrets: |
alkemio-notifications-secret
alkemio-notifications-secret
10 changes: 4 additions & 6 deletions .github/workflows/build-deploy-k8s-test-aws.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Build & Deploy to Test
name: Build & Deploy to Test on AWS

on:
workflow_dispatch:

env:
ECR_REGISTRY: ${{ secrets.ECR_REGISTRY }}
ECR_REGISTRY: ${{ secrets.ECR_DEV_TEST_REGISTRY }}
ECR_REPOSITORY: alkemio-notifications
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA_TEST }}
IMAGE_TAG: ${{ github.sha }}
Expand All @@ -20,8 +20,8 @@ jobs:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-access-key-id: ${{ secrets.AWS_DEV_TEST_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DEV_TEST_SECRET_ACCESS_KEY }}
aws-region: eu-west-2

- name: Login to Amazon ECR
Expand All @@ -39,7 +39,5 @@ jobs:

- name: verify deployment
uses: kodermax/kubectl-aws-eks@master
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA_TEST }}
with:
args: rollout status deployment/$ECR_REPOSITORY-deployment
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ lerna-debug.log*

# jetbrains IDEs
.idea
# vscode
.vscode

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
Expand Down Expand Up @@ -107,4 +109,4 @@ dist
.tern-port

# coverage
coverage-ci/
coverage-ci/
7 changes: 0 additions & 7 deletions .vscode/extensions.json

This file was deleted.

8 changes: 0 additions & 8 deletions .vscode/settings.json

This file was deleted.

39 changes: 0 additions & 39 deletions .vscode/tasks.json

This file was deleted.

53 changes: 48 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Alkemio out-of-band notifications service.
[![Build Status](https://app.travis-ci.com/alkem-io/notifications.svg?branch=develop)](https://app.travis-ci.com/alkem-io/notifications.svg?branch=develop)
[![Coverage Status](https://coveralls.io/repos/github/alkem-io/notifications/badge.svg?branch=develop)](https://coveralls.io/github/alkem-io/notifications?branch=develop)
[![BCH compliance](https://bettercodehub.com/edge/badge/alkem-io/notifications?branch=develop)](https://bettercodehub.com/)
[![Deploy to DockerHub](https://github.com/alkem-io/notifications/actions/workflows/build-release-docker-hub.yml/badge.svg?branch=master)](https://github.com/alkem-io/notifications/actions/workflows/build-release-docker-hub.yml)
[![Deploy to DockerHub](https://github.com/alkem-io/notifications/actions/workflows/build-release-docker-hub.yml/badge.svg)](https://github.com/alkem-io/notifications/actions/workflows/build-release-docker-hub.yml)

## To test

Expand Down Expand Up @@ -55,12 +55,55 @@ To test the welcome (sample) template, you can use the following payload in Rabb

```json
{
"pattern": "communityApplicationCreated",
"data": {
"emailFrom": "[email protected]",
"user": {
"firstname": "Valentin",
"email": "[email protected]"
"applicantionCreatorID": "f0a47bad-eca5-4942-84ac-4dc9f085b7b8",
"applicantID": "f0a47bad-eca5-4942-84ac-4dc9f085b7b8",
"community": {
"name": "02 Zero Hunger",
"type": "challenge"
},
"hub": {
"id": "32818605-ef2f-4395-bb49-1dc2835c23de",
"challenge": {
"id": "7b86f954-d8c3-4fac-a652-b922c80e5c20",
"opportunity": {
"id": "636be60f-b64a-4742-8b50-69e608601935"
}
}
}
}
}
```

Note: replace applicantionCreatorID, applicantID, and hub + challenge + opportunity IDs with IDs you have in your database. You can run the following gql queries to find them:

```gql
query {
ecoverses {
id
displayName
challenges {
id
displayName
nameID
community {
id
displayName
}
opportunities {
displayName
id
}
}
}
}
```

```gql
query {
me {
id
}
}
```
31 changes: 30 additions & 1 deletion notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,37 @@ notification_providers:
# The hosting configuration for the Alkemio Server
hosting:
# The type of environment is used in multiple places to determine whether dev tooling is enabled.
# The tyoe of environment can also be used for monitoring / logging / analysis in an ELK cluster / ElasticCloud instance.
# The type of environment can also be used for monitoring / logging / analysis in an ELK cluster / ElasticCloud instance.
# For production deployments it should be set to Prod.
#
# Options: Dev, Prod
environment: ${ENVIRONMENT}:Dev

alkemio:
endpoint: ${ALKEMIO_SERVER_ENDPOINT}:http://localhost:3000/admin/graphql
service_account:
username: ${SERVICE_ACCOUNT_USERNAME}:[email protected]
password: ${SERVICE_ACCOUNT_PASSWORD}:obichamazis

kratos:
public_endpoint: ${KRATOS_API_PUBLIC_ENDPOINT}:http://localhost:3000/identity/ory/kratos/public

recipients:
application_created:
admin:
- rule:
type: CHALLENGE_ADMIN
resource_id: <challengeID>
- rule:
type: OPPORTUNITY_ADMIN
resource_id: <opportunityID>
- rule:
type: ECOVERSE_ADMIN
resource_id: <ecoverseID>
- rule:
type: GLOBAL_ADMIN
resource_id: <>
applicant:
- rule:
type: USER_SELF_MANAGEMENT
resource_id: <applicantID>
Loading

0 comments on commit be1ea55

Please sign in to comment.