Skip to content

Commit 3bc4601

Browse files
committed
immer noch nicht
1 parent ae115e0 commit 3bc4601

3 files changed

Lines changed: 38 additions & 7 deletions

File tree

app.js

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,32 @@ app.use((req, res) => {
146146
res.status(404).sendFile(path.join(__dirname, 'public', '404.html'));
147147
})
148148

149-
// Export für Passenger
150-
module.exports = app
149+
// Better error handling for uncaught exceptions
150+
process.on('uncaughtException', (err) => {
151+
console.error('Uncaught exception:', err);
152+
// Don't exit the process, just log the error
153+
});
154+
155+
// Better error handling for unhandled promise rejections
156+
process.on('unhandledRejection', (reason, promise) => {
157+
console.error('Unhandled Rejection at:', promise, 'reason:', reason);
158+
// Don't exit the process, just log the error
159+
});
151160

152-
// Start Server wenn direkt ausgeführt
153-
if (require.main === module) {
154-
const port = process.env.PORT || 80
161+
// Improve the export for Passenger
162+
if (typeof(PhusionPassenger) !== 'undefined') {
163+
PhusionPassenger.configure({ autoInstall: false });
164+
165+
const port = process.env.PORT || 80;
166+
app.listen(port, '0.0.0.0', () => {
167+
console.log(`VATSIM PMP running in Passenger mode on port ${port}`);
168+
});
169+
} else if (require.main === module) {
170+
const port = process.env.PORT || 80;
155171
app.listen(port, () => {
156-
console.log(`VATSIM PMP running on port ${port}`)
157-
})
172+
console.log(`VATSIM PMP running in standalone mode on port ${port}`);
173+
});
158174
}
175+
176+
// Export for Passenger
177+
module.exports = app

passenger.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"app_type": "node",
3+
"startup_file": "app.js",
4+
"environment": "production",
5+
"port": 80,
6+
"log_file": "passenger.log",
7+
"daemonize": true,
8+
"user": "nobody"
9+
}

restart.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
touch tmp/restart.txt
3+
echo "App restart triggered at $(date)"

0 commit comments

Comments
 (0)