Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to make deploy using sftp #90

Open
alcarazolabs opened this issue Aug 1, 2021 · 3 comments
Open

Unable to make deploy using sftp #90

alcarazolabs opened this issue Aug 1, 2021 · 3 comments

Comments

@alcarazolabs
Copy link

alcarazolabs commented Aug 1, 2021

Hi, I just installed in a virtual machine using ubuntu 20 a sftp server and on there I have a apache server and all my projects are saved inside of "var/www/html". To test this tool "git-deploy-php" I created another virtual machine with ubuntu and installed on there php and git.. I tested my sftp server and is working correctly, I can make a connection using my second virtual machine were I want to make the deploy and I also tested my sftp server with windows 10 using Filezilla and again I was capabable of upload files inside of "html" folder of the apache server.

My sftp user has permissions for write inside of "var/www/html".
I just created a folder with one index.html file which is the file that I want deploy in my server and also I created a .gitignore file to ignore this files "git-deploy.php and deploy.ini".

This is my deploy.ini code:

[example]
scheme = sftp

skip = false
user = "usuario_sftp"
pass = "123456"
host = "192.168.0.13"
port = 22
path = "/var/www/html/googleros"
passive = true

When I execute the git-deploy it was unable of uploade the index.html file, here is the logs:

devjunior@devjunior-pc:~/Documentos/proyects/googleros$ sudo php git-deploy deploy.ini
[2021-07-31 20:30:07 -0400] Connected to: sftp://[email protected]:22/var/www/html/googleros
[2021-07-31 20:30:07 -0400] Disconnected from: sftp://[email protected]:22/var/www/html/googleros
[2021-07-31 20:30:07 -0400] Started working on: sftp://[email protected]:22/var/www/html/googleros
[2021-07-31 20:30:07 -0400] Deploying to server for the first time...
[2021-07-31 20:30:07 -0400] Will upload 3 files.
[2021-07-31 20:30:07 -0400] Will delete 0 files.
[2021-07-31 20:30:12 -0400] Connected to: sftp://[email protected]:22/var/www/html/googleros
[2021-07-31 20:30:12 -0400] ERROR: Failed to upload index.html. Deployment will stop to allow you to check what went wrong.

It said: "ERROR: Failed to upload index.html. Deployment will stop to allow you to check what went wrong."
Before of run this I init a repo "git init" then I did "git add ." and then git commit -m "first deploy". and the executed git-deploy

I checked my branch and his name is "master", I'm supposing that this branch will be deployed in the production server.

This is my project:

image

is composer required? In my production server I only installed an apache server, php and mysql, is the problem with this rule [example] I don't know it.

I don't know the reason why this happens, it is my first time using this tool. I will appreciate any idea to fix this problem. Thanks so much.

@pocketarc
Copy link
Owner

Does the googleros folder exist? That's the only thing that comes to my mind as the reason why it might've gone wrong.

Composer is not required, everything should work well.

If you're still having issues with this and that folder exists, let me know. I might be able to add some code to help explain what went wrong, since that error message is really not helpful at all.

@alcarazolabs
Copy link
Author

alcarazolabs commented Aug 4, 2021

Does the googleros folder exist? That's the only thing that comes to my mind as the reason why it might've gone wrong.

Composer is not required, everything should work well.

If you're still having issues with this and that folder exists, let me know. I might be able to add some code to help explain what went wrong, since that error message is really not helpful at all.

Thanks bro. The problem was in the path of the deploy.ini here I was using /var/www/html/googleros ok. But when I tried to run the deploy I couldn't go to googleros/ because in the configuration of the file sshd_config of the sftp server the rule ChrootDirecotry had this value /var/www/ it means that when an user make a connection by default will be positionate here inside of www/ but it can't go from /var/www/html/ then to fix this I updated my path of the deploy.ini to html/googleros and it worked!

[2021-08-04 13:11:41 -0400] Connected to: sftp://[email protected]:22/html/googleros
[2021-08-04 13:11:41 -0400] Disconnected from: sftp://[email protected]:22/html/googleros
[2021-08-04 13:11:41 -0400] Started working on: sftp://[email protected]:22/html/googleros
[2021-08-04 13:11:41 -0400] Deploying to server for the first time...
[2021-08-04 13:11:41 -0400] Will upload 4 files.
[2021-08-04 13:11:41 -0400] Will delete 0 files.
[2021-08-04 13:11:42 -0400] Connected to: sftp://[email protected]:22/html/googleros
[2021-08-04 13:11:42 -0400] Uploaded: index.html
[2021-08-04 13:11:42 -0400] Uploaded: phploy.ini
[2021-08-04 13:11:42 -0400] Uploaded: REVISION
[2021-08-04 13:11:42 -0400] Uploaded: PREVIOUS_REVISION
[2021-08-04 13:11:42 -0400] Finished working on: sftp://[email protected]:22/html/googleros
[2021-08-04 13:11:42 -0400] Disconnected from: sftp://[email protected]:22/html/googleros

In general, what problems can have tool present? can you upload large files? files named with spaces? what should I know that I don't currently know.

Thanks.

The tool should allow you to create the folder on the production server if it doesn't exist. You could do something like git-deploy --force and it should create the directory inside the server and then run the deploy.

@pocketarc
Copy link
Owner

@alcarazolabs You shouldn't have any issues with uploads of files, regardless of size, spaces, anything like that. Everything should just work.

As for creating the folder if it doesn't exist, that's an interesting idea, but when the folder doesn't exist it's usually an issue with configuration (just like it was for you). Imagine if the tool had deployed thousands of files files to /var/www/html/etc inside your /var/www because of ChrootDirectory (so it'd become /var/www/var/www/html/googleros). It's best to not try and get too clever in situations like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants