PierreBeucher / cloudypad

Your own gaming gear in the Cloud ! 🎮 ⛅
https://cloudypad.gg
GNU General Public License v3.0
100 stars 6 forks source link

Docker issue and docs #40

Closed AlanKK closed 2 months ago

AlanKK commented 2 months ago

A good set of prerequisites in the README would be nice. I am just starting to play with this to see if I can get it to work. The first issue I ran into is Docker must be installed locally.

Then ...

On an Intel Mac:

$ cloudypad create docker: Error response from daemon: error while creating mount source path '/host_mnt/private/tmp/com.apple.launchd.luZfBD4bs2/Listeners': mkdir /host_mnt/private/tmp/com.apple.launchd.luZfBD4bs2/Listeners: operation not supported.

ChatGPT helped with this and said: Ensure that the parent directory of your mount path is shared with Docker:

  1. Open Docker Desktop preferences
  2. Go to the "Resources" > "File Sharing" section
  3. Add the parent directory of your mount path (e.g. /private/tmp) if it's not already listed
  4. Apply changes and restart Docker

I added /private/tmp and got a little further to:

$ cloudypad create
Error: could not build CloudyPad container image, build exited with code: 1 Build command was: docker build -t crafteo/cloudypad-local-runner:local - < /tmp/Dockerfile-cloudypad-run 2>&1 Build output: ERROR: open /Users/alan/.docker/buildx/activity/desktop-linux: permission denied

This is all I have time for today. I do hope to get this working. I was looking into something similar but you seem to be much further along.

chocolatemoo53 commented 2 months ago

This first issue is at the bottom of the readme.

https://github.com/PierreBeucher/cloudypad?tab=readme-ov-file#known-issues

Screenshot 2024-08-20 at 11 03 31 PM

Select gRPC FUSE in the Docker Desktop settings

PierreBeucher commented 2 months ago

Hi there, thanks for taking time to create an issue :) Pre-requisites are listed in Getting Started (you need Docker, Moonlight and a clouder account), though it's a bit buried in the doc admittedly. I plan on creating a proper doc website like I did for Novops and Novops doc

First issue is indeed known as commented by @chocolatemoo53 , I'll make sure to list it with requirements on top of doc.

For the second one:

$ cloudypad create Error: could not build CloudyPad container image, build exited with code: 1 Build command was: docker build -t crafteo/cloudypad-local-runner:local - < /tmp/Dockerfile-cloudypad-run 2>&1 Build output: ERROR: open /Users/alan/.docker/buildx/activity/desktop-linux: permission denied

That's new to me, it may not be related to Cloudy Pad but something that changed the .docker directory permission in the past. Can you try:

sudo chown -R $(whoami) ~/.docker

As per https://stackoverflow.com/questions/75686903/open-users-user-docker-buildx-current-permission-denied-on-macbook

AlanKK commented 2 months ago

Thanks. @chocolatemoo53, the new docker desktop has the gRPC setting under config > general.

AlanKK commented 2 months ago

I do have some docker issue on my mac. I created a fresh install of ubuntu to keep moving forward. I installed the AWS cli and configured it. Here are my latest two issues:

$ sudo .cloudypad/bin/cloudypad create
.cloudypad/bin/cloudypad: line 36: /tmp/Dockerfile-cloudypad-run: Permission denied
? Select Cloud provider: aws
? Enter instance name: Win10_v9
No SSH private key found in /home/parallels/.ssh. You can generate one with 'ssh-keygen -t ed25519 -a 100'.
? Please enter path to a valid SSH private key to create your instance: ~/.ssh/id_rsa
Using SSH private key ~/.ssh/id_rsa
Creating instance Win10_v9
? Choose an instance type: g4dn.xlarge
? Enter desired disk size (GB): 100
? Use static Elastic IP or dynamic IP? : static
/cloudypad/node_modules/@smithy/config-resolver/dist-cjs/index.js:117
    throw new Error("Region is missing");
          ^

Error: Region is missing
    at default (/cloudypad/node_modules/@smithy/config-resolver/dist-cjs/index.js:117:11)
    at /cloudypad/node_modules/@smithy/node-config-provider/dist-cjs/index.js:90:104
    at /cloudypad/node_modules/@smithy/property-provider/dist-cjs/index.js:97:33
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at coalesceProvider (/cloudypad/node_modules/@smithy/property-provider/dist-cjs/index.js:124:18)
    at /cloudypad/node_modules/@smithy/property-provider/dist-cjs/index.js:135:20
    at AwsInitializerPrompt.getCurrentRegion (/cloudypad/dist/src/providers/aws/initializer.js:116:16)
    at AwsInitializerPrompt.region (/cloudypad/dist/src/providers/aws/initializer.js:107:34)
    at AwsInitializerPrompt.prompt (/cloudypad/dist/src/providers/aws/initializer.js:45:24)
    at AwsInstanceInitializer.runProvisioning (/cloudypad/dist/src/providers/aws/initializer.js:19:22)

Something in /tmp/Dockerfile-cloudypad-run caused the permission denied. I am running this with sudo. I didn't see anything in there that would stop me from continuing so I kept going.

The missing AWS region error was next. Where is it picking this up from? I have it in my ~/.aws/config file. I hardcoded us-east-1 and ran it again. This is what happened:

$ sudo .cloudypad/bin/cloudypad create
.cloudypad/bin/cloudypad: line 36: /tmp/Dockerfile-cloudypad-run: Permission denied
? Select Cloud provider: aws
? Enter instance name: Win10_v9
No SSH private key found in /home/parallels/.ssh. You can generate one with 'ssh-keygen -t ed25519 -a 100'.
? Please enter path to a valid SSH private key to create your instance: ~/.ssh/id_rsa
Using SSH private key ~/.ssh/id_rsa
Creating instance Win10_v9
? Choose an instance type: g4dn.xlarge
? Enter desired disk size (GB): 100
? Use static Elastic IP or dynamic IP? : static
? Enter AWS region to use: us-east-1
/cloudypad/dist/src/providers/aws/provisioner.js:124
            throw new Error(`Couldn't check AWS authentication: ${JSON.stringify(e)}`);
                  ^

Error: Couldn't check AWS authentication: {}
    at AwsProvisioner.checkAwsAuth (/cloudypad/dist/src/providers/aws/provisioner.js:124:19)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at AwsProvisioner.provision (/cloudypad/dist/src/providers/aws/provisioner.js:27:13)
    at AwsInstanceInitializer.runProvisioning (/cloudypad/dist/src/providers/aws/initializer.js:27:9)
    at AwsInstanceInitializer.initializeInstance (/cloudypad/dist/src/core/initializer.js:106:9)

aws sts get-caller-identity works fine so I don't know why I am having these AWS cli issues.

PierreBeucher commented 2 months ago

Why are you running with sudo? I guess it then tries to use root AWS creds instead of your own user, resulting in looking at /root/.aws instead of /home/<you>/.aws.

Error: Couldn't check AWS authentication: {}

This error is not well explanatory, but an empty response is given by AWS SDK when authentication fail - it means somehow credentials could not be found (I think because of sudo as said above)

.cloudypad/bin/cloudypad: line 36: /tmp/Dockerfile-cloudypad-run: Permission denied

This is a permission denied when writing to /tmp/Dockerfile-cloudypad-run in main script (see https://github.com/PierreBeucher/cloudypad/blob/master/cloudypad.sh#L36). It's odd as running as root you shouldn't have such issues... Unless the /tmp folder is mounted in a special way ? (such as shared with your Mac machine ?)

Anyway, try to:

AlanKK commented 2 months ago

I got it working a while back. I have to use sudo to run docker commands. When I got files in the right places, it worked. Impressive automation.