Placeholder for phase 1 and 2

This commit is contained in:
Kasra Bigdeli
2019-02-18 23:47:45 -08:00
parent 43295c08b3
commit b7b5d8e414
3 changed files with 25 additions and 1 deletions
+16
View File
@@ -62,6 +62,22 @@ export default class BackupManager {
return !!this.longOperationInProgress
}
startRestorationIfNeededPhase1() {
// if (/captain/restore/restore-instructions.json does exist):
// - Connect all extra nodes via SSH and get their NodeID
// - Replace the nodeId in apps with the new nodeId based on restore-instructions.json
// - Create a captain-salt secret using the data in restore
// - Copy restore files to proper places
}
startRestorationIfNeededPhase2() {
// if (/captain/restore/restore.json exists) GO TO RESTORE MODE:
// - Double check salt against "meta/captain-salt"
// - Iterate over all APPs and make sure they are inited properly
// - Delete /captain/restore
// - Wait until things settle (1 minute...)
}
checkAndPrepareRestoration() {
const self = this
return Promise.resolve() //
+3
View File
@@ -233,6 +233,9 @@ class CaptainManager {
return Promise.resolve(true)
})
.then(function() {
return self.backupManager.startRestorationIfNeededPhase2()
})
.then(function() {
self.inited = true
+6 -1
View File
@@ -195,6 +195,8 @@ function printTroubleShootingUrl() {
let myIp4: string
export function install() {
const backupManger = new BackupManager()
Promise.resolve()
.then(function() {
printTroubleShootingUrl()
@@ -250,13 +252,16 @@ export function install() {
return checkPortOrThrow(myIp4, 3000)
})
.then(function() {
return new BackupManager().checkAndPrepareRestoration()
return backupManger.checkAndPrepareRestoration()
})
.then(function() {
return DockerApi.get().initSwarm(myIp4)
})
.then(function(swarmId: string) {
console.log('Swarm started: ' + swarmId)
return backupManger.startRestorationIfNeededPhase1()
})
.then(function() {
return DockerApi.get().getLeaderNodeId()
})
.then(function(nodeId: string) {