From 74312e43f67567e4ff1155cc1ba454b36a8a2677 Mon Sep 17 00:00:00 2001 From: gnuxie Date: Wed, 10 May 2023 19:57:17 +0100 Subject: [PATCH 1/4] Update to node 18. End of life was moved forwards by 7 months so we don't have a choice. https://nodejs.org/en/blog/announcements/nodejs16-eol. --- Dockerfile | 2 +- docs/setup_selfbuild.md | 2 +- package.json | 4 ++-- yarn.lock | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 275264e2..94dc6a60 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # We can't use alpine anymore because crypto has rust deps. -FROM node:16-slim +FROM node:18-slim COPY . /tmp/src RUN cd /tmp/src \ && yarn install \ diff --git a/docs/setup_selfbuild.md b/docs/setup_selfbuild.md index 42a4b526..c71a4299 100644 --- a/docs/setup_selfbuild.md +++ b/docs/setup_selfbuild.md @@ -1,5 +1,5 @@ These instructions are to build and run draupnir without using [Docker](./setup_docker.md). -You need to have installed `yarn` 1.x and Node 16. +You need to have installed `yarn` 1.x and Node 18. ```bash git clone https://github.com/gnuxie/draupnir.git diff --git a/package.json b/package.json index 44bfc5b9..eae14e92 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@types/jsdom": "^16.2.11", "@types/mocha": "^9.0.0", "@types/nedb": "^1.8.12", - "@types/node": "^16.18.11", + "@types/node": "^18.16.7", "@types/pg": "^8.6.5", "@types/request": "^2.48.8", "@types/shell-quote": "1.7.1", @@ -65,6 +65,6 @@ "yaml": "^2.2.2" }, "engines": { - "node": ">=16.0.0" + "node": ">=18.0.0" } } diff --git a/yarn.lock b/yarn.lock index 16500484..dea257f8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -273,10 +273,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-18.6.1.tgz#828e4785ccca13f44e2fb6852ae0ef11e3e20ba5" integrity sha512-z+2vB6yDt1fNwKOeGbckpmirO+VBDuQqecXkgeIqDlaOtmKn6hPR/viQ8cxCfqLU4fTlvM3+YjM367TukWdxpg== -"@types/node@^16.18.11": - version "16.18.11" - resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.11.tgz#cbb15c12ca7c16c85a72b6bdc4d4b01151bb3cae" - integrity sha512-3oJbGBUWuS6ahSnEq1eN2XrCyf4YsWI8OyCvo7c64zQJNplk3mO84t53o8lfTk+2ji59g5ycfc6qQ3fdHliHuA== +"@types/node@^18.16.7": + version "18.16.7" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.16.7.tgz#86d0ba2541f808cb78d4dc5d3e40242a349d6db8" + integrity sha512-MFg7ua/bRtnA1hYE3pVyWxGd/r7aMqjNOdHvlSsXV3n8iaeGKkOaPzpJh6/ovf4bEXWcojkeMJpTsq3mzXW4IQ== "@types/parse5@*": version "6.0.1" From c14fbeb183c91f73338da38ef6bc383527a35b81 Mon Sep 17 00:00:00 2001 From: gnuxie Date: Wed, 10 May 2023 20:09:54 +0100 Subject: [PATCH 2/4] Update github actions workflows to use node 18. --- .github/workflows/mjolnir.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/mjolnir.yml b/.github/workflows/mjolnir.yml index ede287ce..094a5891 100644 --- a/.github/workflows/mjolnir.yml +++ b/.github/workflows/mjolnir.yml @@ -17,10 +17,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Specifically use node 16 like in the readme. + - name: Specifically use node 18 like in the readme. uses: actions/setup-node@v3 with: - node-version: '16' + node-version: '18' - run: yarn install - run: yarn build - run: yarn lint @@ -29,10 +29,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Specifically use node 16 like in the readme. + - name: Specifically use node 18 like in the readme. uses: actions/setup-node@v3 with: - node-version: '16' + node-version: '18' - run: yarn install - run: yarn test integration: @@ -43,7 +43,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '16' + node-version: '18' - name: Fetch and build mx-tester (cached across runs) uses: baptiste0928/cargo-install@v1 with: @@ -65,7 +65,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '16' + node-version: '18' - name: Fetch and build mx-tester (cached across runs) uses: baptiste0928/cargo-install@v1 with: From c16c5d29e1e56abdfbdb30b4c280537c3a9fddd7 Mon Sep 17 00:00:00 2001 From: Gnuxie Date: Sat, 13 May 2023 15:21:21 +0100 Subject: [PATCH 3/4] Integration tests convenience nginx should listen to ipv6 too. --- test/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/nginx.conf b/test/nginx.conf index c4add6ac..3c9c07d0 100644 --- a/test/nginx.conf +++ b/test/nginx.conf @@ -4,7 +4,7 @@ events { http { server { - listen 8081; + listen [::]:8081 ipv6only=off; location ~ ^/_matrix/client/(r0|v3)/rooms/([^/]*)/report/(.*)$ { # Abuse reports should be sent to Mjölnir. From 3ad7079216f73ec33c7891768865ab0a2aa18b60 Mon Sep 17 00:00:00 2001 From: Gnuxie Date: Sat, 13 May 2023 15:32:17 +0100 Subject: [PATCH 4/4] Appservice test: postgres container networking. The docker network is ipv4 but we tell node it can use `localhost` which it then tries to connect to via ipv6. --- mx-tester.yml | 2 +- src/appservice/config/config.harness.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mx-tester.yml b/mx-tester.yml index ba0af398..12e9e5b8 100644 --- a/mx-tester.yml +++ b/mx-tester.yml @@ -4,7 +4,7 @@ up: before: - docker run --rm --network $MX_TEST_NETWORK_NAME --name mjolnir-test-postgres --domainname mjolnir-test-postgres -e POSTGRES_PASSWORD=mjolnir-test -e POSTGRES_USER=mjolnir-tester -e POSTGRES_DB=mjolnir-test-db -d -p 127.0.0.1:8083:5432 postgres # Wait until postgresql is ready - - until psql postgres://mjolnir-tester:mjolnir-test@localhost:8083/mjolnir-test-db -c ""; do echo "Waiting for psql..."; sleep 1s; done + - until psql postgres://mjolnir-tester:mjolnir-test@127.0.0.1:8083/mjolnir-test-db -c ""; do echo "Waiting for psql..."; sleep 1s; done # Launch the reverse proxy, listening for connections *only* on the local host. - docker run --rm --network host --name mjolnir-test-reverse-proxy -p 127.0.0.1:8081:80 -v $MX_TEST_CWD/test/nginx.conf:/etc/nginx/nginx.conf:ro -d nginx - yarn install diff --git a/src/appservice/config/config.harness.yaml b/src/appservice/config/config.harness.yaml index d94c9fb6..e2a2679e 100644 --- a/src/appservice/config/config.harness.yaml +++ b/src/appservice/config/config.harness.yaml @@ -5,7 +5,7 @@ homeserver: db: engine: "postgres" - connectionString: "postgres://mjolnir-tester:mjolnir-test@localhost:8083/mjolnir-test-db" + connectionString: "postgres://mjolnir-tester:mjolnir-test@127.0.0.1:8083/mjolnir-test-db" adminRoom: "#draupnir-admin:localhost:9999"