Removed pm2

This commit is contained in:
Alan Grainger
2025-03-07 13:38:42 +08:00
parent 326dade107
commit be604a24c8
4 changed files with 33 additions and 5 deletions
+1 -3
View File
@@ -10,8 +10,6 @@ WORKDIR /app
COPY app/ ./
RUN npm install pm2 -g
RUN chown -R node:node /app
USER node
@@ -29,4 +27,4 @@ RUN npx tsc --noCheck
HEALTHCHECK --interval=30s --start-period=10s --timeout=5s CMD wget -q --spider http://localhost:3000/share/healthcheck || exit 1
CMD ["pm2-runtime", "dist/index.js" ]
CMD ["node", "dist/index.js" ]
+11
View File
@@ -184,6 +184,17 @@ For example, to disable the download button for images, you would edit the `ligh
}
```
### Customising your error response pages
You can customise the responses that IPP sends for invalid requests. For example you could:
- Drop the connection entirely (no response).
- Redirect to a new website.
- Send a different status code.
- And so on...
See [Custom responses](docs/custom-responses.md) for more details.
## Troubleshooting
If you're using Cloudflare and having issues with videos not playing well, make sure your `/share/video/` paths are set to bypass cache.
+1 -1
View File
@@ -4,7 +4,7 @@
"scripts": {
"dev": "ts-node src/index.ts",
"build": "npx tsc",
"test": "podman build --build-arg PACKAGE_VERSION=$(npm pkg get version | xargs) --format docker -t immich-proxy-test .. && podman run --init -it -p=3000:3000 --env-file .env immich-proxy-test",
"test": "podman build --build-arg PACKAGE_VERSION=$(npm pkg get version | xargs) --format docker -t immich-proxy-test .. && podman run --init -it -p=3000:3000 --env-file .env --restart=always immich-proxy-test",
"start": "node dist/index.js"
},
"author": "Alan Grainger",
+20 -1
View File
@@ -66,6 +66,7 @@ const decodeCookie = (req: Request, _res: Response, next: NextFunction) => {
app.get(/^(|\/share)\/healthcheck$/, async (_req, res) => {
if (await immich.accessible()) {
res.send('ok')
throw new Error('asdf')
} else {
res.status(503).send()
}
@@ -164,8 +165,26 @@ app.get('*', (req, res) => {
respondToInvalidRequest(res, 404)
})
// Send the correct process error code for any uncaught exceptions
// so that Docker can gracefully restart the container
process.on('uncaughtException', (err) => {
console.error('There was an uncaught error', err)
server.close()
process.exit(1)
})
process.on('unhandledRejection', (reason, promise) => {
console.error('Unhandled Rejection at:', promise, 'reason:', reason)
server.close()
process.exit(1)
})
process.on('SIGTERM', () => {
console.log('Received SIGTERM. Gracefully shutting down...')
server.close()
process.exit(0)
})
// Start the ExpressJS server
const port = process.env.IPP_PORT || 3000
app.listen(port, () => {
const server = app.listen(port, () => {
console.log(dayjs().format() + ' Server started on port ' + port)
})