From 22ad0e928926797255aa9bc358a718ad490d4a97 Mon Sep 17 00:00:00 2001 From: Mira Nord Date: Sun, 16 Mar 2025 19:16:06 +0100 Subject: [PATCH 01/43] Improve domain splitting for "Hosted by" header --- src/open/ClientViewModel.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/open/ClientViewModel.js b/src/open/ClientViewModel.js index 2cd72449..9a0543a1 100644 --- a/src/open/ClientViewModel.js +++ b/src/open/ClientViewModel.js @@ -137,9 +137,9 @@ export class ClientViewModel extends ViewModel { const preferredWebInstance = this._client.getPreferredWebInstance(this._link); if (this._webPlatform && preferredWebInstance) { let label = preferredWebInstance; - const subDomainIdx = preferredWebInstance.lastIndexOf(".", preferredWebInstance.lastIndexOf(".")); + const subDomainIdx = preferredWebInstance.lastIndexOf(".", preferredWebInstance.lastIndexOf(".") - 1); if (subDomainIdx !== -1) { - label = preferredWebInstance.slice(preferredWebInstance.length - subDomainIdx + 1); + label = preferredWebInstance.slice(subDomainIdx + 1); } return `Hosted by ${label}`; } From 50a25dd04c6b99ffcc012186bffbb9b4f3464b79 Mon Sep 17 00:00:00 2001 From: Mira Nord Date: Sun, 16 Mar 2025 20:54:38 +0100 Subject: [PATCH 02/43] Add preference for custom web instances, use it for Element --- src/Preferences.js | 17 +++++++++++++++++ src/open/ClientViewModel.js | 30 +++++++++++++++++++----------- src/open/clients/Element.js | 7 ++++--- 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/src/Preferences.js b/src/Preferences.js index d6d36f69..cdd14462 100644 --- a/src/Preferences.js +++ b/src/Preferences.js @@ -25,6 +25,7 @@ export class Preferences extends EventEmitter { // used to differentiate web from native if a client supports both this.platform = null; this.homeservers = null; + this.preferredWebInstances = {}; const prefsStr = localStorage.getItem("preferred_client"); if (prefsStr) { @@ -36,6 +37,10 @@ export class Preferences extends EventEmitter { if (serversStr) { this.homeservers = JSON.parse(serversStr); } + const preferredWebInstancesStr = localStorage.getItem("preferred_web_instances"); + if (preferredWebInstancesStr) { + this.preferredWebInstances = JSON.parse(preferredWebInstancesStr); + } } setClient(id, platform) { @@ -54,12 +59,24 @@ export class Preferences extends EventEmitter { } } + setPreferredWebInstance(client_id, instance_url) { + this.preferredWebInstances[client_id] = instance_url; + this._localStorage.setItem("preferred_web_instances", JSON.stringify(this.preferredWebInstances)); + this.emit("canClear"); + } + + getPreferredWebInstance(client_id) { + return this.preferredWebInstances[client_id]; + } + clear() { this._localStorage.removeItem("preferred_client"); this._localStorage.removeItem("consented_servers"); + this._localStorage.removeItem("preferred_web_instances"); this.clientId = null; this.platform = null; this.homeservers = null; + this.preferredWebInstances = {}; } get canClear() { diff --git a/src/open/ClientViewModel.js b/src/open/ClientViewModel.js index 9a0543a1..70591865 100644 --- a/src/open/ClientViewModel.js +++ b/src/open/ClientViewModel.js @@ -59,11 +59,11 @@ export class ClientViewModel extends ViewModel { if (this._proposedPlatform === this._nativePlatform) { deepLinkLabel = "Open in app"; } else { - deepLinkLabel = `Open on ${this._client.getPreferredWebInstance(this._link)}`; + deepLinkLabel = `Open on ${this.preferredWebInstance}`; } } const actions = []; - const proposedDeepLink = this._client.getDeepLink(this._proposedPlatform, this._link); + const proposedDeepLink = this._client.getDeepLink(this._proposedPlatform, this._link, this.preferredWebInstance); if (proposedDeepLink) { actions.push({ label: deepLinkLabel, @@ -83,8 +83,8 @@ export class ClientViewModel extends ViewModel { // show only if there is a preferred instance, and if we don't already link to it in the first button if (hasPreferredWebInstance && this._webPlatform && this._proposedPlatform !== this._webPlatform) { actions.push({ - label: `Open on ${this._client.getPreferredWebInstance(this._link)}`, - url: this._client.getDeepLink(this._webPlatform, this._link), + label: `Open on ${this.preferredWebInstance}`, + url: this._client.getDeepLink(this._webPlatform, this._link, this.preferredWebInstance), kind: "open-in-web", activated: () => {} // don't persist this choice as we don't persist the preferred web instance, it's in the url }); @@ -108,10 +108,10 @@ export class ClientViewModel extends ViewModel { actions.push(...nativeActions); } if (this._webPlatform) { - const webDeepLink = this._client.getDeepLink(this._webPlatform, this._link); + const webDeepLink = this._client.getDeepLink(this._webPlatform, this._link, this.preferredWebInstance); if (webDeepLink) { const webLabel = this.hasPreferredWebInstance ? - `Open on ${this._client.getPreferredWebInstance(this._link)}` : + `Open on ${this.preferredWebInstance}` : `Continue in your browser`; actions.push({ label: webLabel, @@ -128,14 +128,22 @@ export class ClientViewModel extends ViewModel { return actions; } - get hasPreferredWebInstance() { + get preferredWebInstance() { // also check there is a web platform that matches the platforms the user is on (mobile or desktop web) - return this._webPlatform && typeof this._client.getPreferredWebInstance(this._link) === "string"; + if (!this._webPlatform) return undefined; + return ( + this.preferences.getPreferredWebInstance(this._client.id) + || this._client.getPreferredWebInstance(this._link) + ); + } + + get hasPreferredWebInstance() { + return typeof this.preferredWebInstance === "string"; } get hostedByBannerLabel() { - const preferredWebInstance = this._client.getPreferredWebInstance(this._link); - if (this._webPlatform && preferredWebInstance) { + if (this.hasPreferredWebInstance) { + const preferredWebInstance = this.preferredWebInstance; let label = preferredWebInstance; const subDomainIdx = preferredWebInstance.lastIndexOf(".", preferredWebInstance.lastIndexOf(".") - 1); if (subDomainIdx !== -1) { @@ -188,7 +196,7 @@ export class ClientViewModel extends ViewModel { get showDeepLinkInInstall() { // we can assume this._nativePlatform as this._clientCanIntercept already checks it - return this._clientCanIntercept && !!this._client.getDeepLink(this._nativePlatform, this._link); + return this._clientCanIntercept && !!this._client.getDeepLink(this._nativePlatform, this._link, this.preferredWebInstance); } get availableOnPlatformNames() { diff --git a/src/open/clients/Element.js b/src/open/clients/Element.js index 06ca2fef..e28b0acb 100644 --- a/src/open/clients/Element.js +++ b/src/open/clients/Element.js @@ -55,8 +55,9 @@ export class Element { get homepage() { return "https://element.io"; } get author() { return "Element"; } getMaturity(platform) { return Maturity.Stable; } + get supportsCustomInstances() { return true; } - getDeepLink(platform, link) { + getDeepLink(platform, link, preferredWebInstance) { let fragmentPath; switch (link.kind) { case LinkKind.User: @@ -82,8 +83,8 @@ export class Element { let instanceHost = trustedWebInstances[0]; // we use app.element.io which iOS will intercept, but it likely won't intercept any other trusted instances // so only use a preferred web instance for true web links. - if (isWebPlatform && trustedWebInstances.includes(link.webInstances[this.id])) { - instanceHost = link.webInstances[this.id]; + if (isWebPlatform && preferredWebInstance) { + instanceHost = preferredWebInstance; } return `https://${instanceHost}/#/${fragmentPath}`; } else if (platform === Platform.Linux || platform === Platform.Windows || platform === Platform.macOS) { From 06237b1b8b2405a8454ef79af1e6430d238c4535 Mon Sep 17 00:00:00 2001 From: Mira Nord Date: Sun, 16 Mar 2025 20:55:20 +0100 Subject: [PATCH 03/43] Add link to change custom web instance --- src/open/ClientView.js | 31 +++++++++++++++++++++++++++++++ src/open/ClientViewModel.js | 5 +++++ 2 files changed, 36 insertions(+) diff --git a/src/open/ClientView.js b/src/open/ClientView.js index 76c73e9f..b42eb16c 100644 --- a/src/open/ClientView.js +++ b/src/open/ClientView.js @@ -112,10 +112,41 @@ class InstallClientView extends TemplateView { } } +export class SetCustomWebInstanceView extends TemplateView { + render(t, vm) { + return t.div({className: "SetCustomWebInstanceView"}, [ + t.p([ + "Use a custom web instance for the ", t.strong(vm.name), " client:", + ]), + t.form({action: "#", id: "setCustomWebInstanceForm", onSubmit: evt => this._onSubmit(evt)}, [ + t.label([ + "Host name:", + t.input({ + type: "text", + className: "line", + placeholder: "chat.example.org", + name: "instanceHostname", + }) + ]) + ]) + ]); + } + + _onSubmit(evt) { + evt.preventDefault(); + this.value.continueWithSelection(this._askEveryTimeChecked); + } +} + function showBack(t, vm) { return t.p({className: {caption: true, "back": true, hidden: vm => !vm.showBack}}, [ `Continue with ${vm.name} · `, t.button({className: "text", onClick: () => vm.back()}, "Change"), + t.span({hidden: vm => !vm.showSetWebInstance}, [ + ' · ', + t.button({className: "text", onClick: () => vm.setCustomWebInstance()}, "Use Custom Web Instance"), + ]) + ]); } diff --git a/src/open/ClientViewModel.js b/src/open/ClientViewModel.js index 70591865..380512f6 100644 --- a/src/open/ClientViewModel.js +++ b/src/open/ClientViewModel.js @@ -231,6 +231,10 @@ export class ClientViewModel extends ViewModel { return !!this._clientListViewModel; } + get showSetWebInstance() { + return !!this._client.supportsCustomInstances; + } + back() { if (this._clientListViewModel) { const vm = this._clientListViewModel; @@ -239,6 +243,7 @@ export class ClientViewModel extends ViewModel { // in the list with all clients, and also if we refresh, we get the list with // all clients rather than having our "change client" click reverted. this.preferences.setClient(undefined, undefined); + this.preferences.setPreferredWebInstance(this._client.id, undefined); this._update(); this.emitChange(); vm.showAll(); From d993157cfae9dced77e8f5ac772b5b14bc46a6aa Mon Sep 17 00:00:00 2001 From: Mira Nord Date: Sun, 16 Mar 2025 21:20:06 +0100 Subject: [PATCH 04/43] Add form to configure custom web instance --- src/Preferences.js | 24 +++++++++++----------- src/open/ClientView.js | 40 ++++++++++++++++++++++++++----------- src/open/ClientViewModel.js | 23 ++++++++++++++++++--- 3 files changed, 60 insertions(+), 27 deletions(-) diff --git a/src/Preferences.js b/src/Preferences.js index cdd14462..d365230e 100644 --- a/src/Preferences.js +++ b/src/Preferences.js @@ -25,7 +25,7 @@ export class Preferences extends EventEmitter { // used to differentiate web from native if a client supports both this.platform = null; this.homeservers = null; - this.preferredWebInstances = {}; + this.customWebInstances = {}; const prefsStr = localStorage.getItem("preferred_client"); if (prefsStr) { @@ -37,9 +37,9 @@ export class Preferences extends EventEmitter { if (serversStr) { this.homeservers = JSON.parse(serversStr); } - const preferredWebInstancesStr = localStorage.getItem("preferred_web_instances"); - if (preferredWebInstancesStr) { - this.preferredWebInstances = JSON.parse(preferredWebInstancesStr); + const customWebInstancesStr = localStorage.getItem("custom_web_instances"); + if (customWebInstancesStr) { + this.customWebInstances = JSON.parse(customWebInstancesStr); } } @@ -59,27 +59,27 @@ export class Preferences extends EventEmitter { } } - setPreferredWebInstance(client_id, instance_url) { - this.preferredWebInstances[client_id] = instance_url; - this._localStorage.setItem("preferred_web_instances", JSON.stringify(this.preferredWebInstances)); + setCustomWebInstance(client_id, instance_url) { + this.customWebInstances[client_id] = instance_url; + this._localStorage.setItem("custom_web_instances", JSON.stringify(this.customWebInstances)); this.emit("canClear"); } - getPreferredWebInstance(client_id) { - return this.preferredWebInstances[client_id]; + getCustomWebInstance(client_id) { + return this.customWebInstances[client_id]; } clear() { this._localStorage.removeItem("preferred_client"); this._localStorage.removeItem("consented_servers"); - this._localStorage.removeItem("preferred_web_instances"); + this._localStorage.removeItem("custom_web_instances"); this.clientId = null; this.platform = null; this.homeservers = null; - this.preferredWebInstances = {}; + this.customWebInstances = {}; } get canClear() { - return !!this.clientId || !!this.platform || !!this.homeservers; + return !!this.clientId || !!this.platform || !!this.homeservers || !!this.customWebInstances; } } diff --git a/src/open/ClientView.js b/src/open/ClientView.js index b42eb16c..37c2b9e7 100644 --- a/src/open/ClientView.js +++ b/src/open/ClientView.js @@ -39,6 +39,14 @@ function renderInstructions(parts) { export class ClientView extends TemplateView { render(t, vm) { + return t.mapView(vm => vm.customWebInstanceFormOpen, open => { + switch (open) { + case true: return new SetCustomWebInstanceView(vm); + case false: return new TemplateView(vm, t => this.renderContent(t, vm)); + } + }); + } + renderContent(t, vm) { return t.div({className: {"ClientView": true, "isPreferred": vm => vm.hasPreferredWebInstance}}, [ ... vm.hasPreferredWebInstance ? [t.div({className: "hostedBanner"}, vm.hostedByBannerLabel)] : [], t.div({className: "header"}, [ @@ -119,22 +127,30 @@ export class SetCustomWebInstanceView extends TemplateView { "Use a custom web instance for the ", t.strong(vm.name), " client:", ]), t.form({action: "#", id: "setCustomWebInstanceForm", onSubmit: evt => this._onSubmit(evt)}, [ - t.label([ - "Host name:", - t.input({ - type: "text", - className: "line", - placeholder: "chat.example.org", - name: "instanceHostname", - }) - ]) + t.input({ + type: "text", + className: "fullwidth large", + placeholder: "chat.example.org", + name: "instanceHostname", + value: vm.preferredWebInstance || "", + }), + t.input({type: "submit", value: "Save", className: "primary fullwidth"}), + t.input({type: "button", value: "Use Default Instance", className: "secondary fullwidth", onClick: evt => this._onReset(evt)}), ]) ]); } _onSubmit(evt) { evt.preventDefault(); - this.value.continueWithSelection(this._askEveryTimeChecked); + const form = evt.target; + const {instanceHostname} = form.elements; + this.value.setCustomWebInstance(instanceHostname.value || undefined); + this.value.closeCustomWebInstanceForm(); + } + + _onReset(evt) { + this.value.setCustomWebInstance(undefined); + this.value.closeCustomWebInstanceForm(); } } @@ -142,9 +158,9 @@ function showBack(t, vm) { return t.p({className: {caption: true, "back": true, hidden: vm => !vm.showBack}}, [ `Continue with ${vm.name} · `, t.button({className: "text", onClick: () => vm.back()}, "Change"), - t.span({hidden: vm => !vm.showSetWebInstance}, [ + t.span({hidden: vm => !vm.supportsCustomWebInstances}, [ ' · ', - t.button({className: "text", onClick: () => vm.setCustomWebInstance()}, "Use Custom Web Instance"), + t.button({className: "text", onClick: () => vm.configureCustomWebInstance()}, "Use Custom Web Instance"), ]) ]); diff --git a/src/open/ClientViewModel.js b/src/open/ClientViewModel.js index 380512f6..b2e5f87c 100644 --- a/src/open/ClientViewModel.js +++ b/src/open/ClientViewModel.js @@ -35,6 +35,7 @@ export class ClientViewModel extends ViewModel { this._pickClient = pickClient; // to provide "choose other client" button after calling pick() this._clientListViewModel = null; + this.customWebInstanceFormOpen = false; this._update(); } @@ -132,7 +133,7 @@ export class ClientViewModel extends ViewModel { // also check there is a web platform that matches the platforms the user is on (mobile or desktop web) if (!this._webPlatform) return undefined; return ( - this.preferences.getPreferredWebInstance(this._client.id) + this.preferences.getCustomWebInstance(this._client.id) || this._client.getPreferredWebInstance(this._link) ); } @@ -231,7 +232,7 @@ export class ClientViewModel extends ViewModel { return !!this._clientListViewModel; } - get showSetWebInstance() { + get supportsCustomWebInstances() { return !!this._client.supportsCustomInstances; } @@ -243,10 +244,26 @@ export class ClientViewModel extends ViewModel { // in the list with all clients, and also if we refresh, we get the list with // all clients rather than having our "change client" click reverted. this.preferences.setClient(undefined, undefined); - this.preferences.setPreferredWebInstance(this._client.id, undefined); + this.preferences.setCustomWebInstance(this._client.id, undefined); this._update(); this.emitChange(); vm.showAll(); } } + + configureCustomWebInstance() { + this.customWebInstanceFormOpen = true; + this.emitChange(); + } + + closeCustomWebInstanceForm() { + this.customWebInstanceFormOpen = false; + this.emitChange(); + } + + setCustomWebInstance(hostname) { + this.preferences.setClient(this._client.id, hostname ? this._webPlatform : (this._nativePlatform || this._webPlatform)); + this.preferences.setCustomWebInstance(this._client.id, hostname); + this._update(); + } } From 6dd9a0213cf77623900102334d5ed30b20068cbf Mon Sep 17 00:00:00 2001 From: Mira Nord Date: Sun, 16 Mar 2025 21:40:52 +0100 Subject: [PATCH 05/43] Trim whitespace and protocol / path information --- src/open/ClientView.js | 2 +- src/open/ClientViewModel.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/open/ClientView.js b/src/open/ClientView.js index 37c2b9e7..c73b682d 100644 --- a/src/open/ClientView.js +++ b/src/open/ClientView.js @@ -144,7 +144,7 @@ export class SetCustomWebInstanceView extends TemplateView { evt.preventDefault(); const form = evt.target; const {instanceHostname} = form.elements; - this.value.setCustomWebInstance(instanceHostname.value || undefined); + this.value.setCustomWebInstance(instanceHostname.value); this.value.closeCustomWebInstanceForm(); } diff --git a/src/open/ClientViewModel.js b/src/open/ClientViewModel.js index b2e5f87c..210e30bc 100644 --- a/src/open/ClientViewModel.js +++ b/src/open/ClientViewModel.js @@ -262,8 +262,11 @@ export class ClientViewModel extends ViewModel { } setCustomWebInstance(hostname) { + if (hostname) { + hostname = hostname.trim().replace(/^https:\/\//, '').replace(/\/.*$/, ''); + } this.preferences.setClient(this._client.id, hostname ? this._webPlatform : (this._nativePlatform || this._webPlatform)); - this.preferences.setCustomWebInstance(this._client.id, hostname); + this.preferences.setCustomWebInstance(this._client.id, hostname || undefined); this._update(); } } From 642a74bc06a34095954b87a70a6b64aa91f53666 Mon Sep 17 00:00:00 2001 From: Dome Date: Thu, 27 Mar 2025 14:32:51 +0100 Subject: [PATCH 06/43] Add files via upload --- Dockerfile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..0fbaa178 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +# Verwenden Sie ein Node.js-Image als Basis +FROM node:20-alpine + +# Setzen Sie das Arbeitsverzeichnis im Container +WORKDIR /app + +# Kopieren Sie die package.json und yarn.lock Dateien und installieren Sie die Abhängigkeiten +COPY package.json yarn.lock ./ +RUN yarn install --frozen-lockfile + +# Kopieren Sie den Rest des Codes in das Arbeitsverzeichnis +COPY . . + +# Exponieren Sie den Port 5000 +EXPOSE 5000 + +# Starten Sie die Anwendung und setzen Sie die PORT-Umgebungsvariable auf 5000 +ENV PORT=5000 +CMD ["yarn", "start"] \ No newline at end of file From b47dbf1089cc1bb8dfebd3870fcc476138dbf7a0 Mon Sep 17 00:00:00 2001 From: Dome Date: Thu, 27 Mar 2025 14:34:59 +0100 Subject: [PATCH 07/43] Add files via upload --- compose.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 compose.yaml diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 00000000..410ea6d2 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,8 @@ +version: '3.8' + +services: + matrix-to: + build: . + ports: + - "5000:5000" + restart: unless-stopped \ No newline at end of file From 67c27fda6c0d0af756012fb1984afcc2dd12499a Mon Sep 17 00:00:00 2001 From: Dome Date: Thu, 27 Mar 2025 15:44:09 +0100 Subject: [PATCH 08/43] Update compose.yaml updated compose.yaml --- compose.yaml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/compose.yaml b/compose.yaml index 410ea6d2..9a0abee3 100644 --- a/compose.yaml +++ b/compose.yaml @@ -2,7 +2,20 @@ version: '3.8' services: matrix-to: - build: . + container_name: Matrix-to + hostname: matrix-to + image: domoel/matrix-to:latest ports: - "5000:5000" - restart: unless-stopped \ No newline at end of file + restart: unless-stopped + environment: + - PORT=5000 + volumes: + - ./data:/app + networks: + - frontend + +networks: + frontend: + external: true + name: matrix From 4baaa31bb8cb8b49762b5ffde8b8bdc510b18dfd Mon Sep 17 00:00:00 2001 From: Dome Date: Thu, 27 Mar 2025 15:48:00 +0100 Subject: [PATCH 09/43] Update compose.yaml --- compose.yaml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/compose.yaml b/compose.yaml index 9a0abee3..bc53dcf9 100644 --- a/compose.yaml +++ b/compose.yaml @@ -3,19 +3,9 @@ version: '3.8' services: matrix-to: container_name: Matrix-to - hostname: matrix-to image: domoel/matrix-to:latest ports: - "5000:5000" restart: unless-stopped environment: - PORT=5000 - volumes: - - ./data:/app - networks: - - frontend - -networks: - frontend: - external: true - name: matrix From b7a3507f28e45e19cd9020bb976135e54e11f3ff Mon Sep 17 00:00:00 2001 From: Dome Date: Thu, 27 Mar 2025 20:33:00 +0100 Subject: [PATCH 10/43] Update README.md add build with docker compose description. --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 3f672749..205abbfb 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ https://matrix.to/#/#matrix:matrix.org?web-instance[element.io]=chat.mozilla.org You can discuss matrix.to in [`#matrix.to:matrix.org`](https://matrix.to/#/#matrix.to:matrix.org) + ## Build Instructions 1. Install [yarn](https://classic.yarnpkg.com/en/docs/install) @@ -83,3 +84,19 @@ You can discuss matrix.to in 1. `yarn` 1. `yarn start` 1. Go to http://localhost:5000 in your browser + +## Build with docker compose + +``` +version: '3.8' + +services: + matrix-to: + container_name: Matrix-to + image: domoel/matrix-to:latest + ports: + - "5000:5000" + restart: unless-stopped + environment: + - PORT=5000 +``` From e7a809f087e36d44b8465659aee6c27e2d7efd62 Mon Sep 17 00:00:00 2001 From: Dome Date: Thu, 27 Mar 2025 20:34:45 +0100 Subject: [PATCH 11/43] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 205abbfb..042bf50d 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,8 @@ You can discuss matrix.to in ## Build Instructions +### Native build + 1. Install [yarn](https://classic.yarnpkg.com/en/docs/install) 1. `git clone https://github.com/matrix-org/matrix.to` 1. `cd matrix.to` @@ -85,7 +87,7 @@ You can discuss matrix.to in 1. `yarn start` 1. Go to http://localhost:5000 in your browser -## Build with docker compose +### Build with docker compose ``` version: '3.8' From 8abc0ce856bc2b1932317d57e6fa51ef419ff5dd Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 11:53:11 +0100 Subject: [PATCH 12/43] Create docker-image.yml --- .github/workflows/docker-image.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 00000000..836be7f3 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,29 @@ +name: Build and Push Matrix-to Docker Image + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Log in to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + push: true + tags: domoel/matrix-to:latest From b560e2dc1e152e68ac4964176b4ae3b4a28339cb Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 13:27:33 +0100 Subject: [PATCH 13/43] Update Dockerfile --- Dockerfile | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0fbaa178..197598fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,21 @@ -# Verwenden Sie ein Node.js-Image als Basis -FROM node:20-alpine - -# Setzen Sie das Arbeitsverzeichnis im Container +# Stage 1: Build +FROM node:20-alpine AS build WORKDIR /app - -# Kopieren Sie die package.json und yarn.lock Dateien und installieren Sie die Abhängigkeiten COPY package.json yarn.lock ./ -RUN yarn install --frozen-lockfile - -# Kopieren Sie den Rest des Codes in das Arbeitsverzeichnis +RUN yarn install --frozen-lockfile && yarn cache clean COPY . . -# Exponieren Sie den Port 5000 -EXPOSE 5000 +# Stage 2: Production +FROM nginx:alpine +COPY --from=build /app/build /usr/share/nginx/html +COPY nginx.conf /etc/nginx/nginx.conf + +# Expose ports 80 and 443 +EXPOSE 80 +EXPOSE 443 + +# Healthcheck +HEALTHCHECK CMD curl --fail http://localhost:80 || exit 1 -# Starten Sie die Anwendung und setzen Sie die PORT-Umgebungsvariable auf 5000 -ENV PORT=5000 -CMD ["yarn", "start"] \ No newline at end of file +# Start Nginx server +CMD ["nginx", "-g", "daemon off;"] From 3a0359c1b6af7600c5c2cc1bc812589052bd0a64 Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 13:32:08 +0100 Subject: [PATCH 14/43] Update compose.yaml --- compose.yaml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/compose.yaml b/compose.yaml index bc53dcf9..87edbf30 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,11 +1,16 @@ version: '3.8' services: - matrix-to: - container_name: Matrix-to + web: image: domoel/matrix-to:latest ports: - - "5000:5000" - restart: unless-stopped + - "80:80" environment: - - PORT=5000 + - NODE_ENV=production + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf + healthcheck: + test: ["CMD", "curl", "--fail", "http://localhost:80"] + interval: 30s + timeout: 10s + retries: 3 From 66cc55094908129bb706eeebb6a03f79f192b5ca Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 13:38:35 +0100 Subject: [PATCH 15/43] Update Dockerfile --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 197598fd..35ddfb43 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ # Stage 1: Build -FROM node:20-alpine AS build +FROM node:20.2-alpine AS build WORKDIR /app COPY package.json yarn.lock ./ -RUN yarn install --frozen-lockfile && yarn cache clean +RUN yarn install --frozen-lockfile --production && yarn cache clean COPY . . # Stage 2: Production @@ -10,7 +10,7 @@ FROM nginx:alpine COPY --from=build /app/build /usr/share/nginx/html COPY nginx.conf /etc/nginx/nginx.conf -# Expose ports 80 and 443 +# Expose port 80 EXPOSE 80 EXPOSE 443 From 3fa1ad72693bee38d93f80ec473c6f846f868f16 Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 13:44:59 +0100 Subject: [PATCH 16/43] Update README.md --- README.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 042bf50d..83153cd3 100644 --- a/README.md +++ b/README.md @@ -93,12 +93,17 @@ You can discuss matrix.to in version: '3.8' services: - matrix-to: - container_name: Matrix-to + web: image: domoel/matrix-to:latest ports: - - "5000:5000" - restart: unless-stopped + - "80:80" environment: - - PORT=5000 + - NODE_ENV=production + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf + healthcheck: + test: ["CMD", "curl", "--fail", "http://localhost:80"] + interval: 30s + timeout: 10s + retries: 3 ``` From f04e9484e774c81bb8e463060e1d3f55aecf0947 Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 13:45:30 +0100 Subject: [PATCH 17/43] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 35ddfb43..89159a59 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ FROM nginx:alpine COPY --from=build /app/build /usr/share/nginx/html COPY nginx.conf /etc/nginx/nginx.conf -# Expose port 80 +# Expose port 80 and 443 EXPOSE 80 EXPOSE 443 From df2c426d76baf687c2b1774379e5e61083cc33b6 Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 13:49:34 +0100 Subject: [PATCH 18/43] Update compose.yaml --- compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose.yaml b/compose.yaml index 87edbf30..f1299f17 100644 --- a/compose.yaml +++ b/compose.yaml @@ -4,7 +4,7 @@ services: web: image: domoel/matrix-to:latest ports: - - "80:80" + - "1336:80" environment: - NODE_ENV=production volumes: From 1898808f79e06f29c796cb60657d9032f022f9fc Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 13:51:57 +0100 Subject: [PATCH 19/43] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 83153cd3..8b750409 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ services: web: image: domoel/matrix-to:latest ports: - - "80:80" + - "1336:80" environment: - NODE_ENV=production volumes: From 70b5a4979dc4f984055bd4a6ece6f0473fcdcd0a Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 14:04:49 +0100 Subject: [PATCH 20/43] Update Dockerfile --- Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 89159a59..fc19f41f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,12 +7,13 @@ COPY . . # Stage 2: Production FROM nginx:alpine -COPY --from=build /app/build /usr/share/nginx/html +WORKDIR /etc/nginx COPY nginx.conf /etc/nginx/nginx.conf +WORKDIR /usr/share/nginx/html +COPY --from=build /app/build . -# Expose port 80 and 443 +# Expose port 80 EXPOSE 80 -EXPOSE 443 # Healthcheck HEALTHCHECK CMD curl --fail http://localhost:80 || exit 1 From 684f3f70dd28dd01c0712aac324ef9bcd398f1a5 Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 14:18:21 +0100 Subject: [PATCH 21/43] Update Dockerfile --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index fc19f41f..ea84dd14 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,14 @@ # Stage 1: Build -FROM node:20.2-alpine AS build +FROM node:20.2-alpine3.15 AS build WORKDIR /app COPY package.json yarn.lock ./ RUN yarn install --frozen-lockfile --production && yarn cache clean COPY . . # Stage 2: Production -FROM nginx:alpine +FROM nginx:alpine3.15 WORKDIR /etc/nginx -COPY nginx.conf /etc/nginx/nginx.conf +COPY ./nginx.conf /etc/nginx/nginx.conf WORKDIR /usr/share/nginx/html COPY --from=build /app/build . From 334393b9de24763918f623867c22061ae0a550a3 Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 14:22:19 +0100 Subject: [PATCH 22/43] Update Dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ea84dd14..ee3bd200 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,12 @@ # Stage 1: Build -FROM node:20.2-alpine3.15 AS build +FROM node:20.2-alpine AS build WORKDIR /app COPY package.json yarn.lock ./ RUN yarn install --frozen-lockfile --production && yarn cache clean COPY . . # Stage 2: Production -FROM nginx:alpine3.15 +FROM nginx:alpine WORKDIR /etc/nginx COPY ./nginx.conf /etc/nginx/nginx.conf WORKDIR /usr/share/nginx/html From ed1230eee8fbcee8d14011831cdb016dc8c5fe0b Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 14:24:39 +0100 Subject: [PATCH 23/43] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ee3bd200..faabb934 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ RUN yarn install --frozen-lockfile --production && yarn cache clean COPY . . # Stage 2: Production -FROM nginx:alpine +FROM nginx:latest WORKDIR /etc/nginx COPY ./nginx.conf /etc/nginx/nginx.conf WORKDIR /usr/share/nginx/html From 46a14f0e463ca0faef92c3eb3384396d25bdf7a3 Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 14:29:04 +0100 Subject: [PATCH 24/43] Update Dockerfile --- Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index faabb934..62c94c88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,10 +7,8 @@ COPY . . # Stage 2: Production FROM nginx:latest -WORKDIR /etc/nginx COPY ./nginx.conf /etc/nginx/nginx.conf -WORKDIR /usr/share/nginx/html -COPY --from=build /app/build . +COPY --from=build /app/build /usr/share/nginx/html # Expose port 80 EXPOSE 80 From ef85f6782d6db9d20e1869b05c524d3dfbf7c312 Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 14:33:46 +0100 Subject: [PATCH 25/43] Update Dockerfile --- Dockerfile | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 62c94c88..16400a71 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,13 @@ -# Stage 1: Build +# Build FROM node:20.2-alpine AS build WORKDIR /app COPY package.json yarn.lock ./ -RUN yarn install --frozen-lockfile --production && yarn cache clean +RUN yarn install --frozen-lockfile COPY . . -# Stage 2: Production -FROM nginx:latest -COPY ./nginx.conf /etc/nginx/nginx.conf -COPY --from=build /app/build /usr/share/nginx/html +# Expose port 5000 +EXPOSE 5000 -# Expose port 80 -EXPOSE 80 - -# Healthcheck -HEALTHCHECK CMD curl --fail http://localhost:80 || exit 1 - -# Start Nginx server -CMD ["nginx", "-g", "daemon off;"] +# Start +ENV PORT=5000 +CMD ["yarn", "start"] From b8047a7988f3c61d9548ae461920e0fc8d3418d4 Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 14:34:21 +0100 Subject: [PATCH 26/43] Update Dockerfile --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 16400a71..4e7e2047 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,9 +5,9 @@ COPY package.json yarn.lock ./ RUN yarn install --frozen-lockfile COPY . . -# Expose port 5000 -EXPOSE 5000 +# Expose port 80 +EXPOSE 80 # Start -ENV PORT=5000 +ENV PORT=80 CMD ["yarn", "start"] From 4e4e034db2f9b22791d8a394a8691a64cad6d550 Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 14:40:47 +0100 Subject: [PATCH 27/43] Update Dockerfile --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4e7e2047..16400a71 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,9 +5,9 @@ COPY package.json yarn.lock ./ RUN yarn install --frozen-lockfile COPY . . -# Expose port 80 -EXPOSE 80 +# Expose port 5000 +EXPOSE 5000 # Start -ENV PORT=80 +ENV PORT=5000 CMD ["yarn", "start"] From bda105ceeb9d01ce980002ad30307ba5a29e286b Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 14:41:04 +0100 Subject: [PATCH 28/43] Update compose.yaml --- compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose.yaml b/compose.yaml index f1299f17..886b96bd 100644 --- a/compose.yaml +++ b/compose.yaml @@ -4,7 +4,7 @@ services: web: image: domoel/matrix-to:latest ports: - - "1336:80" + - "5000:5000" environment: - NODE_ENV=production volumes: From 8c2db8fdc55248d400048cab692454b20b4b9fd3 Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 14:41:22 +0100 Subject: [PATCH 29/43] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b750409..484313a7 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ services: web: image: domoel/matrix-to:latest ports: - - "1336:80" + - "5000:5000" environment: - NODE_ENV=production volumes: From 8fee384fc0c0b779c78a15cbfd117c76cbd99c7c Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 14:43:16 +0100 Subject: [PATCH 30/43] Update compose.yaml --- compose.yaml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/compose.yaml b/compose.yaml index 886b96bd..bc53dcf9 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,16 +1,11 @@ version: '3.8' services: - web: + matrix-to: + container_name: Matrix-to image: domoel/matrix-to:latest ports: - "5000:5000" + restart: unless-stopped environment: - - NODE_ENV=production - volumes: - - ./nginx.conf:/etc/nginx/nginx.conf - healthcheck: - test: ["CMD", "curl", "--fail", "http://localhost:80"] - interval: 30s - timeout: 10s - retries: 3 + - PORT=5000 From b75ca64d227ef09a96a483a66b5e6de29fa2021e Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 14:43:32 +0100 Subject: [PATCH 31/43] Update README.md --- README.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 484313a7..042bf50d 100644 --- a/README.md +++ b/README.md @@ -93,17 +93,12 @@ You can discuss matrix.to in version: '3.8' services: - web: + matrix-to: + container_name: Matrix-to image: domoel/matrix-to:latest ports: - "5000:5000" + restart: unless-stopped environment: - - NODE_ENV=production - volumes: - - ./nginx.conf:/etc/nginx/nginx.conf - healthcheck: - test: ["CMD", "curl", "--fail", "http://localhost:80"] - interval: 30s - timeout: 10s - retries: 3 + - PORT=5000 ``` From 84db9ecc9e9129c398698320797dcf1936ac9e7b Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 14:48:24 +0100 Subject: [PATCH 32/43] Update Dockerfile --- Dockerfile | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 16400a71..62c94c88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,20 @@ -# Build +# Stage 1: Build FROM node:20.2-alpine AS build WORKDIR /app COPY package.json yarn.lock ./ -RUN yarn install --frozen-lockfile +RUN yarn install --frozen-lockfile --production && yarn cache clean COPY . . -# Expose port 5000 -EXPOSE 5000 +# Stage 2: Production +FROM nginx:latest +COPY ./nginx.conf /etc/nginx/nginx.conf +COPY --from=build /app/build /usr/share/nginx/html -# Start -ENV PORT=5000 -CMD ["yarn", "start"] +# Expose port 80 +EXPOSE 80 + +# Healthcheck +HEALTHCHECK CMD curl --fail http://localhost:80 || exit 1 + +# Start Nginx server +CMD ["nginx", "-g", "daemon off;"] From 521b2adf67d91626242c17a21a5b43de9929f317 Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 14:49:27 +0100 Subject: [PATCH 33/43] Update Dockerfile --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 62c94c88..faabb934 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,8 +7,10 @@ COPY . . # Stage 2: Production FROM nginx:latest +WORKDIR /etc/nginx COPY ./nginx.conf /etc/nginx/nginx.conf -COPY --from=build /app/build /usr/share/nginx/html +WORKDIR /usr/share/nginx/html +COPY --from=build /app/build . # Expose port 80 EXPOSE 80 From 58890a7c9d7ccc225b3bce36dcf50d0a73de64a2 Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 14:52:15 +0100 Subject: [PATCH 34/43] Update Dockerfile --- Dockerfile | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index faabb934..16400a71 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,13 @@ -# Stage 1: Build +# Build FROM node:20.2-alpine AS build WORKDIR /app COPY package.json yarn.lock ./ -RUN yarn install --frozen-lockfile --production && yarn cache clean +RUN yarn install --frozen-lockfile COPY . . -# Stage 2: Production -FROM nginx:latest -WORKDIR /etc/nginx -COPY ./nginx.conf /etc/nginx/nginx.conf -WORKDIR /usr/share/nginx/html -COPY --from=build /app/build . +# Expose port 5000 +EXPOSE 5000 -# Expose port 80 -EXPOSE 80 - -# Healthcheck -HEALTHCHECK CMD curl --fail http://localhost:80 || exit 1 - -# Start Nginx server -CMD ["nginx", "-g", "daemon off;"] +# Start +ENV PORT=5000 +CMD ["yarn", "start"] From 812469877581d9649cbb6a6057bd2c907e33b555 Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 16:22:52 +0100 Subject: [PATCH 35/43] Update README.md --- README.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 042bf50d..8b750409 100644 --- a/README.md +++ b/README.md @@ -93,12 +93,17 @@ You can discuss matrix.to in version: '3.8' services: - matrix-to: - container_name: Matrix-to + web: image: domoel/matrix-to:latest ports: - - "5000:5000" - restart: unless-stopped + - "1336:80" environment: - - PORT=5000 + - NODE_ENV=production + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf + healthcheck: + test: ["CMD", "curl", "--fail", "http://localhost:80"] + interval: 30s + timeout: 10s + retries: 3 ``` From 27ff8f19c7dbfd276d4ed1234f0803fbf2344e99 Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 16:23:19 +0100 Subject: [PATCH 36/43] Update Dockerfile --- Dockerfile | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 16400a71..dbf96be0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,23 @@ -# Build +# Stage 1: Build FROM node:20.2-alpine AS build WORKDIR /app COPY package.json yarn.lock ./ -RUN yarn install --frozen-lockfile +RUN yarn install COPY . . +RUN yarn build -# Expose port 5000 -EXPOSE 5000 +# Stage 2: Production +FROM nginx:alpine +WORKDIR /etc/nginx +COPY ./nginx.conf /etc/nginx/nginx.conf +WORKDIR /usr/share/nginx/html +COPY --from=build /app/build . -# Start -ENV PORT=5000 -CMD ["yarn", "start"] +# Expose port 80 +EXPOSE 80 + +# Healthcheck +HEALTHCHECK CMD curl --fail http://localhost:80 || exit 1 + +# Start Nginx server +CMD ["nginx", "-g", "daemon off;"] From 73200e8c27ec7abd1ebf4880d75aee626ada74b9 Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 16:23:32 +0100 Subject: [PATCH 37/43] Update compose.yaml --- compose.yaml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/compose.yaml b/compose.yaml index bc53dcf9..f1299f17 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,11 +1,16 @@ version: '3.8' services: - matrix-to: - container_name: Matrix-to + web: image: domoel/matrix-to:latest ports: - - "5000:5000" - restart: unless-stopped + - "1336:80" environment: - - PORT=5000 + - NODE_ENV=production + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf + healthcheck: + test: ["CMD", "curl", "--fail", "http://localhost:80"] + interval: 30s + timeout: 10s + retries: 3 From 05ebb904b25f5e334bf479339c59ddbc6749146f Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 16:24:32 +0100 Subject: [PATCH 38/43] Add files via upload --- nginx.conf | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 nginx.conf diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 00000000..9aecdb7f --- /dev/null +++ b/nginx.conf @@ -0,0 +1,34 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + + sendfile on; + keepalive_timeout 65; + + server { + listen 80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html; + } + + error_page 404 /404.html; + location = /404.html { + root /usr/share/nginx/html; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + } +} \ No newline at end of file From 4259af79bd871686c45930c558e4fc749aa99d64 Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 16:36:58 +0100 Subject: [PATCH 39/43] Update README.md --- README.md | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 8b750409..1ba4a2b8 100644 --- a/README.md +++ b/README.md @@ -90,20 +90,11 @@ You can discuss matrix.to in ### Build with docker compose ``` -version: '3.8' - -services: - web: + matrix-to: + container_name: Matrix-to image: domoel/matrix-to:latest ports: - "1336:80" environment: - NODE_ENV=production - volumes: - - ./nginx.conf:/etc/nginx/nginx.conf - healthcheck: - test: ["CMD", "curl", "--fail", "http://localhost:80"] - interval: 30s - timeout: 10s - retries: 3 ``` From 1205705555d1d1887c38689f6f383390f475766f Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 16:37:41 +0100 Subject: [PATCH 40/43] Update compose.yaml --- compose.yaml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/compose.yaml b/compose.yaml index f1299f17..fe9fffa3 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,16 +1,10 @@ version: '3.8' services: - web: + matrix-to: + container_name: Matrix-to image: domoel/matrix-to:latest ports: - "1336:80" environment: - NODE_ENV=production - volumes: - - ./nginx.conf:/etc/nginx/nginx.conf - healthcheck: - test: ["CMD", "curl", "--fail", "http://localhost:80"] - interval: 30s - timeout: 10s - retries: 3 From f1d33f3f636527bdcdfe19883323764b0bbcaef0 Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 16:37:55 +0100 Subject: [PATCH 41/43] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 1ba4a2b8..5ac8c68c 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,9 @@ You can discuss matrix.to in ### Build with docker compose ``` +version: '3.8' + +services: matrix-to: container_name: Matrix-to image: domoel/matrix-to:latest From b49724d83b427c48e4b24df6020a89612d8a942d Mon Sep 17 00:00:00 2001 From: Dome Date: Sat, 29 Mar 2025 00:35:20 +0100 Subject: [PATCH 42/43] Update Element.js --- src/open/clients/Element.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/open/clients/Element.js b/src/open/clients/Element.js index 54920b6f..360eaa99 100644 --- a/src/open/clients/Element.js +++ b/src/open/clients/Element.js @@ -25,6 +25,7 @@ const trustedWebInstances = [ "chat.mozilla.org", "webchat.kde.org", "app.gitter.im", + "chat.ztfr.de", ]; /** From 2e4ce0887455b3df764a472770a2878656e5f166 Mon Sep 17 00:00:00 2001 From: Dome Date: Sat, 29 Mar 2025 00:42:39 +0100 Subject: [PATCH 43/43] Update Element.js --- src/open/clients/Element.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/open/clients/Element.js b/src/open/clients/Element.js index 360eaa99..54920b6f 100644 --- a/src/open/clients/Element.js +++ b/src/open/clients/Element.js @@ -25,7 +25,6 @@ const trustedWebInstances = [ "chat.mozilla.org", "webchat.kde.org", "app.gitter.im", - "chat.ztfr.de", ]; /**