@colyseus/tools 0.15.47 → 0.15.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/pm2/post-deploy-agent.js +6 -1
- package/post-deploy.js +3 -6
package/package.json
CHANGED
package/pm2/post-deploy-agent.js
CHANGED
|
@@ -133,7 +133,7 @@ function postDeploy(cwd, reply) {
|
|
|
133
133
|
* - Stop old processes
|
|
134
134
|
* - Spawn/reactivate the rest of the processes (shared.MAX_ACTIVE_PROCESSES)
|
|
135
135
|
*/
|
|
136
|
-
const onFirstAppsStart = (initialApps, err, result) => {
|
|
136
|
+
const onFirstAppsStart = async (initialApps, err, result) => {
|
|
137
137
|
/**
|
|
138
138
|
* release post-deploy action while proceeding with graceful restart of other processes
|
|
139
139
|
*/
|
|
@@ -149,6 +149,11 @@ function postDeploy(cwd, reply) {
|
|
|
149
149
|
*/
|
|
150
150
|
writeNginxConfig(initialApps);
|
|
151
151
|
|
|
152
|
+
//
|
|
153
|
+
// Wait 1.5 seconds to ensure NGINX is updated & reloaded
|
|
154
|
+
//
|
|
155
|
+
await new Promise(resolve => setTimeout(resolve, 1500));
|
|
156
|
+
|
|
152
157
|
//
|
|
153
158
|
// Asynchronously stop/restart apps with active connections
|
|
154
159
|
// (They make take from minutes up to hours to stop)
|
package/post-deploy.js
CHANGED
|
@@ -22,8 +22,6 @@ if (!CONFIG_FILE) {
|
|
|
22
22
|
|
|
23
23
|
const CONFIG_FILE_PATH = `${pm2.cwd}/${CONFIG_FILE}`;
|
|
24
24
|
|
|
25
|
-
let config = undefined;
|
|
26
|
-
|
|
27
25
|
/**
|
|
28
26
|
* Try to handle post-deploy via PM2 module first (pm2 install @colyseus/tools)
|
|
29
27
|
* If not available, fallback to legacy post-deploy script.
|
|
@@ -31,7 +29,6 @@ let config = undefined;
|
|
|
31
29
|
pm2.trigger('@colyseus/tools', 'post-deploy', `${pm2.cwd}:${CONFIG_FILE_PATH}`, async function (err, result) {
|
|
32
30
|
if (err) {
|
|
33
31
|
console.log("Proceeding with legacy post-deploy script...");
|
|
34
|
-
config = await shared.getAppConfig(CONFIG_FILE_PATH);
|
|
35
32
|
postDeploy();
|
|
36
33
|
|
|
37
34
|
} else {
|
|
@@ -53,7 +50,7 @@ async function postDeploy() {
|
|
|
53
50
|
//
|
|
54
51
|
// first deploy
|
|
55
52
|
//
|
|
56
|
-
pm2.start(
|
|
53
|
+
pm2.start(CONFIG_FILE_PATH, { ...opts }, () => onAppRunning());
|
|
57
54
|
|
|
58
55
|
} else {
|
|
59
56
|
|
|
@@ -88,13 +85,13 @@ function restartAll () {
|
|
|
88
85
|
pm2.delete('all', function (err) {
|
|
89
86
|
// kill & start again
|
|
90
87
|
pm2.kill(function () {
|
|
91
|
-
pm2.start(
|
|
88
|
+
pm2.start(CONFIG_FILE_PATH, { ...opts }, () => onAppRunning());
|
|
92
89
|
});
|
|
93
90
|
});
|
|
94
91
|
}
|
|
95
92
|
|
|
96
93
|
function reloadAll(retry = 0) {
|
|
97
|
-
pm2.reload(
|
|
94
|
+
pm2.reload(CONFIG_FILE_PATH, { ...opts }, function (err, apps) {
|
|
98
95
|
if (err) {
|
|
99
96
|
//
|
|
100
97
|
// Retry in case of "Reload in progress" error.
|