Skip to content

Commit

Permalink
Merge pull request #54 from AvadoDServer/v1.13.1
Browse files Browse the repository at this point in the history
RocketPool v1.13.1
  • Loading branch information
sponnet authored Jun 18, 2024
2 parents 43464d4 + ed624d0 commit 8b496a3
Show file tree
Hide file tree
Showing 9 changed files with 2,944 additions and 4,022 deletions.
4 changes: 2 additions & 2 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16.15.0 as builder
FROM node:21.7.3 as builder

# build wizard
WORKDIR /usr/src/app/wizard
Expand All @@ -14,7 +14,7 @@ RUN yarn --production

####### Main image

FROM --platform=linux/amd64 node:16.15.0
FROM --platform=linux/amd64 node:21.7.3
ARG RP_VERSION

RUN mkdir -p /srv/rocketpool
Expand Down
6 changes: 3 additions & 3 deletions build/monitor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"license": "Apache-2.0",
"dependencies": {
"axios": "^0.24.0",
"restify": "^8.6.0",
"restify-cors-middleware2": "^2.1.2",
"adm-zip": "^0.5.9",
"restify": "^11.1.0",
"restify-cors-middleware2": "^2.2.1",
"adm-zip": "^0.5.12",
"jsonfile": "^6"
}
}
47 changes: 24 additions & 23 deletions build/monitor/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,49 +137,52 @@ const rpd = (command) => {
}

//restart Rocket Pool smartnode
server.get("/network", (req, res) => {
server.get("/network", (req, res, next) => {
res.send(200, network);
return next();
});

server.get("/settings", (req, res) => {
server.get("/settings", (req, res, next) => {
try {
const settings = jsonfile.readFileSync("/srv/rocketpool/settings.json");
res.send(200, settings);
} catch (e) {
console.error(e)
}
return next();
});

//restart Rocket Pool smartnode
server.get("/restart-rocketpool-node", (req, res) => {
// Restart Rocket Pool smartnode
server.get("/restart-rocketpool-node", async (req, res) => {
console.log(`Restart Rocket Pool smartnode`);
const cmd = "supervisorctl restart rocketpool-node";
execute(cmd).then((stdout) => {
const cmd = "supervisorctl restart rocketpool-node";

try {
const stdout = await execute(cmd);
res.send(200, stdout);
}).catch((e) => {
} catch (e) {
res.send(500, e);
})
}
});

//backup
// Backup
const backupFileName = "rocket-pool-backup.zip";
server.get("/" + backupFileName, (req, res) => {
res.setHeader("Content-Disposition", "attachment; " + backupFileName);
server.get("/" + backupFileName, (req, res, next) => {
res.setHeader("Content-Disposition", "attachment; filename=" + backupFileName);
res.setHeader("Content-Type", "application/zip");

const zip = new AdmZip();
zip.addLocalFolder("/rocketpool/data", "data");
zip.toBuffer(
(buffer, err) => {
if (err) {
reject(err);
} else {
res.setHeader("Content-Length", buffer.length);
res.end(buffer, "binary");
}
}
)

try {
const buffer = zip.toBuffer();
res.setHeader("Content-Length", buffer.length);
res.end(buffer, "binary");
} catch (err) {
next(err);
}

return next();
});

//restore
Expand Down Expand Up @@ -237,8 +240,6 @@ server.post('/restore-backup', (req, res, next) => {
}
});



server.listen(9999, function () {
console.log("%s listening at %s", server.name, server.url);
console.assert(network == "prater" || network == "holesky" || network == "mainnet", 'Wrongly configured NETWORK environment variable! Use either "prater" or "mainnet"');
Expand Down
Loading

0 comments on commit 8b496a3

Please sign in to comment.