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

rolling-deploy example relies on nodejs_forever which was removed from geerlingguy.nodejs #60

Closed
mattjmcnaughton opened this issue May 24, 2017 · 5 comments

Comments

@mattjmcnaughton
Copy link

I was working my way through the rolling-deploy example and noticed that any commands involving forever failed with 'No such file or directory'. I then noticed that this commit to geerlingguy.nodejs removed the nodejs_forever variable. However, rolling-deploy still sets nodejs_forever: true in provision.yml to install forever.

What is the best way to installforever with the newest version of the geerlingguy.nodejs role.

Thanks for an awesome book :)

@geerlingguy
Copy link
Owner

Oops! I'll have to fix that. The best way to get it installed in the mean time is with:

nodejs_npm_global_packages:
  - forever

Or with a version:

nodejs_npm_global_packages:
  - name: forever
    version: 0.15.3

@mattjmcnaughton
Copy link
Author

Thanks for the quick response! Unfortunately, I tried adding this variable to provision.yml, and I'm still getting the same error message. When I ssh'd to the vagrant machine with vagrant ssh, I noticed that forever was available when I was running as the vagrant user, but not when I was root. And if I'm understanding correctly, the ansible playbook runs as root. But I thought that installing the package globally would have also installed it for root?

Thanks for your help :)

@geerlingguy
Copy link
Owner

@mattjmcnaughton - I'm taking a look at this now.

@geerlingguy
Copy link
Owner

Yeah, in this case it looks like there's some extra trickery going on to get forever into the path /usr/local/lib/npm/bin/forever, and when I use sudo it's not in my path.

Two options are to:

  1. Doubly ensure that global packages are installed under the sudo user (in which case it goes to /usr/bin/forever and is accessible everywhere) (maybe there's a bug in my role?)
  2. Run the app deployment as the ansible_ssh_user instead of using sudo/become.

@geerlingguy
Copy link
Owner

geerlingguy commented May 26, 2017

@mattjmcnaughton - Aha! It looks like I had to set the following vars:

    nodejs_install_npm_user: root
    npm_config_prefix: "/usr"
    nodejs_npm_global_packages:
      - forever

Because that new config prefix is the parent directory inside which Node.js' global installs will be in the bin. Pushing up a fix soon, and I'll fix it in the book as well.

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