There should be a mechanism to route calls to the QEWD server to any IP/URL for development
pacharanero opened this issue · 1 comments
Current situation
-
Currently Pulsetile (in both development and live use) expects QEWD to be running on
localhost
. -
In Live we serve the Pulsetile application from the web root of a QEWD server (the 'QEWD-Conductor-PHR' microservice has a web root here which currently contains a copy of Pulsetile/Helm build files.
-
In Dev, we have great difficulty getting all of the Microservices running and working with the developed-on version of Pulsetile - because we want to use the Webpack Dev Server and not have to copy build files into the web root of QEWD-Conductor-PHR
What needs to change and why
-
Ideally, as we scale, we should be able to have Pulsetile running on a completely separate server, and be able to 'tell' Pulsetile where to find the QEWD-Conductor-PHR service via configuration.
-
Similarly, in Dev, we want to be able to have completely separated services running in Docker containers, allowing us to make a very easy-to-use development environment pre-configured to run QEWD and EtherCIS. All the Pulsetile developer should need to know is the IP/URL of the QEWD-Conductor-PHR and poitn Pulsetile at this.
Proposed solution
- In Development we can proxy calls to
api/
to a route of our choosing:
// webpackconfig.dev.js
const QEWD_SERVER_URL = 'http://localhost:8000';
...
devServer: {
host: 'localhost',
port: 3000,
// respond to 404s with index.html
historyApiFallback: true,
// enable HMR on the server
hot: true,
// proxy calls to /api out to the QEWD middleware
proxy: {
'/api': {
target: QEWD_SERVER_URL,
// secure: false,
},
},
},
- I am currently testing this approach but am open to other suggestions regarding the best way to connect the two servers so that they are technically decoupled from each other.
- In particular I'm interested to know if the same approach can be used in Live, when we would probably put Pulsetile behind a server such as NGINX. Would NGINX be able to route all
localhost/api/
requests to a different server (the QEWD Conductor)? If not we would need a different approach which will allow us to specify the IP/URL of the QEWD Conductor.
In the absence of comments from any of the rest of the PT team, I'm closing this issue since it does seem that the proxy definition in webpack.conf.dev.js does work for defining the connection to QEWD