As the title says, deploying to FTP server isn't working for me from a Github Action. I've tried using a couple of actions to accomplish this (FTP-Deploy and ftp-action), but FTP-Deploy just kept running with sporadic
curl: (7) Failed to connect to ftpservername.com port 21: Connection timed out
messages and ftp-action kept running without any output. Note: The server is available, I connected and transferred some files using Filezilla without any issues.
After that I tried using lftp, this is the command I used on a local Ubuntu machine
lftp -c "open -u username,password ftpservername.com; mirror -R locfolder remote/remotefolder"
and the file transfer worked, but when used in a Github Action it produced this output:
---- Connecting to ftpservername.com (123.456.789.123) port 21
mkdir `remote/remotefolder' [Connecting...]
**** Socket error (Connection timed out) - reconnecting
---- Closing control socket
---- Connecting to ftpservername.com (123.456.789.123) port 21
I tried setting both ftp:ssl-allow and ssl:verify-certificate to false, but this did not produce any results. Also, I do not have access to the server, so I can't check the server logs.
This is the workflow file:
name: Test
on:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout#v2
- name: Setup Python
uses: actions/setup-python#v2
with:
python-version: '3.x'
- name: Install pip
run: python -m pip install --upgrade pip
- name: Install packages
run: |
sudo apt install lftp
sudo apt install expect
.
.
.
- name: FTP Deploy
run: |
echo Starting...
unbuffer lftp -c "debug; set ftp:ssl-allow false; set ssl:verify-certificate false; open -u username,${{ secrets.PASSWORD }} ftpservername.com; mirror -R -v locfolder remote/remotefolder"
echo Done transferring files.
Any help is appreciated, thank you!
Found the issue, the hosting service was blocking the IP address (as it was an IP address outside of the country). After setting up a self-hosted runner and whitelisting the IP of the runner everything works fine.
I tried to set up sftp connection between Bitbucket and Runcloud server. Runcloud only uses sftp connection. Bitbucket config:
image: php:7.3
pipelines:
branches:
master:
- step:
name: Deploy to production
deployment: production
script:
- apt-get update
- apt-get -qq install git-ftp
- git ftp init --user $SFTP_username --passwd $FTP_password sftp://runcloud#1.111.111.11/home/runcloud/webapps/mywebsite/wp-content/themes/mywebsiteTheme
Connection always fails with error fatal: Can't access remote 'sftp://1.111.111.11', exiting...
I tried a different sftp Path combination but the result always the same.
sftp://1.111.111.11/home/runcloud/webapps/mywebsite/wp-content/themes/mywebsiteTheme
sftp://mywebsite/home/runcloud/webapps/mywebsite/wp-content/themes/mywebsiteTheme
My website
Root Path: /home/runcloud/webapps/mywebsite
Public Path: /home/runcloud/webapps/mywebsite
Runcload have different as "normal" set up for ftp. For example to conect with FileZila HOST is my server ip. And to get to my website i have to navigate /webapps/mywebsite
Not sure what I doing wrong is my sftp path incorrect?
I have my website hosted on Digital Ocean and my repo on gitlab. I do not have an instance of gitlab installed on my Digital Ocean Server. I am just using the .gitlab-ci.yml file.
In my CI script, I ssh into digital ocean, CD into my project and attempt to pull the latest code.
I have also generated an ssh key on the digital ocean server and added it to my ssh-keys on Gitlab.
I'm not sure if there is a firewall that I can't get past or something.
unfortunately, it errors out with this error.
Running with gitlab-ci-multi-runner 1.9.0 (82714ae)
Using Docker executor with image ruby:2.1 ...
Pulling docker image ruby:2.1 ...
Running on runner-4e4528ca-project-1209495-concurrent-0 via runner- 4e4528ca-machine-1484021348-29523945-digital-ocean-4gb...
Cloning repository...
Cloning into '/builds/Rchampin/ryan_the_developer_django'...
Checking out b3783fbf as master...
$ ssh root#myIP
Pseudo-terminal will not be allocated because stdin is not a terminal.
Host key verification failed.
ERROR: Build failed: exit code 1
Here is my CI script.
before_script:
- ssh root#myIP
- cd /home/rchampin/ryan_the_developer_django
pull:
script:
- git pull
You have some optinos to try in this question
ssh -t -t
# or
ssh -T
That should avoid requesting a pseudo terminal.
Trying to use Envoy via Vagrant (Homestead) to deploy to a server on EC2 that I would normally use a .PEM file when I SSH into it.
When using: #servers(['web' => 'ec2-user#myserver.com']) in my Envoy.blade.php
I get: Permission denied (publickey).
Any help would be huge!
Answer is here: https://stackoverflow.com/a/32088143/13346162
You need to pass the -A (as per the man page it - Enables forwarding of the authentication agent connection. This can also be specified on a per-host basis in a configuration file) in you ssh string.
You will also need add your ssh key for agent forwarding (on the machine which can access the git remote which I assume be your localhost)
ssh-add -K ~/.ssh/your_private_key
Something like this
#servers(['web' => '-A user#domain.com'])
#task('deploy')
cd /path/to/site
git status
#endtask
Git remote commands should now work.
I am working on Ubuntu 11.10
Local branch of my git-repo is up to date
I then wrote following command in terminal: heroku create --stack cedar and it said:
Notice: on Wed, 20 June, our default stack will change to Cedar. http://bit.ly/Lh0rM5
Creating radiant-wind-7413... done, stack is cedar
http://radiant-wind-7413.herokuapp.com/ | git#heroku.com:radiant-wind-7413.git
Git remote heroku added
All fine till now, then I typed following in terminal:
git push heroku master
and the following error occured:
ssh: connect to host heroku.com port 22: Connection timed out
fatal: The remote end hung up unexpectedly
As of November 30, 2021, the SSH Git Transport feature has been deprecated by Heroku and only HTTP transport is supported. The real shutdown of SSH was in March 2022.
You have to reconfigure the repo with :
heroku git:remote -a <app-name>
Official statement from Heroku
If you are using a remote with a different name, e.g. production then use
heroku git:remote -a <app-name> -r <remote-name>
Maybe you will have to unset ssh connections on git global config :
git config --global --unset url.ssh://git#heroku/.insteadof
git config --global --unset url.ssh://git#heroku.com/.insteadof
Most probably some sort of firewall issue or your network admin has blocked outgoing port 22 in your network.
You may use simple scrip to see your connection to Heroku by :
$ ssh -vvv git#heroku.com
If you seeing connect timed out then you may need to request your admin to unblock port 22. Alternatively may access Heroku via tunneling as per my answer in Connecting to heroku using port 443
I had the similar problem with keys. Ok this is what I did.
Check the status of your keys with
heroku keys
It shows you list of keys that are added to heroku. You can always generate new keys and add them to heroku.
ssh-keygen -t rsa
Generates new key.
heroku keys:add
adds the keys to heroku. Before adding it lists the available keys that you can add. Enter the option and you key is added to heroku.
This article can be helpful. If that doesn't work then there should be some problem with ssh. Try doing an ssh localhost and see if ssh is working.
Today Heroku uses git over ssh. The default port for ssh is 22 and it looks like your network doesn't allow outbound connections to port 22. Perhaps this is something your network administrator can change.
I had been working on this for hours trying to figure out how I could suddenly have a closed port 22, etc. when literally 5 hours ago everything was working and nothing had changed.
Finally I just reset my Git repo on Heroku and repushed everything. Still no idea what happened.
heroku plugins:install heroku-repo
heroku repo:reset --app appname
Do following steps.
ssh-keygen -t rsa
heroku keys:add
heroku keys # lists keys
For me helped destroying whole app and recreating again - leaving it here for future reference.
heroku apps:destroy appname
heroku apps:create appname
heroku git:remote -a appname
git push heroku master
I added the https url to the .git/config file in my project folder. I found the HTTPS URL in the project Settings on Heroku. I then added that URL to replace the SSH url inside the .git/config text file.