per-branch deployments
ericclemmons opened this issue · 1 comments
ericclemmons commented
Here's a crazy idea:
/routes/branch/:name
module.exports = async () => ...
- Clone that branch into that a
tmp
folder. return require(tmp)
In theory, this could work!
There would need to be a ~5 minute or ~10 minute timer to kill lambdas, but that's easy.
ericclemmons commented
This seems necessary, mainly because of the need to rewrite URLs:
With that said, the support for package.json
could be an option.
polydev
is the one starting processes, not the route. So the route doesn't know what thePORT
is. (Or does it!?)- The route needs to return an
async
route to do the install (maybe not withexecSync
, but we needreq.params
). - The problem with
PORT
is that the route is already listening on that port, so starting a new server needs guessing another port. (1${PORT}
? )
Here's a potential solution:
module.exports = (req, res) => {
const { branch } req.params
if (!started) {
execSync(...allTheThings)
require('./path/to/branch/server') // PORT should be set!
}
return httpProxyMiddleware(...)
}