AMS dedi failing to startup due to permissions

Looking at the logs I see this:

2024-07-19T16:08:02.398Z ./run.sh: line 9: ./node/bin/node: Permission denied

…our image includes a standalone nodejs executable that is started as part of our bash run.sh script. What do we need to do as far as permissions go?

Hi @njupshot,

We need more information regarding this, in line 9, do you need to run a standalone nodejs to be able to run the DS?

In the meantime, I’ll ask our internal team about this.

Hi @njupshot,

After our internal check of your image, it looks like the file you want to run doesn’t have the execute (x) flag set. The node file only has -rw-rw-rw permission. Can you verify that the files you are uploading have the executable flag set on them?

@Damar that is correct, we need NodeJS and my understanding was that the image needs to be completely self-contained with no external dependencies hence why nodejs is included in the image. The nodejs linux exe on the build machine (currently my desktop) that is used with amscli has the following permissions:
image
…and here’s the script…
image

@njupshot, it seems that after uploading to AMS, the execute permission got removed. Do you use Windows or Linux for amscli? If you’re using Linux, are you using WSL?

I’m using the Windows amscli.

Using the Linux amscli I got farther, but more problems:

2024-07-23T14:16:08.309Z ./run.sh -dsid=ds_0190dff3-1573-7645-bc31-eb7c5dbea3bf -port=20001 -unusedPort=20000 -watchdogUrl=ws://localhost:5555/watchdog
2024-07-23T14:16:09.140Z node:fs:1372
2024-07-23T14:16:09.140Z   const result = binding.mkdir(
2024-07-23T14:16:09.140Z                          ^
2024-07-23T14:16:09.140Z 
2024-07-23T14:16:09.140Z Error: EACCES: permission denied, mkdir '/var/logs/rpm'
2024-07-23T14:16:09.140Z     at Object.mkdirSync (node:fs:1372:26)
2024-07-23T14:16:09.140Z     at File._createLogDirIfNotExist (/ds/img_0190dff0-72d3-7bd9-b30c-62ad3a71f39f/node_modules/winston/lib/winston/transports/file.js:761:10)
2024-07-23T14:16:09.140Z     at new File (/ds/img_0190dff0-72d3-7bd9-b30c-62ad3a71f39f/node_modules/winston/lib/winston/transports/file.js:94:28)
2024-07-23T14:16:09.140Z     at Logger.init (/ds/img_0190dff0-72d3-7bd9-b30c-62ad3a71f39f/node_modules/@upshot/rpm-shared/dist/logging/logger.js:17:25)
2024-07-23T14:16:09.140Z     at Object.<anonymous> (/ds/img_0190dff0-72d3-7bd9-b30c-62ad3a71f39f/dist/main.js:411:21)
2024-07-23T14:16:09.140Z     at Module._compile (node:internal/modules/cjs/loader:1358:14)
2024-07-23T14:16:09.140Z     at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
2024-07-23T14:16:09.140Z     at Module.load (node:internal/modules/cjs/loader:1208:32)
2024-07-23T14:16:09.140Z     at Module._load (node:internal/modules/cjs/loader:1024:12)
2024-07-23T14:16:09.140Z     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12) {
2024-07-23T14:16:09.140Z   errno: -13,
2024-07-23T14:16:09.140Z   code: 'EACCES',
2024-07-23T14:16:09.140Z   syscall: 'mkdir',
2024-07-23T14:16:09.140Z   path: '/var/logs/rpm'
2024-07-23T14:16:09.140Z }
2024-07-23T14:16:09.140Z 
2024-07-23T14:16:09.140Z Node.js v20.15.1

OK so using the Linux CLI and changing our logs directory to $HOME I was able to get a running dedicated server. We would prefer to use the Windows CLI as our build machines are windows, so it’d be appreciated if your team could look into that.

Speaking of logs, how do I access the logs our application is writing to $HOME in the case that we need to debug issues?

Thanks,
Nick

Hi @njupshot,

Yes, we are currently investigating the Windows AMS CLI issue, and I’ll update you once the fix has been deployed.

For the directory that you want to collect, such as a logs file, you can use ${artifact_path} to specify the path.