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

Dploy only uploads the .rev file #19

Closed
felds opened this Issue Nov 20, 2013 · 31 comments

Comments

Projects
None yet
@felds

felds commented Nov 20, 2013

No other files are touched.

Config

dev:
    scheme: sftp
    # port: 21
    host: •••••••••••
    user: •••••••••••
    pass: •••••••••••
    check: true
    path:
        local: /www/clients/•••••••••••/hotsite/
        remote: /home/•••••••••••/www/hotsite/

Output

Connecting to dev...
Checking revisions...
Checking diffs...
Files that will be uploaded:
[ ? ] /www/clients/•••••••••/hotsites/.rev
Question: Are you sure you want to upload those files? (y/n):  y
[ + ] File uploaded: /www/clients/•••••••••/hotsites/.rev:
Upload completed for dev
All Completed :)

Diff

commit 49d2e1e2956e0142d317efabb5e2257b0a204c25
Author: •••••••••••••••••••
Date:   Wed Nov 20 17:11:21 2013 -0200

    hello dploy

diff --git a/index.html b/index.html
new file mode 100644
index 0000000..ddbe00a
--- /dev/null
+++ b/test.html
@@ -0,0 +1,2 @@
+<h1>Hello World!</h1>
+

um grande abraço!

@lucasmotta

This comment has been minimized.

Owner

lucasmotta commented Nov 21, 2013

Hey @felds, just so I can understand a bit more what happened there. Are you trying to diff two different files (a and b) or using the same file?

@felds

This comment has been minimized.

felds commented Nov 21, 2013

Here is a minimal test case:

[felds /www/sandbox/dploy_test]
$ git init
Initialized empty Git repository in /www/sandbox/dploy_test/.git/

[felds /www/sandbox/dploy_test ]
$ echo '<h1>hello, dploy!</h1>' > index.html

[felds /www/sandbox/dploy_test ]
$ git add index.html

[felds /www/sandbox/dploy_test ]
$ git ci -m 'initial commit'
[master (root-commit) d5346eb] initial commit
 1 file changed, 1 insertion(+)
 create mode 100644 index.html

[felds /www/sandbox/dploy_test master]
$ dploy install
Installing DPLOY...
Done! Your project is ready to DEPLOY :) 

[felds /www/sandbox/dploy_test master]
$ vim dploy.yaml 

[felds /www/sandbox/dploy_test master]
$ dploy 
Connecting to dev...
Checking revisions...
Uploading files...
Files that will be uploaded:
[ ? ] ./.rev
Question: Are you sure you want to upload those files? (y/n):  y
[ + ] File uploaded: ./.rev:
Upload completed for dev
All Completed :)

Shouldn't the index.html file be on the server?

@lucasmotta

This comment has been minimized.

Owner

lucasmotta commented Nov 21, 2013

Do you have any previous .rev file in your FTP already? Because if it's the first time you upload to the server, all tracked files should be uploaded (because there's no .rev file in the server to compare).

But in your case, it looks like this file is on the FTP already. Can you delete and try again?

@felds

This comment has been minimized.

felds commented Nov 21, 2013

Done. Same output.

This is the output with the .rev file already on the server:

Connecting to dev...
Checking revisions...
Checking diffs...
No files to upload
Upload completed for dev
All Completed :)
@lucasmotta

This comment has been minimized.

Owner

lucasmotta commented Nov 21, 2013

That's really odd. If the revision file doesn't exist in the server, it should call the method addAll and not the checkDiff.
Try downloading the source code of DPLOY and add some more logs in the checkRevision method. Somehow your FTP is not telling us that there was an error loading the file.

@felds

This comment has been minimized.

felds commented Nov 21, 2013

I've tried to do that but I'm having a hard time getting the source to even run. (yes, I'm a node noob)
Any good resources on how to get started?

@lucasmotta

This comment has been minimized.

Owner

lucasmotta commented Nov 21, 2013

No worries. I just updated DPLOY do v1.0.4, so if you update the package you should get more logs when checking the diffs.
And also I've added another error check to see if the hash of the .rev is empty, it should add all files.

Let me know how it goes, otherwise I can help you building DPLOY locally.

Cheers,
Lucas

@CWSpear

This comment has been minimized.

Contributor

CWSpear commented Nov 22, 2013

I'm having problems with this, too. I think I was using v1.0.5 yesterday and v1.0.7 this morning, but kinda hard to tell for sure without a -v flag.

I am really excited about this project, but unfortunately, I can't get anything other than a .rev file to upload. I have tried deleting the .rev on the server, starting all over from scratch, no dice.

I too, am using sftp because ftp is being all weird on my server right now and it won't connect, haha.

@CWSpear

This comment has been minimized.

Contributor

CWSpear commented Nov 23, 2013

So at least for me, it seems that I had tried . as the local path and an absolute path to local /Users/cameron/Sites/matchbooklab.com/, but it does a string compare to the files in the repo, which are all based on their relativity to the cwd.

So if . or /Users/cameron/Sites/matchbooklab.com/ isn't at the start of application/index.php, it won't add it to the files to upload.

For now, the solution is to omit the local path or leave it blank.

Might need that for remote, too?? I haven't looked into that.

@felds

This comment has been minimized.

felds commented Nov 23, 2013

@CWSpear omitting the local path worked for me 🍷

@CWSpear

This comment has been minimized.

Contributor

CWSpear commented Nov 23, 2013

I've never tried to send multiple PRs close together like this, but GitHub just combined my commits into one PR, but I did open a PR for a fix that will make paths "smarter," so the config you have above will work, etc. It just got combined into my PR about adding a -v flag, haha.

@lucasmotta

This comment has been minimized.

Owner

lucasmotta commented Nov 23, 2013

Nice open @CWSpear. I am gonna run a few tests now with your changes and merge when I am finished.

@lucasmotta

This comment has been minimized.

Owner

lucasmotta commented Nov 23, 2013

So @CWSpear, I did a few tests with your changes, but there's one thing that I am not really sure about.
Before, all paths were always relative to where you are working on. So if you would set the any paths as / they would be relative to the root of your project, and not to the root of your machine.
So instead of using path.local: "." to use the current path, you could simply leave it empty path.local: "".

Same thing applies for the remote server. So what do you think?

@CWSpear

This comment has been minimized.

Contributor

CWSpear commented Nov 23, 2013

I think there is a difference between SFTP and FTP. I believe in FTP, / is the root of the directory you're assigned (in most systems, if it's the account owner, it's typically the home directory, but it could be something difference).

But in SFTP, / is the system root (which you probably won't have access to, anyway).

In SFTP, the following work as I expected for the path.remote:

public_html/deploy/
/home/cwspear/public_html/deploy/
./public_html/deploy/

The following don't work:

~/public_html/deploy/ # I thought this one would!
/public_html/deploy/ # this is the one that you said works, but it must only be for FTP?

They all produce the following error in endless repeat (ok, I guess it could stop eventually, but I stop it around 5 or 6):

[ + ] Fail uploading file ./.rev: { [Error: No such file] lang: '' }
@lucasmotta

This comment has been minimized.

Owner

lucasmotta commented Nov 25, 2013

Are you guys still getting this error with the last version?

@OkanEsen

This comment has been minimized.

OkanEsen commented Nov 25, 2013

Gonna check it out, when I'm at home.

Thanks in advance, though.

@oskarrough

This comment has been minimized.

oskarrough commented Dec 4, 2013

My local files are in a folder named dist on the same level as dploy.yaml. I want to push it to the root of the remote. Tried all the paths I could think of it but still getting the same error as this issue.

Deleting the online .rev didn't help. On the newest version of dploy as of this writing.

@CWSpear

This comment has been minimized.

Contributor

CWSpear commented Dec 4, 2013

@oskarrough Are you using FTP or SFTP? In FTP, the "root" (/) is the root assigned to the FTP account (i.e. typically your home directory: if it's a cPanel account, it's probably /home/username/), but the root of SFTP would actually be the server root (mind you, to save files there, you have to have access to it).

@lucasmotta

This comment has been minimized.

Owner

lucasmotta commented Dec 5, 2013

@oskarrough try adding the parameter check to true and it should give you a list of the local files that are going to be uploaded.
And of course, make sure that you commit the dist folder to Git, otherwise it won't be uploaded.

@oskarrough

This comment has been minimized.

oskarrough commented Dec 10, 2013

Ah meh, my bad. I wasn't comitting dist to Git and I'm not planning to, either. Guess I need something that isn't tied together with Git. Thank you both anyway 👍

@lucasmotta

This comment has been minimized.

Owner

lucasmotta commented Dec 10, 2013

@oskarrough that's the main thing of DPLOY... I am planning to add support for other source controls as well and to a simple file-list comparison, but I haven't started yet.

Another solution for you is to create a empty .git repo (even if you don't use or commit) and add the dist folder on the include parameter. Something like this:

path:
  local: /
  remote: public_html/
include:
  "dist/" : /

It should work as well, but you will always have to upload all files.

@oller

This comment has been minimized.

oller commented Aug 24, 2014

Hey guys, I'm encountering this scenario too. I'd rather keep my dist/ folder outside of source control, so it's in .gitignore. However this now results in dploy only uploading the .rev file.

I've tried doing a git init in the dist/ folder as suggested by @lucasmotta and add the include options with the relevant paths, but that's still resulting in no files being uploaded. Am i missing a trick?

Is ultimately having the dist/ folder which I want uploaded in a .gitignore, going to stop this working in any scenario? Am i basically going against the principle of dploy? I would have thought this is a fairly common use-case?

@xavhan

This comment has been minimized.

xavhan commented Nov 13, 2014

Had the same problem as @oskarrough and i feel so dumb not to have thought of that ... :)

You should add a note in the ReadMe ;)

@Ouadie

This comment has been minimized.

Ouadie commented Feb 11, 2015

Same problem here as @oskarrough

@ghost

This comment has been minimized.

ghost commented Mar 7, 2015

I too am wondering if .rev should be in the gitignore file.

@roboza

This comment has been minimized.

roboza commented Mar 7, 2015

dploy is looking at your commit log history to see what files it needs to upload. Unless you are committing files dploy will not pick up the files that are changing.

as for the .rev file. This file gets created when you start dploy, then it gets uploaded and once complete gets removed locally so you don't need to add it to the .gitignore or anything like that. I have found if I start a dploy and during the check I cancel it the .rev file stays behind but it is safe at this point to just remove it.

@patricknelson

This comment has been minimized.

patricknelson commented Aug 12, 2015

Bump. I just installed dploy after having used it years ago with it working fine and have now stumbled across this bug. I'm running v1.2.0. I've got many hundreds of changed files, but this is the output I end up getting:

Connecting to stage...
Checking revisions...
Checking diffs between [f4c7c9d26ee799c0e01afc1f6f84fc12b20563b0] > [4bf0c3c81e2649401ddc06f44ae03d767ad89741]
Files that will be uploaded:
[ ? ] ./.rev > /web/content/.rev

How can this be fixed? Is there a version of dploy that I can revert to that works?

@oller

This comment has been minimized.

oller commented Aug 12, 2015

dploy needs the files to be under git source control @patricknelson, so it can perform the diffs, I'd make sure you've not referenced the files you want to upload in .gitignore and check they're under source control.

@patricknelson

This comment has been minimized.

patricknelson commented Aug 12, 2015

@oller I understand, that wasn't the issue. I dug into the code of DPLOY and found here https://github.com/LeanMeanFightingMachine/dploy/blob/master/src/deploy.coffee#L362 that it was not properly comparing my local relative path (which I had configured below) with the paths found in the git index and, because my local path was setup incorrectly (or at least wasn't found inside that git path) it was not working.

So this was my path configuration:

stage:
    host: "ftp.server.com"
    scheme: "sftp"
    user: "username"
    # Password intentionally excluded; will prompt instead.
    path:
        local: "./"
        remote: "/web/content/"
    exclude: ["dploy.yaml"]
    check: true

So apparently, that local path used to work, but now it does not. The solution for me was to simply remove that local reference and all is well again. This may help anyone else with a similar issue. Maybe this issue was affecting the person above? Since it was doing a direct comparison to the output from git diff --name-status, my file in the index would always be relative, e.g. directory/file.js) while the user has setup a full path prefix to the file, which will NOT exist in that output from git diff.

Thanks though!

@oller

This comment has been minimized.

oller commented Aug 12, 2015

No worries. Glad you got to the bottom of it!

On Wed, 12 Aug 2015 18:29 Patrick Nelson notifications@github.com wrote:

@oller https://github.com/oller I understand, that wasn't the issue. I
dug into the code of DPLOY and found here
https://github.com/LeanMeanFightingMachine/dploy/blob/master/src/deploy.coffee#L362
that it was not properly comparing my local relative path (which I had
configured below) with the paths found in the git index and, because my
local path was setup incorrectly (or at least wasn't found inside that git
path) it was not working.

So this was my path configuration:

stage:
host: "ftp.server.com"
scheme: "sftp"
user: "username"
# Password intentionally excluded; will prompt instead.
path:
local: "./"
remote: "/web/content/"
exclude: ["dploy.yaml"]
check: true

So apparently, that local path used to work, but now it does not. The
solution for me was to simply remove that local reference and all is well
again. This may help anyone else with a similar issue. Maybe this issue was
affecting the person above? Since it was doing a direct comparison to the
output from git diff --name-status, my file in the index would always be
relative, e.g. directory/file.js) while the user has setup a full path
prefix to the file, which will NOT exist in that output from git diff.

Thanks though!


Reply to this email directly or view it on GitHub
#19 (comment)
.

@felds felds closed this Jan 23, 2016

@leye0

This comment has been minimized.

leye0 commented Dec 2, 2016

Having this error too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment