Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RocketPool v1.13.1 #54

Merged
merged 4 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading