GithubHelp home page GithubHelp logo

Comments (5)

awsrequena avatar awsrequena commented on September 17, 2024

The package will only be downloaded, if there is no nodejs installed or the version doesn't match the expected one.

   not_if do
      ::File.exists?("/usr/local/bin/node") &&
      system("/usr/local/bin/node -v | grep -q '#{node[:opsworks_nodejs][:version]}'")
    end

and nodejs will only be installed, if a package was successfully downloaded

  execute "Install node.js #{node[:opsworks_nodejs][:version]}" do
    cwd "/tmp"
    command "dpkg -i /tmp/#{node[:opsworks_nodejs][:deb]}"

    only_if do
      ::File.exists?("/tmp/#{node[:opsworks_nodejs][:deb]}")
    end
  end

The nodejs package will be deleted after the recipe is through. We don't use the package resource here, because currently we host our packages as simple files on S3.

I don't really see the problem you are describing.

from opsworks-cookbooks.

timhaines avatar timhaines commented on September 17, 2024

@awsrequena Hey, thanks for the response. I'm using a slightly tweaked recipe, so it's possible I've done something to exclude it, but I don't see the nodejs package file being deleted after the recipe is through. Can you point me to the location in the recipes that takes care of that please?

BTW - dpkg has a -E option that lets you skip the install if it's the same version.

from opsworks-cookbooks.

awsrequena avatar awsrequena commented on September 17, 2024

Sorry, for the misleading information. The deletion of the package is not committed into master jet.

Thanks for the tipp, with the '-E'. The thing is that we don't want to download the agent unless it's necessary. Thus saving the download time.

from opsworks-cookbooks.

timhaines avatar timhaines commented on September 17, 2024

@awsrequena So with what's in master the installation is currently happening on each deploy right?

BTW - the package resource can also have an attribute called :source which can be used to specify a local file. i.e. /tmp/my-node-package.deb. The package resource is smart enough not to run the reinstall if the version already matches, although I haven't checked how it does this.

from opsworks-cookbooks.

awsrequena avatar awsrequena commented on September 17, 2024

You got me. Yes indeed, that code is installing the package every time ... that's why the deleting is on it's way.

I'll check if we can use that ":source" attribute.

Thanks again for the tipps.

from opsworks-cookbooks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.