@vevedh/create-feathers-app 0.1.0-rc.6 → 0.1.0-rc.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/compose.mjs +9 -5
- package/package.json +1 -1
package/lib/compose.mjs
CHANGED
|
@@ -94,12 +94,11 @@ services:
|
|
|
94
94
|
FEATHERS_ADAPTER: "${options.adapter}"
|
|
95
95
|
FEATHERS_SOCKETIO: "${options.transport === 'both' ? '1' : '0'}"
|
|
96
96
|
FEATHERS_API_PORT: "3030"
|
|
97
|
-
FEATHERS_SOCKET_PORT: "3031"
|
|
98
97
|
FEATHERS_PUBLIC_ORIGIN: "http://127.0.0.1:\${P4_HTTP_PORT:-8080}"
|
|
99
98
|
FEATHERS_PREVIEW_ORIGIN: "http://127.0.0.1:\${P4_HTTP_PORT:-8080}"
|
|
100
99
|
expose:
|
|
101
100
|
- "3030"
|
|
102
|
-
|
|
101
|
+
networks:
|
|
103
102
|
- backend
|
|
104
103
|
security_opt:
|
|
105
104
|
- no-new-privileges:true
|
|
@@ -140,7 +139,7 @@ COPY package.json pnpm-lock.yaml ./
|
|
|
140
139
|
RUN corepack pnpm install --frozen-lockfile --prod
|
|
141
140
|
COPY api ./api
|
|
142
141
|
USER node
|
|
143
|
-
EXPOSE 3030
|
|
142
|
+
EXPOSE 3030
|
|
144
143
|
CMD ["node", "api/server.mjs"]
|
|
145
144
|
`
|
|
146
145
|
|
|
@@ -179,7 +178,7 @@ function nginx(options) {
|
|
|
179
178
|
proxy_read_timeout 30s;
|
|
180
179
|
}
|
|
181
180
|
${options.transport === 'both' ? ` location /socket.io/ {
|
|
182
|
-
proxy_pass http://api:
|
|
181
|
+
proxy_pass http://api:3030;
|
|
183
182
|
proxy_http_version 1.1;
|
|
184
183
|
proxy_set_header Upgrade $http_upgrade;
|
|
185
184
|
proxy_set_header Connection "upgrade";
|
|
@@ -237,8 +236,13 @@ export function enableCompose(files, options) {
|
|
|
237
236
|
created.set('infra/compose/nginx.conf', nginx(options))
|
|
238
237
|
// The only Docker interface bound to all container addresses is the private API listener.
|
|
239
238
|
requireExact(files, 'api/server.mjs', "const realtime = process.env.FEATHERS_SOCKETIO === '1'", "const bindHost = process.env.FEATHERS_BIND_HOST === '0.0.0.0' ? '0.0.0.0' : '127.0.0.1'\nconst realtime = process.env.FEATHERS_SOCKETIO === '1'")
|
|
240
|
-
requireExact(files, 'api/server.mjs', "
|
|
239
|
+
requireExact(files, 'api/server.mjs', "const wsPort = Number(process.env.FEATHERS_SOCKET_PORT || 3031)\n", '')
|
|
240
|
+
requireExact(files, 'api/server.mjs', ' || !Number.isInteger(wsPort) || wsPort === port', '')
|
|
241
|
+
requireExact(files, 'api/server.mjs', "socketio: realtime ? { port: wsPort, origins: [...new Set([origin, previewOrigin])], host: '127.0.0.1' } : false,", "socketio: realtime ? { mode: 'external', origins: [...new Set([origin, previewOrigin])] } : false,")
|
|
242
|
+
requireExact(files, 'api/server.mjs', 'await runtime.start()\nconst httpServer = createServer', 'const httpServer = createServer')
|
|
241
243
|
requireExact(files, 'api/server.mjs', "httpServer.listen(port, '127.0.0.1', resolve)", 'httpServer.listen(port, bindHost, resolve)')
|
|
244
|
+
requireExact(files, 'api/server.mjs', ' httpServer.listen(port, bindHost, resolve)\n})', ' httpServer.listen(port, bindHost, resolve)\n})\nif (realtime) await runtime.start(httpServer)\nelse await runtime.start()')
|
|
245
|
+
requireExact(files, 'api/server.mjs', ' await new Promise(resolve => httpServer.close(resolve))\n await runtime.close()', ' await runtime.close()\n if (httpServer.listening) await new Promise(resolve => httpServer.close(resolve))')
|
|
242
246
|
}
|
|
243
247
|
created.set('.dockerignore', dockerIgnore)
|
|
244
248
|
for (const [key, content] of created) {
|