From 4e589e105e383ffa507a719d4bf2c142ab9888b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=A9o=20M=C3=A9vollon?= Date: Sat, 22 Jul 2023 13:48:30 +0200 Subject: [PATCH 1/2] working SSE in compose --- deploy/docker-compose.yaml | 26 +++++++ deploy/nginx.conf | 32 +++++++++ packages/client/package.json | 6 +- packages/client/src/hooks/useDbId.ts | 2 +- packages/server/package.json | 4 +- pnpm-lock.yaml | 100 +++++++++++++-------------- 6 files changed, 114 insertions(+), 56 deletions(-) create mode 100644 deploy/docker-compose.yaml create mode 100644 deploy/nginx.conf diff --git a/deploy/docker-compose.yaml b/deploy/docker-compose.yaml new file mode 100644 index 0000000..7ac9734 --- /dev/null +++ b/deploy/docker-compose.yaml @@ -0,0 +1,26 @@ +services: + nginx: + image: nginx:alpine + environment: + - TZ=Europe/Paris + ports: + - 80:80 + volumes: + - ./nginx.conf:/etc/nginx/conf.d/default.conf + + contmi-client: + # image: ghcr.io/matmut7/contmi/client:latest + build: + context: ../ + dockerfile: ./packages/client/Dockerfile + + contmi-server: + # image: ghcr.io/matmut7/contmi/server:latest + build: + context: ../ + dockerfile: ./packages/server/Dockerfile + volumes: + - contmi:/app/packages/server/dbs + +volumes: + contmi: diff --git a/deploy/nginx.conf b/deploy/nginx.conf new file mode 100644 index 0000000..90213e4 --- /dev/null +++ b/deploy/nginx.conf @@ -0,0 +1,32 @@ +resolver 127.0.0.11 valid=1s ipv6=off; + +server { + server_name _; + listen 80 default_server; + + location / { + set $contmi_client contmi-client; + proxy_pass http://$contmi_client:80; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + location /sync { + set $contmi_server contmi-server; + proxy_pass http://$contmi_server:3000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Connection ''; + proxy_http_version 1.1; + chunked_transfer_encoding off; + proxy_buffering off; + proxy_cache off; + } + + +} + diff --git a/packages/client/package.json b/packages/client/package.json index d28807d..bdbc7cb 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -14,9 +14,9 @@ "@emotion/styled": "^11.11.0", "@mui/icons-material": "^5.11.16", "@mui/material": "^5.13.6", - "@vlcn.io/crsqlite-wasm": "^0.13.0", - "@vlcn.io/direct-connect-browser": "^0.3.0", - "@vlcn.io/react": "^2.3.0", + "@vlcn.io/crsqlite-wasm": "^0.14.0", + "@vlcn.io/direct-connect-browser": "^0.4.0", + "@vlcn.io/react": "^2.4.0", "lodash": "^4.17.21", "nanoid": "^4.0.2", "react": "^18.2.0", diff --git a/packages/client/src/hooks/useDbId.ts b/packages/client/src/hooks/useDbId.ts index 62a068c..d7bbfe7 100644 --- a/packages/client/src/hooks/useDbId.ts +++ b/packages/client/src/hooks/useDbId.ts @@ -1,3 +1,3 @@ export function useDbId() { - return "test"; + return "2A6FBCD93EACD7F1"; } diff --git a/packages/server/package.json b/packages/server/package.json index f891116..8e7c9a3 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -15,8 +15,8 @@ ] }, "dependencies": { - "@vlcn.io/direct-connect-common": "^0.4.0", - "@vlcn.io/direct-connect-nodejs": "^0.4.0", + "@vlcn.io/direct-connect-common": "^0.5.0", + "@vlcn.io/direct-connect-nodejs": "^0.5.0", "cors": "^2.8.5", "express": "^4.18.2", "pino-http": "^8.3.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 18da130..7777ef5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -30,14 +30,14 @@ importers: specifier: ^5.13.6 version: 5.13.6(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(@types/react@18.2.14)(react-dom@18.2.0)(react@18.2.0) '@vlcn.io/crsqlite-wasm': - specifier: ^0.13.0 - version: 0.13.0 + specifier: ^0.14.0 + version: 0.14.0 '@vlcn.io/direct-connect-browser': - specifier: ^0.3.0 - version: 0.3.0 + specifier: ^0.4.0 + version: 0.4.0 '@vlcn.io/react': - specifier: ^2.3.0 - version: 2.3.0(react@18.2.0) + specifier: ^2.4.0 + version: 2.4.0(react@18.2.0) lodash: specifier: ^4.17.21 version: 4.17.21 @@ -102,11 +102,11 @@ importers: packages/server: dependencies: '@vlcn.io/direct-connect-common': - specifier: ^0.4.0 - version: 0.4.0 + specifier: ^0.5.0 + version: 0.5.0 '@vlcn.io/direct-connect-nodejs': - specifier: ^0.4.0 - version: 0.4.0 + specifier: ^0.5.0 + version: 0.5.0 cors: specifier: ^2.8.5 version: 2.8.5 @@ -1794,69 +1794,69 @@ packages: - supports-color dev: true - /@vlcn.io/crsqlite-wasm@0.13.0: - resolution: {integrity: sha512-Hnm6bewwAP4gcm4nCYZFLvqb+I2FjljpiNZAlDoBFLpV32MTLk5v67Vwf13YD0HsvzqLJswAs1JPg3WuSxTofg==} + /@vlcn.io/crsqlite-wasm@0.14.0: + resolution: {integrity: sha512-h7qEpECLZ27hrq1IwuoOJ9s4Dq+5pFjYa8Dpsn6n2qkUfCBe6Tkwc3NQkIKXTpnUrw4EMtr6sSMNSUADR9gBVQ==} dependencies: - '@vlcn.io/wa-sqlite': 0.19.0 - '@vlcn.io/xplat-api': 0.12.0 + '@vlcn.io/wa-sqlite': 0.20.0 + '@vlcn.io/xplat-api': 0.13.0 async-mutex: 0.4.0 dev: false - /@vlcn.io/crsqlite@0.13.0: - resolution: {integrity: sha512-PfR9sP923W8rMhckrf/8WDccsbJg3vmI363xhW2AlbVvRMzH6PfiXBQz4sAmUmYLokHwzQnOr5nKOLYS0SHIYQ==} + /@vlcn.io/crsqlite@0.14.0: + resolution: {integrity: sha512-b0p/Sc68pnbUyxr3WTb7FA7CatX/XEwV3ZdvIIz7TxMmK619LHnVrt3qJWePuNDpCHOx2IttwSHA69BudIk4rQ==} requiresBuild: true dev: false - /@vlcn.io/direct-connect-browser@0.3.0: - resolution: {integrity: sha512-rYCsfxJnfwrGknVe3zbs5WIh2zpqVBTQ36jzdxCTXO+fWbTEcq0gV4P/z1J2tKsRH5F0shS+boExg0zdRcCE6g==} + /@vlcn.io/direct-connect-browser@0.4.0: + resolution: {integrity: sha512-u9A847QPoJm1gOh6UpCRCxg2xf3mdAOYONXYOonwaxx4GGM9nLFR+B3WIySY0XmBr8lNEp9WwuVv+t56xaA1Vg==} dependencies: - '@vlcn.io/crsqlite-wasm': 0.13.0 - '@vlcn.io/direct-connect-common': 0.4.0 - '@vlcn.io/rx-tbl': 0.12.0 - '@vlcn.io/xplat-api': 0.12.0 + '@vlcn.io/crsqlite-wasm': 0.14.0 + '@vlcn.io/direct-connect-common': 0.5.0 + '@vlcn.io/rx-tbl': 0.13.0 + '@vlcn.io/xplat-api': 0.13.0 dev: false - /@vlcn.io/direct-connect-common@0.4.0: - resolution: {integrity: sha512-e4hMxc4d0UMLnSNYOc+MeOmm/5YNl5jSlRXBMox6+1sbtwfMApGhiezDKHX+ymyHmASTHLb8DNWw8kM0aQT0/g==} + /@vlcn.io/direct-connect-common@0.5.0: + resolution: {integrity: sha512-ulnTCLX8bMdfU8f5uEm2NU5kOwVlRCPqVvYa4Hn2lJ13GXkBJlqRm8ndRCQD6b1dYKEbhm/Pdkr+GaH9ODsAtg==} dependencies: lib0: 0.2.78 dev: false - /@vlcn.io/direct-connect-nodejs@0.4.0: - resolution: {integrity: sha512-nteu0ujjD/WuNjotrjPGg1NitKhSxMCX122rsykJFI2nRTukb8tZybEMVwh9wGaBviH1rm2jRw3myiwi/GROGg==} + /@vlcn.io/direct-connect-nodejs@0.5.0: + resolution: {integrity: sha512-tV8EfeIq0jSz4o97+qcvMRiIKwzkFOhsvNmRwErCBmF+3GRXdG93tGIEBEhmPo3SUK0HL+gmJEtW6u56t+kMBA==} dependencies: - '@vlcn.io/crsqlite': 0.13.0 - '@vlcn.io/direct-connect-common': 0.4.0 - '@vlcn.io/xplat-api': 0.12.0 - better-sqlite3: 8.4.0 + '@vlcn.io/crsqlite': 0.14.0 + '@vlcn.io/direct-connect-common': 0.5.0 + '@vlcn.io/xplat-api': 0.13.0 + better-sqlite3: 8.5.0 chokidar: 3.5.3 throttle-debounce: 5.0.0 dev: false - /@vlcn.io/react@2.3.0(react@18.2.0): - resolution: {integrity: sha512-hJioo/uBwbVjbuRtkgmeBoaP+5j1YxfQpR7t91cQTaRnYn0ycOGxxuREySjWeV755dT+IOSEinCc2sb13t18TQ==} + /@vlcn.io/react@2.4.0(react@18.2.0): + resolution: {integrity: sha512-vPBDACC0HEshJlL2YeLUfgbPapEO5gch4UcMjYrUcKExySFM07IO3x7Fz5PLLJWYY2i6/edyshihqZbl3QbOZw==} peerDependencies: react: ^18 dependencies: - '@vlcn.io/crsqlite-wasm': 0.13.0 - '@vlcn.io/direct-connect-browser': 0.3.0 - '@vlcn.io/rx-tbl': 0.12.0 - '@vlcn.io/xplat-api': 0.12.0 + '@vlcn.io/crsqlite-wasm': 0.14.0 + '@vlcn.io/direct-connect-browser': 0.4.0 + '@vlcn.io/rx-tbl': 0.13.0 + '@vlcn.io/xplat-api': 0.13.0 react: 18.2.0 dev: false - /@vlcn.io/rx-tbl@0.12.0: - resolution: {integrity: sha512-2hXrBt+q2G61wiT02OV7PlPNsBd75xGqD6gpWOyJeqjF3SgjfwmQUr3AodkrYusN5kUZ2BuICw/PV7R3LfsKhQ==} + /@vlcn.io/rx-tbl@0.13.0: + resolution: {integrity: sha512-vInhGhk5+76uUG05h/5p1Lzmxx/RNpXNyFRatMpTX/VcNfAK8z+1jqMWvQBq6eyfPya8p8IEmCkmpmtdgtdAgg==} dependencies: - '@vlcn.io/xplat-api': 0.12.0 + '@vlcn.io/xplat-api': 0.13.0 dev: false - /@vlcn.io/wa-sqlite@0.19.0: - resolution: {integrity: sha512-Rzu4d1zdnfjVkMMXV0YE7aiMRz2ro6eJ1SM94Fpt7NLDGOt69U7t50lBxaEogSDwMvGG1PpPcd4wapGnA6zKIA==} + /@vlcn.io/wa-sqlite@0.20.0: + resolution: {integrity: sha512-CkEtg6L6g1QiTupOJUYJkJOWFBTrrfkQxsvbOFkcWqLBi4389TOGnGYK9p5Fy0w8pZh8lTD5xjIL62h8mObkOQ==} dev: false - /@vlcn.io/xplat-api@0.12.0: - resolution: {integrity: sha512-6MKe6RWSDXeql2iZ2fskske/dVHiqFmBciNv4s8czcGSmyvVNfP4Fz1r5lzCxHjCslP0lVSu3DAtWfD+2YKuoA==} + /@vlcn.io/xplat-api@0.13.0: + resolution: {integrity: sha512-dgAcX9iEwx/3+uVzlkLRIZvsJf0XXiffepWudXPpLlkWp8mTZ2eUwoHOWgISWBUTOUQ3jtmZRHqVZgySegRE/w==} dependencies: comlink: 4.4.1 dev: false @@ -2050,8 +2050,8 @@ packages: is-windows: 1.0.2 dev: true - /better-sqlite3@8.4.0: - resolution: {integrity: sha512-NmsNW1CQvqMszu/CFAJ3pLct6NEFlNfuGM6vw72KHkjOD1UDnL96XNN1BMQc1hiHo8vE2GbOWQYIpZ+YM5wrZw==} + /better-sqlite3@8.5.0: + resolution: {integrity: sha512-vbPcv/Hx5WYdyNg/NbcfyaBZyv9s/NVbxb7yCeC5Bq1pVocNxeL2tZmSu3Rlm4IEOTjYdGyzWQgyx0OSdORBzw==} requiresBuild: true dependencies: bindings: 1.5.0 @@ -2480,8 +2480,8 @@ packages: engines: {node: '>=8'} dev: true - /detect-libc@2.0.1: - resolution: {integrity: sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==} + /detect-libc@2.0.2: + resolution: {integrity: sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==} engines: {node: '>=8'} dev: false @@ -3883,7 +3883,7 @@ packages: resolution: {integrity: sha512-iwXuFrMAcFVi/ZoZiqq8BzAdsLw9kxDfTC0HMyjXfSL/6CSDAGD5UmR7azrAgWV1zKYq7dUUMj4owusBWKLsiQ==} engines: {node: '>=10'} dependencies: - semver: 7.5.2 + semver: 7.5.4 dev: false /node-releases@2.0.12: @@ -4234,7 +4234,7 @@ packages: engines: {node: '>=10'} hasBin: true dependencies: - detect-libc: 2.0.1 + detect-libc: 2.0.2 expand-template: 2.0.3 github-from-package: 0.0.0 minimist: 1.2.8 @@ -4582,6 +4582,7 @@ packages: hasBin: true dependencies: lru-cache: 6.0.0 + dev: true /semver@7.5.4: resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==} @@ -4589,7 +4590,6 @@ packages: hasBin: true dependencies: lru-cache: 6.0.0 - dev: true /send@0.18.0: resolution: {integrity: sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==} From 76f189f41ec32864d03366ed59901b36e76aaf5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=A9o=20M=C3=A9vollon?= Date: Sat, 22 Jul 2023 13:57:57 +0200 Subject: [PATCH 2/2] docs(changeset): update vlcn dpenedencies and use conform hard coded DB id --- .changeset/polite-moose-itch.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/polite-moose-itch.md diff --git a/.changeset/polite-moose-itch.md b/.changeset/polite-moose-itch.md new file mode 100644 index 0000000..8841500 --- /dev/null +++ b/.changeset/polite-moose-itch.md @@ -0,0 +1,6 @@ +--- +"client": patch +"server": patch +--- + +update vlcn dpenedencies and use conform hard coded DB id