#1415  Cannot upload via scp
Closed
test88888 opened 11 months ago

Sorry for my username, I originally only created this account to test OneDev before installing it myself.

When trying to upload via SCP to a server, it just refuses to. I always get port 22: Connection refused. I've been stuck on this for a few hours now. I also tried just uploading to my server via a docker image running kroniak/ssh-client. That also didn't work.

image.png image_2.png

Thank you.

test88888 commented 11 months ago

I can add that I also followed this, since it said I had to have a "docker aware executor". https://docs.onedev.io/tutorials/cicd/build-docker-image

Robin Shen commented 11 months ago

Sorry for my username, I originally only created this account to test OneDev before installing it myself.

No problem for the user name at all.

As to SCP step not working, how is the executor internal defined? Is it a server docker executor? If so, you may run a test image (ubuntu for instance) via docker from terminal directly on the server running OneDev, and run telnet <your ssh host> 22 (you may need to install telnet on ubuntu image) to see if it is working. If not, either ssh host is specified incorrectly, or there is some networking issue at your side.

test88888 commented 11 months ago

The internal executor is set up a according to https://docs.onedev.io/tutorials/cicd/build-docker-image. image_3.png image_4.png

I ran an Ubuntu image on the same server as OneDev runs on:

sudo docker run -ti --rm ubuntu /bin/bash
root@7b06e2dfbad1 apt update
root@7b06e2dfbad1 apt install telnet
root@7b06e2dfbad1 telnet *servername* 22
Trying *IP-adress*
Connected to *servername*
Robin Shen commented 11 months ago

Please continue to test on server as below:

docker create network test
docker run -it --rm --network=test 1dev/ssh-client:1.0.0 sh

Then inside the container, run below:

apk add busybox-extras
telnet <your server> 22
test88888 commented 11 months ago

Had to run docker network create test instead of docker create network test

This gives me a Connection refused.

telnet: can't connect to remote host (127.0.1.1): Connection refused

test88888 commented 11 months ago

I can ping my server from the container, though. image_5.png

test88888 commented 11 months ago

Ah. If I use my server's public IP, instead of it's DNS name, it seems to allow me to telnet it.

Robin Shen commented 11 months ago

127.0.1.1 is the local address. It is odd that your host name resolves to that address. You may test with ubuntu image in that network to see what happens.

test88888 commented 11 months ago

I tested the scp step in my buildspec now, using the public IP instead of the hostname. It seems to work, but sadly it won't transfer directories, only files.

I can't seem to find an option to use the -r switch on scp, which allows it to upload directories.

Thank you anyways, you have been of great help!

Robin Shen changed state to 'Closed' 11 months ago
Previous Value Current Value
Open
Closed
Robin Shen commented 11 months ago

No problem. I filed an improvement request to add scp -r option for directory copying (#1416)

test88888 commented 11 months ago

I was able to jerry-rig it to work by adding -r to the source like this:

image_6.png

Robin Shen commented 11 months ago

Yes, OneDev just concatenates source field literally into scp command. An extra explicit options field will make this step easier to use.

issue 1 of 1
Type
Question
Priority
Normal
Assignee
Issue Votes (0)
Watchers (4)
Reference
onedev/server#1415
Please wait...
Page is in error, reload to recover