@@ -93,6 +93,10 @@ class="w-24 dark:bg-coolgray-200 dark:hover:bg-coolgray-300">Cancel
9393 modalOpen: false ,
9494 showProgress: false ,
9595 currentStatus: ' ' ,
96+ checkHealthInterval: null ,
97+ checkIfIamDeadInterval: null ,
98+ healthCheckAttempts: 0 ,
99+ startTime: null ,
96100 confirmed () {
97101 this .showProgress = true ;
98102 this .$wire .$call (' upgrade' )
@@ -102,43 +106,78 @@ class="w-24 dark:bg-coolgray-200 dark:hover:bg-coolgray-300">Cancel
102106 event .returnValue = ' ' ;
103107 });
104108 },
109+ getReviveStatusMessage (elapsedMinutes , attempts ) {
110+ if (elapsedMinutes === 0 ) {
111+ return ` Waiting for Coolify to come back online... (attempt ${ attempts} )` ;
112+ } else if (elapsedMinutes < 2 ) {
113+ return ` Waiting for Coolify to come back online... (${ elapsedMinutes} minute${ elapsedMinutes !== 1 ? ' s' : ' ' } elapsed)` ;
114+ } else if (elapsedMinutes < 5 ) {
115+ return ` Update in progress, this may take several minutes... (${ elapsedMinutes} minutes elapsed)` ;
116+ } else if (elapsedMinutes < 10 ) {
117+ return ` Large updates can take 10+ minutes. Please be patient... (${ elapsedMinutes} minutes elapsed)` ;
118+ } else {
119+ return ` Still updating. If this takes longer than 15 minutes, please check server logs... (${ elapsedMinutes} minutes elapsed)` ;
120+ }
121+ },
105122 revive () {
106- if (checkHealthInterval) return true ;
123+ if (this .checkHealthInterval ) return true ;
124+ this .healthCheckAttempts = 0 ;
125+ this .startTime = Date .now ();
107126 console .log (' Checking server\' s health...' )
108- checkHealthInterval = setInterval (() => {
127+ this .checkHealthInterval = setInterval (() => {
128+ this .healthCheckAttempts ++ ;
129+ const elapsedMinutes = Math .floor ((Date .now () - this .startTime ) / 60000 );
109130 fetch (' /api/health' )
110131 .then (response => {
111132 if (response .ok ) {
112133 this .currentStatus =
113- ' Coolify is back online. Reloading this page (you can manually reload if its not done automatically)...' ;
114- if (checkHealthInterval) clearInterval (
115- checkHealthInterval);
134+ ' Coolify is back online. Reloading this page in 5 seconds...' ;
135+ if (this .checkHealthInterval ) {
136+ clearInterval (this .checkHealthInterval );
137+ this .checkHealthInterval = null ;
138+ }
116139 setTimeout (() => {
117140 window .location .reload ();
118141 }, 5000 )
119142 } else {
120- this .currentStatus =
121- " Waiting for Coolify to come back from the dead... "
143+ this .currentStatus = this . getReviveStatusMessage (elapsedMinutes, this
144+ . healthCheckAttempts );
122145 }
123146 })
147+ .catch (error => {
148+ console .error (' Health check failed:' , error);
149+ this .currentStatus = this .getReviveStatusMessage (elapsedMinutes, this
150+ .healthCheckAttempts );
151+ });
124152 }, 2000 );
125153 },
126154 upgrade () {
127- if (checkIfIamDeadInterval || this . $wire .showProgress ) return true ;
128- this .currentStatus = ' Pulling new images and updating Coolify.' ;
129- checkIfIamDeadInterval = setInterval (() => {
155+ if (this . checkIfIamDeadInterval || this .showProgress ) return true ;
156+ this .currentStatus = ' Update in progress. Pulling new images and preparing to restart Coolify.. .' ;
157+ this . checkIfIamDeadInterval = setInterval (() => {
130158 fetch (' /api/health' )
131159 .then (response => {
132160 if (response .ok ) {
133- this .currentStatus = " Waiting for the update process..."
134- } else {
135161 this .currentStatus =
136- " Update done, restarting Coolify & waiting until it is revived!"
137- if (checkIfIamDeadInterval) clearInterval (
138- checkIfIamDeadInterval);
162+ " Update in progress. Pulling new images and preparing to restart Coolify..."
163+ } else {
164+ this .currentStatus = " Coolify is restarting with the new version..."
165+ if (this .checkIfIamDeadInterval ) {
166+ clearInterval (this .checkIfIamDeadInterval );
167+ this .checkIfIamDeadInterval = null ;
168+ }
139169 this .revive ();
140170 }
141171 })
172+ .catch (error => {
173+ console .error (' Health check failed:' , error);
174+ this .currentStatus = " Coolify is restarting with the new version..."
175+ if (this .checkIfIamDeadInterval ) {
176+ clearInterval (this .checkIfIamDeadInterval );
177+ this .checkIfIamDeadInterval = null ;
178+ }
179+ this .revive ();
180+ });
142181 }, 2000 );
143182 }
144183
0 commit comments