D
Deno

help

Small Deno Script to upload to my server not working due to not being able to be run on CentOS

Jjasmeowthecat4/23/2023
All my clients run Ubuntu or Debian, and the script will not run on CentOS due to the problem of a GLIBC problem. I saw online you can run a docker container but I am majorly confused and not a coder in the slightest, I just need to solve this solution as soon as possible.
[root@atl-sql jasmeowsystems-uploader]# /root/.deno/bin/deno run -A index.js
/root/.deno/bin/deno: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /root/.deno/bin/deno)
[root@atl-sql jasmeowsystems-uploader]# /root/.deno/bin/deno run -A index.js
/root/.deno/bin/deno: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /root/.deno/bin/deno)
The script looks like the below:
import axios from "npm:axios";
import FormData from "npm:form-data";

const config = {
file: '/var/log/rclone/backup-log-$(date +"%d-%m-%Y").txt',
token: "TOKEN",
endpoint: "LINK"
};

async function getFile() {
const process = Deno.run({
cmd: ["bash", "-c", "echo " + config.file],
stdout: "piped",
});

const output = await process.output();
const outStr = new TextDecoder().decode(output);

process.close();

return outStr;
}

async function getName() {
const process = Deno.run({
cmd: ["bash", "-c", "echo backup-log-$(date +\"%d-%m-%Y\").txt"],
stdout: "piped",
});

const output = await process.output();
const outStr = new TextDecoder().decode(output);

process.close();

return outStr;
}

async function post() {
const fileName = (await getFile()).replace("\n", "");

try {
const file = Deno.readTextFileSync(fileName);
const name = (await getName()).replace("\n", "");

const form = new FormData();
form.append("token", config.token);
form.append("file", file, name);

axios
.request(config.endpoint, {
method: "POST",
maxBodyLength: Infinity,
headers: {
...form.getHeaders(),
},
data: form,
})
.then((response) => console.log(response.data));
} catch (e) {
console.log(e);
console.error("An error occured. This is normally due to the backup log file missing. Please confirm the log actually generated.");
Deno.exit(1);
}
}

post();
import axios from "npm:axios";
import FormData from "npm:form-data";

const config = {
file: '/var/log/rclone/backup-log-$(date +"%d-%m-%Y").txt',
token: "TOKEN",
endpoint: "LINK"
};

async function getFile() {
const process = Deno.run({
cmd: ["bash", "-c", "echo " + config.file],
stdout: "piped",
});

const output = await process.output();
const outStr = new TextDecoder().decode(output);

process.close();

return outStr;
}

async function getName() {
const process = Deno.run({
cmd: ["bash", "-c", "echo backup-log-$(date +\"%d-%m-%Y\").txt"],
stdout: "piped",
});

const output = await process.output();
const outStr = new TextDecoder().decode(output);

process.close();

return outStr;
}

async function post() {
const fileName = (await getFile()).replace("\n", "");

try {
const file = Deno.readTextFileSync(fileName);
const name = (await getName()).replace("\n", "");

const form = new FormData();
form.append("token", config.token);
form.append("file", file, name);

axios
.request(config.endpoint, {
method: "POST",
maxBodyLength: Infinity,
headers: {
...form.getHeaders(),
},
data: form,
})
.then((response) => console.log(response.data));
} catch (e) {
console.log(e);
console.error("An error occured. This is normally due to the backup log file missing. Please confirm the log actually generated.");
Deno.exit(1);
}
}

post();
All it does is go to the file, grabs it, and uploads it to my server. The code works fine on the Debian OS based side but not CentOS, and some clients can't switch due to incompatibility with other systems they run. I have attempted a force over for them but it's difficult as they are adamant. The point is, simple little thing where I run a server coded in deno, and the clients "upload" their backup log to my own server if that makes sense. There is nothing wrong with rclone, the tool itself, the actual server neither the deno code, it's just annoying as I am stuck trying to run it. I have seen recommendations to build it from source which I have zero idea how to do, and I just need a simple solution and finally gave up, coming to this Discord in the process. I am slowly going insane!
Ppyrote4/27/2023
I tried deno 1.32.5 on CentOS 8 Stream, there were no issues. On CentOS 7 I am getting the same glibc error. CentOS 8 is using glibc 2.28. CentOS 7 is glibc 2.17 CentOS 7 is still supported until June 30 2024 so I can understand why the clients don't want to upgrade. This discussion has some suggestions on either using docker or a script for compiling deno on CentOS 7. https://github.com/denoland/deno/issues/1658#issuecomment-632986792
GitHub
Release centos7 compatible binaries · Issue #1658 · denoland/deno
When trying to run deno on Centos 7, it fails: [maxim@maxim deno] $ target/release/deno tests/worker.js target/release/deno: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by target...
Jjasmeowthecat9/6/2023
I don't know how to do that though sadly. Moving this up so people see.

Looking for more? Join the community!

Recommended Posts
Empty output in Deno.CommandI’m trying to run the command `git log —grep='.'` from Deno. However, it always returns an empty outPreventing `Deno.stdin` reads from blockingIn a module for reading `Deno.stdin` input, there is a loop that reads and parses the returned bytesCan I pre-cache dependencies that I specify using npm:?Hi! Trying to figure out the right way to combine Deno's module support to make our deploys consisteJSON Schema Core, $dynamicAnchor, and $vocabularySlightly off-topic, but I'm writing a Deno library. Anyone deeply knowledgeable on JSON Schema CoreTest case is leaking resourcesHi, all my tests keeps failing because of ```json error: AssertionError: Test case is leaking 2 reso[have workaround] "deno" and "deno repl" aren't producing outputI typed in "deno" and nothing happened, and I thought it was finally doing the right thing when no aServe Fresh over HTTPS locallyHow can I serve Fresh over HTTPS locally? In node I might generate certs and do ``` https.createSercli/tsc crashes with Uncaught TypeErrorUsing latest Deno (1.32.4), this only happens on certain files, but it effectively means that I cannFresh: <Head> component is not supportedWhen running `deno task start` with this as my `pages/index.tsx` file (as in the demo) I'm seeing tIs there a way to vendor npm specifier imports?> deno vendor npm:express > Vendored 0 modules into scripts/vendor directoryHow can I import with npm: specifiers through a proxy?My company blocks npmjs.com and they have setup an internal Artifactory instance. With nodejs I can Import modules from all files in directoryConsidering I have multiple ts files in a folder and all of them export the same type module. Can I