Skip to content

Commit bf70292

Browse files
authored
Merge pull request #1039 from dm3-org/develop
Release 1.5
2 parents 4744bff + 746189a commit bf70292

File tree

243 files changed

+5353
-3511
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

243 files changed

+5353
-3511
lines changed

.github/workflows/deploy.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
name: deploy
22
on:
3+
workflow_dispatch:
34
push:
45
branches:
5-
- testing
66
- develop
77
- main
88

99
jobs:
1010
messenger-web-deploy:
11-
environment: ${{ github.ref_name == 'main' && 'prod' || (github.ref == 'develop' && 'staging' || 'testing') }}
11+
environment: ${{ github.ref_name == 'main' && 'prod' || (github.ref_name == 'develop' && 'staging' || 'testing') }}
1212
runs-on: ubuntu-latest
1313
env:
14-
environment_name: ${{ github.ref_name == 'main' && 'prod' || (github.ref == 'develop' && 'staging' || 'testing') }}
14+
environment_name: ${{ github.ref_name == 'main' && 'prod' || (github.ref_name == 'develop' && 'staging' || 'testing') }}
1515
steps:
1616
- uses: actions/checkout@v2
1717
- uses: actions/setup-node@v3
@@ -55,7 +55,7 @@ jobs:
5555
echo "REACT_APP_ENVIRONMENT_NAME=${{ env.environment_name }}" >> ./.env.react
5656
echo "REACT_APP_MAINNET_PROVIDER_RPC=${{ secrets.MAINNET_PROVIDER_URL}}" >> ./.env.react
5757
echo "REACT_APP_CHAIN_ID=${{ vars.CHAIN_ID }}" >> ./.env.react
58-
echo "REACT_APP_GENOME_REGISTRY_ADDRESS=${{ vars.GENOME_REGISTRY_ADDRESS }}" >> ./.env.react
58+
echo "REACT_APP_NONCE=${{ vars.STORAGE_NONCE }}" >> ./.env.react
5959
cat ./.env.react >> ./.env
6060
echo "RESOLVER_ADDRESS=${{ vars.ERC3668_RESOLVER_ADDRESS }}" >> ./.env
6161
echo "SIGNING_PUBLIC_KEY=${{ secrets.SIGNING_PUBLIC_KEY }}" >> ./.env
@@ -68,6 +68,9 @@ jobs:
6868
echo "URL=${{ vars.HOST_DOMAIN }}" >> ./.env
6969
echo "CERT_MAIL=${{ vars.CERT_MAIL }}" >> ./.env
7070
echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" >> ./.env
71+
echo "RESOLVER_SUPPORTED_ADDR_ENS_SUBDOMAINS=${{ vars.RESOLVER_SUPPORTED_ADDR_ENS_SUBDOMAINS }}" >> ./.env
72+
echo "RESOLVER_SUPPORTED_NAME_ENS_SUBDOMAINS=${{ vars.RESOLVER_SUPPORTED_NAME_ENS_SUBDOMAINS }}" >> ./.env
73+
echo "PERSISTENCE_DIRECTORY=${{ vars.PERSISTENCE_DIRECTORY }}" >> ./.env
7174
envsubst '${TARGET_HOST} ${TARGET_IP}' < ./docker/nginx.conf > ./nginx.conf
7275
cat ./.env
7376
- name: Prepare docker build environment
@@ -142,6 +145,13 @@ jobs:
142145
ssh -i ./ssh-key app@${{ vars.HOST_DOMAIN }} "\
143146
cd dm3 && ls |grep -E 'dm3-.*tar' | xargs --no-run-if-empty -L 1 docker load -i; \
144147
rm dm3-*.tar || true"
148+
- name: Reset state of testing environment
149+
run: |
150+
if [ $environment_name == "testing" ]; then
151+
ssh -i ./ssh-key root@${{ vars.HOST_DOMAIN }} "\
152+
cd ${{ vars.PERSISTENCE_DIRECTORY }}/db && rm -r * || true;
153+
cd ${{ vars.PERSISTENCE_DIRECTORY }}/storage && rm -r * || true"
154+
fi
145155
- name: Configure Firewall
146156
run: |
147157
ssh -i ./ssh-key root@${{ vars.HOST_DOMAIN }} "\

.github/workflows/on-push.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,16 @@ jobs:
4343
with:
4444
name: lib-schema
4545
path: packages/lib/**/schema/
46+
- uses: actions/upload-artifact@master
47+
with:
48+
name: backend-schema
49+
path: packages/backend/src/schema/storage
4650
backend-test:
4751
runs-on: ubuntu-latest
4852
needs: build
4953
defaults:
5054
run:
51-
working-directory: 'packages/lib'
55+
working-directory: 'packages/backend'
5256
steps:
5357
- uses: actions/checkout@v1
5458
- id: workspace-test
@@ -61,7 +65,7 @@ jobs:
6165
needs: build
6266
defaults:
6367
run:
64-
working-directory: 'packages/lib'
68+
working-directory: 'packages/delivery-service'
6569
steps:
6670
- uses: actions/checkout@v1
6771
- id: workspace-test
@@ -82,6 +86,19 @@ jobs:
8286
with:
8387
workspace-name: '@dm3-org/dm3-integration-tests'
8488
package-pat: ${{ secrets.PACKAGE_PAT }}
89+
cli-test:
90+
runs-on: ubuntu-latest
91+
needs: build
92+
defaults:
93+
run:
94+
working-directory: 'packages/cli'
95+
steps:
96+
- uses: actions/checkout@v1
97+
- id: workspace-test
98+
uses: ./test-action
99+
with:
100+
workspace-name: '@dm3-org/dm3-cli'
101+
package-pat: ${{ secrets.PACKAGE_PAT }}
85102
lib-crypto-test:
86103
runs-on: ubuntu-latest
87104
needs: build
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: resetStagingState
2+
on: workflow_dispatch
3+
4+
jobs:
5+
reset-staging-state:
6+
environment: 'staging'
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Stop docker on server
10+
run: |
11+
ssh -i ./ssh-key app@${{ vars.HOST_DOMAIN }} "\
12+
cd dm3 && docker compose down"
13+
ssh -i ./ssh-key root@${{ vars.HOST_DOMAIN }} "\
14+
systemctl restart docker.service"
15+
- name: Reset state of staging environment
16+
run: |
17+
ssh -i ./ssh-key root@${{ vars.HOST_DOMAIN }} "\
18+
cd ${{ vars.PERSISTENCE_DIRECTORY }}/db && rm -r * || true; \
19+
cd ${{ vars.PERSISTENCE_DIRECTORY }}/storage && rm -r * || true"
20+
- name: Start docker on server
21+
run: |
22+
ssh -i ./ssh-key app@${{ vars.HOST_DOMAIN }} "\
23+
cd dm3 && docker compose --env-file .env up -d && docker system prune -af"

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,32 @@ After processing the envelope, the delivery service forwards the message to the
206206
**ERC3668Resolver**: 0x88c8cC822095cdE6F92c8d20311C8e7dE6A98694
207207

208208
**SignatureVerifier**: 0xA76d65E1241CF77944AB66835Bb5389a3E53A269
209+
210+
# Contributing
211+
212+
We open feature branches from `develop` and merge them back via pull requests. The `main` branch holds the current production release.
213+
214+
There are 3 remote environments where the code is deployed:
215+
216+
1. `production` - the production environment that is automatically deployed from the `main` branch
217+
2. `staging` - the staging environment that is automatically deployed from the `develop` branch and is used to test and review the code before it is deployed to production
218+
3. `testing` - this environment is used to deploy feature branches people are working on and need to test in a real environment
219+
220+
## Using the testing environment
221+
222+
In order to deploy a branch to testing, do this:
223+
224+
1. talk to the team to make sure nobody is actively using the testing environment at the moment
225+
2. push the branch to the remote repository
226+
3. open the [deploy action](https://github.com/dm3-org/dm3/actions/workflows/deploy.yml)
227+
4. click on `Run workflow` (right side of the screen) ![alt text](docs/images/runWorkflow.png)
228+
5. select the branch you want to deploy
229+
6. click on the green `Run workflow` button
230+
231+
Please note: if you select the `main` or `develop` branches, they will be deployed to `production` and `staging` respectively. All other branches will be deployed to `testing`.
232+
233+
## Pull Requests
234+
235+
In order to merge a feature branch into `develop`, you need to open a pull request. The pull request will be reviewed by the team and merged if it is approved. The pull request should have a meaningful title and description, and should be linked to the issue it is solving. Please also make sure that the code is properly tested and that the tests are passing. If you need help with testing, please ask the team. Ideally, link the pull request to the issue it is solving.
236+
237+
Once you created a pull request, letting the team know about it is a good idea. Reach out to do so.

docker/DockerfileBase

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## Create a base image that contains some common tools and all libraries
2-
FROM --platform=linux/amd64 node:22-alpine as base
2+
FROM --platform=linux/amd64 node:22-alpine3.18 as base
33
RUN apk add --update bash gawk \
44
&& rm -rf /var/cache/apk/*
55

docker/DockerfileBuild

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=linux/amd64 node:22-alpine as build
1+
FROM --platform=linux/amd64 node:22-alpine3.18 as build
22
WORKDIR /build
33
COPY . .
44
# we need coreutils for proper ls command

docker/docker-compose.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ services:
4040
image: redis
4141
restart: always
4242
volumes:
43-
- /mnt/dm3_prod_volume/db/redis:/data
43+
- ${PERSISTENCE_DIRECTORY}/db/redis:/data
4444

4545
dm3-storage:
4646
image: postgres:13
@@ -51,7 +51,7 @@ services:
5151
POSTGRES_PASSWORD: prisma
5252
POSTGRES_DB: dm3
5353
volumes:
54-
- /mnt/dm3_prod_volume/storage/postgres:/var/lib/postgresql/data
54+
- ${PERSISTENCE_DIRECTORY}/storage/postgres:/var/lib/postgresql/data
5555

5656
delivery-service:
5757
image: dm3-delivery-service
@@ -75,7 +75,7 @@ services:
7575
restart: always
7676
container_name: redis-delivery-service
7777
volumes:
78-
- /mnt/dm3_prod_volume/db/redis-delivery-service:/data
78+
- ${PERSISTENCE_DIRECTORY}/db/redis-delivery-service:/data
7979

8080
offchain-resolver-db:
8181
image: postgres
@@ -84,7 +84,7 @@ services:
8484
environment:
8585
POSTGRES_PASSWORD: example
8686
volumes:
87-
- /mnt/dm3_prod_volume/db/postgres:/var/lib/postgresql/data
87+
- ${PERSISTENCE_DIRECTORY}/db/postgres:/var/lib/postgresql/data
8888

8989
offchain-resolver:
9090
image: dm3-offchain-resolver
@@ -95,7 +95,8 @@ services:
9595
DATABASE_URL: postgresql://postgres:example@offchain-resolver-db:5432
9696
PORT: 8082
9797
RPC: ${RPC}
98-
REACT_APP_ADDR_ENS_SUBDOMAIN: ${REACT_APP_ADDR_ENS_SUBDOMAIN}
98+
RESOLVER_SUPPORTED_ADDR_ENS_SUBDOMAINS: ${RESOLVER_SUPPORTED_ADDR_ENS_SUBDOMAINS}
99+
RESOLVER_SUPPORTED_NAME_ENS_SUBDOMAINS: ${RESOLVER_SUPPORTED_NAME_ENS_SUBDOMAINS}
99100
LOG_LEVEL: 'debug'
100101

101102
web:
@@ -111,8 +112,6 @@ services:
111112
REACT_APP_RESOLVER_BACKEND: ${REACT_APP_RESOLVER_BACKEND}
112113
REACT_APP_USER_ENS_SUBDOMAIN: ${REACT_APP_USER_ENS_SUBDOMAIN}
113114
REACT_APP_WALLET_CONNECT_PROJECT_ID: ${REACT_APP_WALLET_CONNECT_PROJECT_ID}
114-
REACT_APP_GENOME_REGISTRY_ADDRESS: ${REACT_APP_GENOME_REGISTRY_ADDRESS}
115-
RESOLVER_ADDRESS: ${RESOLVER_ADDRESS}
116115

117116
certbot:
118117
image: certbot/certbot
@@ -149,5 +148,5 @@ volumes:
149148
driver: local
150149
driver_opts:
151150
type: none
152-
device: /mnt/dm3_prod_volume/webroot
151+
device: ${PERSISTENCE_DIRECTORY}/webroot
153152
o: bind

docs/images/runWorkflow.png

42.4 KB
Loading
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- AlterTable
2+
ALTER TABLE "EncryptedMessage" ADD COLUMN "createdAt" INTEGER NOT NULL DEFAULT 0;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- AlterTable
2+
ALTER TABLE "Conversation" ADD COLUMN "createdAt" INTEGER NOT NULL DEFAULT 0;

0 commit comments

Comments
 (0)