Search code examples
node.jsdeploymentpm2

PM2 deploy folder structure - how to use / configure


I'm deploying a node application using PM2 and nvm as described in the pm2 documentation. I observe the resulting folder structure, and I'm questionning myself about why it is as it is, and if there is some way to configure it.

My ecosystem.config.js just contains the minimun information to connect to git (bitbucket) and check out the project, that's why I think it's not worth to put it here.

This is the folder structure I obtain running pm2 deploy production setup:

source/
       .git    // git root
       *.*     // all checked out projet files
shared/
       pids/   // empty folder, pids are in ~/.pm2/pids
       logs/   // empty folder, logs are in ~/.pm2/logs
current/       // symlink to /source
.deploys       // git commit ids

My questions are:

  • What is /current for ? navigating directly to /source will give the same result. In a capistrano deployment, where I have several releases checked out, having a symlink makes sense, since it allows to rollback instantly, but here I don't see how it could be useful.
  • What if I would only keep a subfolder of /source in the webroot ? Is there a way to configure this ? Maybe I'm still too much thinking in 'Apache mode', and there is no need for this ?

Solution

  • This github issue very well describes my problem (and others) ; https://github.com/Unitech/pm2-deploy/issues/27#issue-49186558

    The answer to my question is simpler that I hoped:

    • the symlink of the current/ folder misses its purpose.
    • there is no way to configure pm2 deploy in a more detailed way.