Skip to content

Commit 5106ff5

Browse files
committed
ci: set up release tags
Signed-off-by: Timo Glastra <[email protected]>
1 parent d0920cb commit 5106ff5

File tree

5 files changed

+110
-51
lines changed

5 files changed

+110
-51
lines changed

.github/workflows/deploy-stack.yml

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ name: Build and Deploy Stack
33
on:
44
workflow_dispatch:
55
inputs:
6-
build-mediator:
7-
default: true
8-
type: boolean
9-
required: false
10-
description: Build mediator image before deploying
6+
tag:
7+
description: 'Tag to use for the image'
8+
required: true
9+
type: string
1110

1211
jobs:
1312
build_and_deploy:
@@ -18,22 +17,6 @@ jobs:
1817
- name: Checkout Repository
1918
uses: actions/checkout@v2
2019

21-
- name: Log in to the Container registry
22-
if: inputs.build-mediator == true
23-
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
24-
with:
25-
registry: ghcr.io
26-
username: ${{ github.actor }}
27-
password: ${{ secrets.GITHUB_TOKEN }}
28-
29-
- name: Build and Publish Mediator
30-
uses: ./.github/actions/publish-docker-image
31-
if: inputs.build-mediator == true
32-
with:
33-
image-name: ghcr.io/animo/animo-mediator
34-
context: .
35-
docker-file: Dockerfile
36-
3720
- name: Deploy Template Stack
3821
uses: ./.github/actions/deploy
3922
env:
@@ -47,5 +30,5 @@ jobs:
4730
with:
4831
envs: WALLET_KEY,POSTGRES_USER,POSTGRES_PASSWORD,POSTGRES_DATABASE_URL,POSTGRES_ADMIN_USER,POSTGRES_ADMIN_PASSWORD,POSTGRES_TLS_CA
4932
stack-name: animo-afj-mediator
50-
stack-file: ./docker-compose.yml
33+
stack-file: ./docker-compose-animo-mediator.yml
5134
private-key: ${{ secrets.DOCKER_SSH_PRIVATE_KEY }}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Release Image
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
build_and_deploy:
10+
name: Build and Deploy Stack
11+
runs-on: ubuntu-20.04
12+
13+
steps:
14+
- name: Checkout Repository
15+
uses: actions/checkout@v2
16+
17+
- name: Log in to the Container registry
18+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
19+
with:
20+
registry: ghcr.io
21+
username: ${{ github.actor }}
22+
password: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- name: Build and Publish Mediator
25+
uses: ./.github/actions/publish-docker-image
26+
with:
27+
image-name: ghcr.io/animo/animo-mediator
28+
context: .
29+
docker-file: Dockerfile

README.md

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ Why should you use this mediator?
5656
5757
## Getting Started
5858

59+
> If you want to deploy the mediator based on the pre-built docker image, please see the [Using Docker](#using-docker) section.
60+
5961
Make sure you have followed the `libindy` setup form the AFJ docs: https://aries.js.org/guides/next/getting-started/set-up/indy-sdk
6062

6163
Then run install to install dependencies:
@@ -99,10 +101,10 @@ The `POSTGRES_` variables won't be used in development mode (`NODE_ENV=developme
99101
| Variable | Description |
100102
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
101103
| `AGENT_ENDPOINTS` | Comma separated list of endpoints, in order of preference. In most cases you want to provide two endpoints, where the first one is an HTTP url, and the second one is an WebSocket url |
102-
| `AGENT_WALLET_KEY` | The key to unlock the wallet. |
103-
| `AGENT_WALLET_NAME` | The name of the wallet to use. |
104104
| `AGENT_NAME` | The name of the agent. This will be used in invitations and will be publicly advertised. |
105105
| `AGENT_PORT` | The port that is exposed for incoming traffic. Both the HTTP and WS inbound transport handlers are exposes on this port, and HTTP traffic will be upgraded to the WebSocket server when applicable. |
106+
| `WALLET_NAME` | The name of the wallet to use. |
107+
| `WALLET_KEY` | The key to unlock the wallet. |
106108
| `INVITATION_URL` | Optional URL that can be used as the base for the invitation url. This would allow you to render a certain web page that can extract the invitation form the `oob` parameter, and show the QR code, or show useful information to the end-user. Less applicable to mediator URLs. |
107109
| `POSTGRES_DATABASE_URL` | The postgres database url. |
108110
| `POSTGRES_USER` | The postgres user. |
@@ -122,6 +124,17 @@ To deploy the mediator, a postgres database is required. Any postgres database w
122124

123125
## Using Docker
124126

127+
### Using the pre-built Docker Image
128+
129+
1. Make sure you're [authenticated to the Github Container Registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-to-the-container-registry)
130+
2. Run the docker image using the following command:
131+
132+
```sh
133+
docker run
134+
```
135+
136+
### Building the Docker Image
137+
125138
1. Build the docker image
126139

127140
```
@@ -131,12 +144,26 @@ docker build \
131144
.
132145
```
133146

134-
1. Run the docker image
135-
136-
```
137-
docker run ghcr.io/animo/animo-mediator
147+
2. Run the docker image using the following command:
148+
149+
```sh
150+
docker run \
151+
-e "AGENT_ENDPOINTS=http://localhost:3000,ws://localhost:3000" \
152+
-e "WALLET_KEY=<your-wallet-key>" \
153+
-e "WALLET_NAME=mediator" \
154+
-e "AGENT_NAME=Mediator" \
155+
-e "AGENT_PORT=3000" \
156+
-e "POSTGRES_DATABASE_URL=postgres://postgres:postgres@localhost:5432/mediator" \
157+
-e "POSTGRES_USER=postgres" \
158+
-e "POSTGRES_PASSWORD=<your-postgres-password>" \
159+
-e "POSTGRES_ADMIN_USER=postgres" \
160+
-e "POSTGRES_ADMIN_PASSWORD=<your-postgres-password>" \
161+
-p 3000:3000 \
162+
ghcr.io/animo/animo-mediator:latest
138163
```
139164

165+
You can also adapt the `docker-compose.yml` file to your needs. Make sure to use the correct tag. By default `latest` will be used which can have unexpected breakage. See the releases for the latest stable tag.
166+
140167
## Roadmap
141168

142169
The contents in this repository started out as a simple mediator built using Aries Framework JavaScript that can be used for development. Over time we've added some features, but there's still a lot we want to add to this repository over time. Some things on the roadmap:

docker-compose-animo-mediator.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
version: '3.5'
2+
3+
services:
4+
animo-mediator:
5+
image: ghcr.io/animo/animo-mediator:main
6+
networks:
7+
- traefik
8+
deploy:
9+
labels:
10+
# Enable traefik so the container can be exposed to the outside world
11+
traefik.enable: 'true'
12+
13+
# HTTP and WS communication
14+
traefik.http.routers.animo-mediator.rule: Host(`mediator.dev.animo.id`)
15+
traefik.http.routers.animo-mediator.entrypoints: web-secure
16+
traefik.http.routers.animo-mediator.tls.certresolver: zerossl
17+
traefik.http.routers.animo-mediator.service: animo-mediator-service
18+
traefik.http.services.animo-mediator-service.loadbalancer.server.port: 3000
19+
environment:
20+
AGENT_PORT: 3000
21+
AGENT_NAME: Animo Mediator
22+
WALLET_NAME: animo-mediator
23+
WALLET_KEY: ${WALLET_KEY}
24+
POSTGRES_USER: ${POSTGRES_USER}
25+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
26+
POSTGRES_DATABASE_URL: ${POSTGRES_DATABASE_URL}
27+
POSTGRES_ADMIN_USER: ${POSTGRES_ADMIN_USER}
28+
POSTGRES_ADMIN_PASSWORD: ${POSTGRES_ADMIN_PASSWORD}
29+
POSTGRES_TLS_CA: ${POSTGRES_TLS_CA}
30+
AGENT_ENDPOINTS: 'https://mediator.dev.animo.id,wss://mediator.dev.animo.id'
31+
INVITATION_URL: https://mediator.dev.animo.id/invite
32+
LOG_LEVEL: 2
33+
ports:
34+
- '3000'
35+
36+
networks:
37+
traefik:
38+
external: true
39+
name: traefik

docker-compose.yml

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,20 @@
11
version: '3.5'
22

33
services:
4-
animo-mediator:
4+
animomediator:
55
image: ghcr.io/animo/animo-mediator:main
6-
networks:
7-
- traefik
8-
deploy:
9-
labels:
10-
# Enable traefik so the container can be exposed to the outside world
11-
traefik.enable: 'true'
12-
13-
# HTTP and WS communication
14-
traefik.http.routers.animo-mediator.rule: Host(`mediator.dev.animo.id`)
15-
traefik.http.routers.animo-mediator.entrypoints: web-secure
16-
traefik.http.routers.animo-mediator.tls.certresolver: zerossl
17-
traefik.http.routers.animo-mediator.service: animo-mediator-service
18-
traefik.http.services.animo-mediator-service.loadbalancer.server.port: 3000
196
environment:
207
AGENT_PORT: 3000
21-
AGENT_NAME: Animo Mediator
22-
WALLET_NAME: animo-mediator
8+
AGENT_NAME: Mediator
9+
WALLET_NAME: mediator
2310
WALLET_KEY: ${WALLET_KEY}
2411
POSTGRES_USER: ${POSTGRES_USER}
2512
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
2613
POSTGRES_DATABASE_URL: ${POSTGRES_DATABASE_URL}
2714
POSTGRES_ADMIN_USER: ${POSTGRES_ADMIN_USER}
2815
POSTGRES_ADMIN_PASSWORD: ${POSTGRES_ADMIN_PASSWORD}
2916
POSTGRES_TLS_CA: ${POSTGRES_TLS_CA}
30-
AGENT_ENDPOINTS: 'https://mediator.dev.animo.id,wss://mediator.dev.animo.id'
31-
INVITATION_URL: https://mediator.dev.animo.id/invite
17+
AGENT_ENDPOINTS: 'https://my-mediator.com,wss://my-mediator.com'
3218
LOG_LEVEL: 2
3319
ports:
3420
- '3000'
35-
36-
networks:
37-
traefik:
38-
external: true
39-
name: traefik

0 commit comments

Comments
 (0)