ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Getting Started with a Chef Community Cookbook for NVM

    IT Discussion
    devops chef cookbook centos chef linux nodejs nvm centos 6
    1
    5
    2.5k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by scottalanmiller

      So I am trying to use a Chef Community Cookbook for deploying NVM, which in turn deploys Node.js on Linux.

      This is the NVM Cookbook that I am trying to use.

      I've added it to the code repo but this is my first time working with a community cookbook and I am not sure where to go from here. Clearly I need to modify it to tell it what to do but I am not sure what the pattern is for what I want it to do. Has anyone worked with this or one like it before?

      1 Reply Last reply Reply Quote 2
      • scottalanmillerS
        scottalanmiller
        last edited by

        The Readme says "For more usage examples, have a look to the recipes in test/cookbooks/nvm_test/recipes/" but no such directory exists.

        1 Reply Last reply Reply Quote 2
        • scottalanmillerS
          scottalanmiller
          last edited by

          And the verdict was that I was able to get it to "work" but it had deep dependencies that I did not want to be introducing for this one, very simple small task. So I had to step away from the "Chef" was to do it, and instead went with a completely custom Chef cookbook and recipe that just use a script resource to run a BASH few liner that downloads and processes NVM directly, the sources it and installs the Node.js verion(s) that I want.

          It might look krufty but it is super simple to use and to understand and to support long term and while it doesn't have any checks in it, the actual result retains idempotence.

          1 Reply Last reply Reply Quote 0
          • scottalanmillerS
            scottalanmiller
            last edited by

            This is the scripting guide that I worked from:

            https://docs.chef.io/resource_script.html

            1 Reply Last reply Reply Quote 0
            • scottalanmillerS
              scottalanmiller
              last edited by

              Really quite simple since NVM is so simple itself. Just used the standard curl + bash command to run the NVM install of the version of my choice (handling updates will have to come in a later version.) I use the install directory relocation option and that puts NVM into /usr/local/nvm rather than into the user's own folder. Then just source the newly installed nvm.sh file and run the NVM Node.js install command as usual. Voila.

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post