aws-samples / aws-samples/eb-node-express-sample

Increase resilience and simplify the implementation

Aperta
#4 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
EJS
Stelle
279
Fork
247
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I have a suggestion to improve the resilience and align a bit more with industry standards.

You should **not** be doing clustering in your code. I adds noise and is right now preventing the script from running unclustered. There are pretty sweet tools to manage your process, bring it back up when it crashes, monitor it and finally cluster it. Tools like [PM2](https://github.com/Unitech/pm2)

What I suggest is to:
- add the `pm2` dependency to the `package.json`
- remove the clustering logic from `app.js`
- change the `npm start` command for `pm2 start app.js -i max` where `max` can easily be changed to any number to define the number of clusters to make.

PM2 also has the advantage to be hookable for remote monitoring with almost no effort, which could be interesting for this project.

Cheers

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia leggendo package.json e app.js per comprendere il comando di avvio attuale e la logica di clustering. Confronta la configurazione PM2 richiesta con il comportamento esistente del processo, quindi verifica che npm start avvii l'esempio come specificato e che il clustering non sia più gestito in app.js.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
express, node.js
Ambito
backend, devops
Tipo di issue
Refactoring
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.