Merge branch 'release/v1.1.0'
continuous-integration/drone/push Build is passing Details

pull/2/head v1.1.0
Fionn 2 years ago
commit d8432315d5

@ -1,2 +1,2 @@
.git .git
node_modules **/node_modules

@ -6,7 +6,7 @@ This service is designed to gather weather data to be used by [IASsure](https://
## Installation/Deployment ## Installation/Deployment
IASsure-WX can be installed using docker. The image is available at `git.fsisp.de/fionn/iassure`. IASsure-WX can be installed using docker. The image is available at `git.fsisp.de/fionn/iassure-wx`.
Tags: Tags:
- `latest` - The newest recommended build, built from `main` - `latest` - The newest recommended build, built from `main`

@ -1,6 +1,6 @@
{ {
"name": "app", "name": "app",
"version": "1.0.0", "version": "1.1.0",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"type": "module", "type": "module",

@ -4,14 +4,14 @@ import morgan from 'morgan';
import router from './router'; import router from './router';
import wxService from './services/wx.service'; import wxService from './services/wx.service';
const { PORT = 3000 } = process.env; const { PORT = 3000, BASE_PATH = '/api' } = process.env;
const app = express(); const app = express();
app.set('trust proxy', true); app.set('trust proxy', true);
app.use(morgan('combined')); app.use(morgan('combined'));
app.use('/api', router.router); app.use(BASE_PATH, router.router);
const frontendRoot = '/opt/frontend/dist'; const frontendRoot = '/opt/frontend/dist';
app.use(express.static(frontendRoot)); app.use(express.static(frontendRoot));
@ -28,8 +28,24 @@ app.use((err, req: Request, res: Response, next: NextFunction) => {
nodesched.scheduleJob('regenerate data', '*/30 * * * * *', wxService.wrappedGenerateData) nodesched.scheduleJob('regenerate data', '*/30 * * * * *', wxService.wrappedGenerateData)
wxService.wrappedGenerateData(); wxService.wrappedGenerateData();
app.listen(PORT, () => { const server = app.listen(PORT, () => {
console.log( console.log(
`application is listening on port ${PORT}`, `application is listening on port ${PORT}`,
); );
}); });
const shutdown = (signal: string) => {
console.log(`${signal} signal received. Shutting down.`);
server.close((err) => {
if (err) {
console.error(`Failed to shut down server gracefully: ${err}`);
process.exit(1);
}
console.log('Server closed');
process.exit(0);
});
};
process.on('SIGTERM', () => shutdown('SIGTERM'));
process.on('SIGINT', () => shutdown('SIGINT'));

Loading…
Cancel
Save