toolbox icon indicating copy to clipboard operation
toolbox copied to clipboard

Stuck in cloning template when vapor new a project in a Linux Docker container

Open ElectronFang opened this issue 1 year ago • 10 comments

Describe the issue

I try to create a new Vapor project in a Linux Docker container, but stuck in cloning template

Vapor version

I think it should be a newest version, I can't new a project, so I can't find the package file.

Operating system and version

Ubuntu 22.04.4 LTS

Swift version

swift 5.10

Steps to reproduce

  1. Pull the latest swift image in Docker
  2. Install vapor
  3. Use the command vapor new 截屏2024-06-03 17 17 13 (2)

Outcome

No response

Additional notes

No response

ElectronFang avatar Jun 03 '24 09:06 ElectronFang

Is this still happening? Does cloning https://github.com/vapor/template manually work for you?

I'm unable to reproduce

0xTim avatar Jun 04 '24 19:06 0xTim

Hi Tim,

Thanks for your reply, I am a beginner, and sorry to take your time.

  1. I can git clone a template, but vapor --template has same issue. I found out that I don't need to use the command vapor new to create a project, I can manually modify the template to my project. But I still feel weird, worry something will go wrong when I don't follow the official tutorial.

  2. I use this image as my container https://github.com/apple/swift-docker/blob/ea035798755cce4ec41e0c6dbdd320904cef0421/5.10/ubuntu/22.04/Dockerfile

is there something with the container?

ElectronFang avatar Jun 05 '24 00:06 ElectronFang

Oh right I missed that you're running inside a Docker container. Yeah it could be because it's missing curl or another package, though it is just using git clone under the hood. I would say that it's not particularly designed for running in containers, it's more designed for where you do development.

I can reproduce this though, haven't tried to debug it

0xTim avatar Jun 05 '24 16:06 0xTim

Thanks Tim,

To provide more information for you, I tried last year when I know Vapor, 'vapor new' works in Linux Container, I thought it's my fault and tried a lot of times.

I also tried use Dev Container Extension of VScode to add a swift container with Vapor, but it also failed and stuck in the process of installing vapor.

Hope it helps and thanks for all of your hardwork.

ElectronFang avatar Jun 06 '24 06:06 ElectronFang

Have you tried adding the -n flag? Maybe it crashes because of the variable input required from the terminal. You can also add the --fluent.db and --leaf/--no-leaf flags directly

fpseverino avatar Feb 16 '25 15:02 fpseverino

I have been arguing with this particular problem for a few days. vapor new hangs after outputting 'Cloning template.' I haven't solved that problem, but I have some additional information that may help someone else diagnose.

I've tried various ways of building a container with Vapor in it. In a Dockerfile I have commands to clone vapor/toolbox and make install. In every case that I do this from the Dockerfile (RUN make install) the ./build binary hangs without running the build. Manually running make install has the same problem. I got past this by manually running the commands in the install target. (Create Dockerfiles up to make install, run a container from the last image, manually build and run, docker commit ... to get those changes into the next image.)

And no matter what, when the final image is ready, a vapor new hangs.

ShonFrazier avatar Feb 22 '25 17:02 ShonFrazier

@ShonFrazier are you using GPG keys that require a password? If so does the --no-commit flag fix it?

0xTim avatar Mar 21 '25 12:03 0xTim

I am not using GPG keys. My SSH keys don’t have passwords.

ShonFrazier avatar Mar 22 '25 12:03 ShonFrazier

cc @fpseverino - I wonder if this is related to what we were talking about in Discord

0xTim avatar Mar 26 '25 11:03 0xTim

cc @fpseverino - I wonder if this is related to what we were talking about in Discord

Most definitely, it's the Git cloning Process that waits indefinitely, we may have to handle subprocesses in a different way. This is on my todo list

fpseverino avatar Mar 26 '25 12:03 fpseverino