Skip to content

Commit

Permalink
FIX: installpaths, stereum settings not cleaned, add mev to new insta…
Browse files Browse the repository at this point in the history
…lled services (#914)
  • Loading branch information
NeoPlays authored Nov 11, 2022
1 parent 3c6de11 commit 6a1ec6c
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 9 deletions.
8 changes: 7 additions & 1 deletion launcher/src/backend/NodeConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class NodeConnection {

async establish(taskManager) {
await this.sshService.connect(this.nodeConnectionParams);
await this.findStereumSettings()
this.taskManager = taskManager;
}

Expand Down Expand Up @@ -753,7 +754,7 @@ export class NodeConnection {
});

this.taskManager.finishedOtherTasks.push({ otherRunRef: ref });
this.settings = undefined;
await this.logout()
return "Node destroyed";
}

Expand Down Expand Up @@ -980,5 +981,10 @@ export class NodeConnection {
return resolve(settings);
});
}

async logout(){
this.settings = undefined
await this.closeTunnels()
}
}

19 changes: 14 additions & 5 deletions launcher/src/backend/ServiceManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,19 @@ export class ServiceManager {
return service
}

async modifyServices(tasks, services){
async modifyServices(tasks, services, newInstallTasks){
let modifiedServices = []

tasks.forEach(task => {
let service = services.find(s => s.id === task.service.config.serviceID)
let dependencies = task.data.executionClients.concat(task.data.beaconServices).map(s => services.find(e => e.id === s.config.serviceID))
let dependencies = task.data.executionClients.concat(task.data.beaconServices).map(s => services.find(e => {
if(e.id === s.config.serviceID){
return true
}else if(e.id === newInstallTasks.find(i => i.service.id === s.id).service.config.serviceID){
return true
}
return false
}))

if(service.service === "FlashbotsMevBoostService"){
service.entrypoint[service.entrypoint.findIndex(e => e === "-relays")+1] = task.data.relays
Expand Down Expand Up @@ -622,6 +629,7 @@ export class ServiceManager {
await Promise.all(newServices.map(async (service) => {
await this.nodeConnection.writeServiceConfiguration(service.buildConfiguration())
}))
return ELInstalls.concat(CLInstalls,VLInstalls)
}

static uniqueByID(job) {
Expand All @@ -641,16 +649,17 @@ export class ServiceManager {
let after = this.nodeConnection.getTimeStamp()
await this.nodeConnection.restartServices(after - before)
}
}
}
let newInstallTasks
if (jobs.includes("INSTALL")) {
let services = await this.readServiceConfigurations()
let installTasks = tasks.filter(t => t.content === "INSTALL")
await this.addServices(installTasks, services)
newInstallTasks = await this.addServices(installTasks, services)
}
if (jobs.includes("MODIFY")) {
let services = await this.readServiceConfigurations()
let modifyTasks = tasks.filter(t => t.content === "MODIFY")
await this.modifyServices(modifyTasks, services)
await this.modifyServices(modifyTasks, services, newInstallTasks)
}
}
}
4 changes: 2 additions & 2 deletions launcher/src/backend/ethereum-services/NodeService.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ export class NodeService {
buildWorkingDir (dir) {
if(!dir)
dir = '/opt/stereum'
dir = path.normalize(dir)
if(!path.isAbsolute(dir))
dir = path.posix.normalize(dir)
if(!path.posix.isAbsolute(dir))
dir = '/' + dir
if(dir.endsWith('/'))
return dir.slice(0,-1,'') + '-' + this.id
Expand Down
10 changes: 10 additions & 0 deletions launcher/src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,16 @@ promiseIpc.on("closeTunnels", async () => {
return await nodeConnection.closeTunnels();
});

promiseIpc.on("logout", async () => {
await taskManager.nodeConnection.logout();
await monitoring.nodeConnection.logout();
await monitoring.nodeConnectionProm.logout();
await serviceManager.nodeConnection.logout();
await monitoring.serviceManager.nodeConnection.logout();
await monitoring.serviceManagerProm.nodeConnection.logout();
return await nodeConnection.logout();
});

// called via promiseIpc as an async function
promiseIpc.on("setApikey", async (arg) => {
return stereumService.setApikey(arg);
Expand Down
2 changes: 1 addition & 1 deletion launcher/src/components/UI/node-header/IconsNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default {
this.logoutModalIsActive = true;
},
async loggingOut() {
await ControlService.closeTunnels();
await ControlService.logout();
this.$router.push("/").then(() => {
location.reload()
});
Expand Down
4 changes: 4 additions & 0 deletions launcher/src/store/ControlService.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ class ControlService extends EventEmitter {
return await this.promiseIpc.send("closeTunnels");
}

async logout() {
return await this.promiseIpc.send("logout");
}

async setApikey(args) {
await this.promiseIpc.send("setApikey", args);
}
Expand Down

0 comments on commit 6a1ec6c

Please sign in to comment.