serversideup / spin

šŸš€ Replicate your production environment locally using Docker. Just run "spin up". It's really that easy.
https://serversideup.net/open-source/spin/
GNU General Public License v3.0
1.21k stars 43 forks source link

Spin new laravel fails with "Permission denied (publickey)." #95

Closed fanpero87 closed 1 month ago

fanpero87 commented 2 months ago

Current Behavior

The process to make a new laravel app failed, what can I do to make it work?

I installed docker and spin on an Ubuntu VM.

Here are the version of the apps running:

Ubuntu 22.04.4 LTS

Spin Version: v2.0.1 [stable] (User Installed)

Docker version 26.1.4, build 5650f9b

Docker Compose version v2.15.1

Based on the video and the docs, I ran spin new laravel or spin new laravel my-app and I got the following error:

šŸ”„ Downloading template...
Cloning from git@github.com:serversideup/spin-template-laravel-basic.git
Cloning into '/tmp/tmp.9FsSmCKDaj'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I manually clone the repo and tried to run the installer:

git clone https://github.com/serversideup/spin-template-laravel-basic.git

cd spin-template-laravel-basic/

./install.sh

But again I get an error

8.3-cli: Pulling from serversideup/php
efc2b5ad9eec: Pull complete 
a6a83fa76a2b: Pull complete 
efb3cd9e6b42: Pull complete 
f41714dd6e6a: Pull complete 
9af8fde8d1ce: Pull complete 
350baa08d55d: Pull complete 
7a26df05181f: Pull complete 
0571db213a90: Pull complete 
7162b80b01ef: Pull complete 
8d53d0710bd6: Pull complete 
2a17f869b6ae: Pull complete 
b1e4bd2bec5a: Pull complete 
2e3c5f760184: Pull complete 
4f4fb700ef54: Pull complete 
Digest: sha256:2b5b84509fa91622fcd9439a1b1c535feeec0ffed1f61c40b623b5a7a930fa58
Status: Downloaded newer image for serversideup/php:8.3-cli
docker.io/serversideup/php:8.3-cli
The function '' does not exist.

Expected Behavior

Based on the video, the process should make a Laravel app.

Steps To Reproduce

  1. Install spin
  2. Install Docker
  3. Run spin new laravel

Environment

spin debug
Spin Version: 
v2.0.1 [stable] (User Installed)

Operating System Version: 
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

Docker Info: 
Client: Docker Engine - Community
 Version:    26.1.4
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.14.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.15.1
    Path:     /usr/lib/docker/cli-plugins/docker-compose
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.0.5
    Path:     /usr/lib/docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.17
    Path:     /usr/lib/docker/cli-plugins/docker-extension
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     /usr/lib/docker/cli-plugins/docker-sbom
  scan: Docker Scan (Docker Inc.)
    Version:  v0.23.0
    Path:     /usr/lib/docker/cli-plugins/docker-scan

Server:
 Containers: 1
  Running: 0
  Paused: 0
  Stopped: 1
 Images: 2
 Server Version: 26.1.4
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: d2d58213f83a351ca8f528a95fbd145f5654e957
 runc version: v1.1.12-0-g51d5e94
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.8.0-40-generic
 Operating System: Ubuntu 22.04.4 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 7.754GiB
 Name: devops
 ID: LKFO:PFN3:V6OG:OURC:4AJ4:3BA2:3TF3:4KLD:XB3C:BICG:G3CS:3XA4
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

No response

takielias commented 2 months ago

@fanpero87 Did you try all those commands using sudo -i ?

satun14 commented 2 months ago

Regarding the error: git@github.com: Permission denied (publickey). Create an ssh key and add it to your GitHub account.

The viability of the utility is of course amazing... I was able to get to the stage where it tries to edit .gitignore and also gets fatal because the rights to the file do not belong to it, it seems to be created in a container under user 100999.

Trying to use sudo is also pointless, since spin itself and git are installed for a local user, you catch a bunch of errors...

Here's what you can do to get to an error with gitignore:

mkdir lara-test
sudo chmod -R 777 lara-test
cd lara-test
spin new laravel .

So we can say that their instructions are excellent)

Maarten-Dekker commented 2 months ago

94 follow the steps in here and it will work.

alan-su-jetfuel commented 2 months ago

Mac get same problem.

spin new laravel t3

šŸ”„ Downloading template...
Cloning from git@github.com:serversideup/spin-template-laravel-basic.git
Cloning into '/var/folders/pt/m2hbwtcn1xv4mtwm1nbtt3xh0000gn/T/tmp.leGk4ogkmo'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

sudo spin new laravel t3

šŸ”„ Downloading template...
Cloning from git@github.com:serversideup/spin-template-laravel-basic.git
Cloning into '/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/tmp.hM37p9xSOT'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Spin Version:
v2.0.2 [stable] (User Installed)

Operating System Version:
ProductName:        macOS
ProductVersion:     14.5
BuildVersion:       23F79

Docker Info:
Client:
 Version:    26.1.3
 Context:    orbstack
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.16.2
    Path:     /Users/ooxxooxx/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.27.3
    Path:     /Users/ooxxooxx/.docker/cli-plugins/docker-compose

Server:
 Containers: 22
  Running: 0
  Paused: 0
  Stopped: 22
 Images: 31
 Server Version: 26.1.4
 Storage Driver: overlay2
  Backing Filesystem: btrfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 8fc6bcff51318944179630522a095cc9dbf9f353
 runc version: 58aa9203c123022138b22cf96540c284876a7910
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.10.6-orbstack-00249-g92ad2848917c
 Operating System: OrbStack
 OSType: linux
 Architecture: aarch64
 CPUs: 8
 Total Memory: 5.189GiB
 Name: orbstack
 ID: 7719ff89-c95a-4343-bcf4-b8751de218b9
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine
 Default Address Pools:
   Base: 192.168.215.0/24, Size: 24
   Base: 192.168.228.0/24, Size: 24
   Base: 192.168.247.0/24, Size: 24
   Base: 192.168.207.0/24, Size: 24
   Base: 192.168.167.0/24, Size: 24
   Base: 192.168.107.0/24, Size: 24
   Base: 192.168.237.0/24, Size: 24
   Base: 192.168.148.0/24, Size: 24
   Base: 192.168.214.0/24, Size: 24
   Base: 192.168.165.0/24, Size: 24
   Base: 192.168.227.0/24, Size: 24
   Base: 192.168.181.0/24, Size: 24
   Base: 192.168.158.0/24, Size: 24
   Base: 192.168.117.0/24, Size: 24
   Base: 192.168.155.0/24, Size: 24
   Base: 192.168.147.0/24, Size: 24
   Base: 192.168.229.0/24, Size: 24
   Base: 192.168.183.0/24, Size: 24
   Base: 192.168.156.0/24, Size: 24
   Base: 192.168.97.0/24, Size: 24
   Base: 192.168.171.0/24, Size: 24
   Base: 192.168.186.0/24, Size: 24
   Base: 192.168.216.0/24, Size: 24
   Base: 192.168.242.0/24, Size: 24
   Base: 192.168.166.0/24, Size: 24
   Base: 192.168.239.0/24, Size: 24
   Base: 192.168.223.0/24, Size: 24
   Base: 192.168.164.0/24, Size: 24
   Base: 192.168.163.0/24, Size: 24
   Base: 192.168.172.0/24, Size: 24
   Base: 172.17.0.0/16, Size: 16
   Base: 172.18.0.0/16, Size: 16
   Base: 172.19.0.0/16, Size: 16
   Base: 172.20.0.0/14, Size: 16
   Base: 172.24.0.0/14, Size: 16
   Base: 172.28.0.0/14, Size: 16
jaydrogers commented 2 months ago

āœ… Solution

Make sure your SSH key is configured with a GitHub Account

Here is how to add a key: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account

Here is how you can test it:

ssh -T git@github.com
alan-su-jetfuel commented 1 month ago

āœ… Solution

Make sure your SSH key is configured with a GitHub Account

Here is how to add a key: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account

Here is how you can test it:

ssh -T git@github.com

Yes

  1. ssh-keygen -t ed25519 -C "your_email@example.com"`
  2. Copy ~/.ssh/id_ed25519.pub content to Github Setting -> Access -> SSH and GPG Kyes -> New SSH key Tiltle -> CanNotUnderstand Key -> id_ed25519.pub content
  3. 
    ssh -T git@github.com

Hi ooxxooxx! You've successfully authenticated, but GitHub does not provide shell access.

jaydrogers commented 1 month ago

Update

This will be available in Spin v2.1 šŸ„³

Why this error appeared

This error was appearing because people were running spin new laravel and didn't have SSH configured with GitHub.

What I did to resolve this

We now default to using HTTPS clones, but if that fails, we fall back to SSH. This should give a better user experience.

Thanks for the report!