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

stuck on deploy step #4

Closed
jksdua opened this issue Aug 2, 2014 · 17 comments · Fixed by #35
Closed

stuck on deploy step #4

jksdua opened this issue Aug 2, 2014 · 17 comments · Fixed by #35

Comments

@jksdua
Copy link

jksdua commented Aug 2, 2014

Hi there,

I am trying to use the pm2 deploy feature but getting stuck on step 2 - deployment. I've run the setup command which successfully clones the repo but the next command throws the following error:

Edit: Works fine when using visionmedia/deploy directly.

--> Deploying in development environment on host 192.168.x.x
Not a git repository
To compare two paths outside a working tree:
usage: git diff [--no-index] <path> <path>

  commit or stash your changes before deploying

1

Config file:

{
  "apps" : [{
    "name"      : "xxx",
    "script"    : "./server/app.js",
    "env_development": {
      "NODE_ENV": "development",
      "NPM_PORT": 3000,
      "NPM_HOST": "0.0.0.0",
      "NPM_DB-URL": "localhost/cmp"
    },
    "args": "['--harmony']"
  }],
  "deploy" : {
    "development" : {
      "user" : "user",
      "host" : "192.168.x.x",
      "ref"  : "v0.1.3",
      "repo" : "[email protected]:hidden/hidden.git",
      "path" : "$HOME/xxx",
      "post-deploy" : "pm2 startOrRestart ecosystem.json && pm2 save"
    }
  }
}
@tianp
Copy link

tianp commented Aug 14, 2014

Just have same issue here

@tianp
Copy link

tianp commented Aug 14, 2014

Founds out that local git repository where ecosystem.json file located should be clean before deploying.

@jksdua
Copy link
Author

jksdua commented Aug 14, 2014

Forgot to add, worked for me when cloning pm2 project from github. Maybe the npm version is outdated or buggy.

@keithics
Copy link

i have the same issue. probably because of gitignore was cached.
in .gitignore added.
.deploys
source
then...
i did this git rm --cached .deploys and git rm --cached source

@raiscui
Copy link

raiscui commented Sep 29, 2014

I have same issue,

nodejs@44de8b0f1d41:/pm2-ecosystem$ pm2 deploy dev setup
--> Deploying to dev environment
--> on host gabriel
○ running setup
○ cloning [email protected]:rais/gabriel.git
Cloning into '/home/nodejs/nodeapp/gabriel/development/source'...
○ setup complete
--> Success
nodejs@44de8b0f1d41:
/pm2-ecosystem$ pm2 deploy dev
--> Deploying to dev environment
--> on host gabriel
Not a git repository
To compare two paths outside a working tree:
usage: git diff [--no-index]

commit or stash your changes before deploying

Deploy failed

@Unitech
Copy link
Owner

Unitech commented Sep 29, 2014

Paste your ecosystem.json here

@raiscui
Copy link

raiscui commented Sep 30, 2014

{
  "apps" : [{
    "name"      : "Gabriel",
    "script"    : "appcoffee.coffee",
    "env": {
      "COMMON_VARIABLE": "true"
    },
    "env_dev" : {
      "NODE_ENV": "dev",
      "DEBUG":"*"
    }
  }
  ],
  "deploy" : {
    "dev" : {
      "user" : "nodejs",
      "host" : "gabriel",
      "ref"  : "master",
      "repo" : "[email protected]:rais/gabriel.git",
      "path" : "/home/nodejs/nodeapp/gabriel/development",
      "post-deploy" : "pm2 startOrRestart ecosystem.json --env dev"


    }
  }
}

the "gabriel" is local network pc

@jksdua
Copy link
Author

jksdua commented Sep 30, 2014

Your repo isn't online yet so pm2 can't clone the repo. Push it to github,
clone it on your deployment server to confirm the server has access and try
again.

Alternatively, if the repo can be accessed via the local network, use that
url instead and follow the above steps.

On Tue, Sep 30, 2014 at 11:50 PM, RaisCui [email protected] wrote:

{
"apps" : [{
"name" : "Gabriel",
"script" : "appcoffee.coffee",
"env": {
"COMMON_VARIABLE": "true"
},
"env_dev" : {
"NODE_ENV": "dev",
"DEBUG":"*"
}
}
],
"deploy" : {
"dev" : {
"user" : "nodejs",
"host" : "gabriel",
"ref" : "master",
"repo" : "[email protected]:rais/gabriel.git",
"path" : "/home/nodejs/nodeapp/gabriel/development",
"post-deploy" : "pm2 startOrRestart ecosystem.json --env dev"

}

}
}

the "gabriel" is local network pc


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

@raiscui
Copy link

raiscui commented Oct 1, 2014

my master pm2 server and deploy server both can clone the "[email protected]:rais/gabriel.git" .

it's a Private git project, but both pc can clone with "Deploy keys" for "[email protected]:rais/gabriel.git",

pm2 can got file cloned into deploy server -- "gabriel", that's "current , shared,source" ,3 folder, and current(source) folder is clean git data( I use git add, commit , diff ,status ..eg)

I don't understand when I run "pm2 deploy dev" , it show me :
--> Deploying to dev environment
--> on host gabriel
Not a git repository

I don't know what folder and why it said "Not a git repository" ??

(both PC , I used "nodejs" user for do all things,)

@alentame
Copy link

Same issue here.

jenkins@alentame-server:~$ pm2 deploy ecosystem.json production setup
--> Deploying to production environment
--> on host localhost
  ○ running setup
  ○ cloning [email protected]:trentosoftware/futbol-amateur.git
Cloning into '/home/deploy/alentame-web/source'...
  ○ setup complete
--> Success

And then...

jenkins@alentame-server:~/workspace$ pm2 deploy ecosystem.json production 
--> Deploying to production environment
--> on host localhost
Not a git repository
To compare two paths outside a working tree:
usage: git diff [--no-index] <path> <path>

  commit or stash your changes before deploying

Deploy failed

ecosystem.json:

{
  "apps" : [
    {
      "name"      : "alentame",
      "script"    : "server/bin/www.js",
      "env": {
        "COMMON_VARIABLE": "true"
      },
      "env_production" : {
        "NODE_ENV": "production"
      }
    }
  ],

  "deploy" : {
    "production" : {
      "user" : "deploy",
      "host" : "localhost",
      "ref"  : "origin/master",
      "repo" : "[email protected]:trentosoftware/futbol-amateur.git",
      "path" : "/home/deploy/alentame-web",
      "post-deploy" : "pm2 startOrRestart ecosystem.json --env production"
    }
  }
}

I have two users on the same machine. I want my jenkins user to run pm2 deploy command in order to let deploy user to do his job.

Any ideas?

@alentame
Copy link

Seems to be an issue with the deploy script.

I added a comment here: visionmedia/deploy#22

@Jokero
Copy link

Jokero commented Jan 23, 2015

Same issue(

@levequej
Copy link

it seems that this bug came back with 2.4.0, It's also solved for me if I cwd to $path/source

@t0lkman
Copy link
Contributor

t0lkman commented Feb 24, 2019

so how to fix the issue?

www-data@vps:~/tools$ pm2 deploy --version
3.2.9

@tx46
Copy link

tx46 commented May 22, 2019

Still having this issue, what do I do?

@pbmzero
Copy link

pbmzero commented Apr 17, 2020

I found this thread after getting the commit or stash changes before deploying, i had my changes committed. In my case the message was misleading i was missing setup argument in the deploy syntax

Failed:
pm2 deploy ecosystem.config.js production
--> Deploying to production environment
--> on host 10.125.133.22
commit or stash your changes before deploying
Deploy failed

vs

pm2 deploy ecosystem.config.js production setup

@drthoben
Copy link

Could #193 be the problem in your cases?

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

Successfully merging a pull request may close this issue.