Git Product home page Git Product logo

Comments (14)

djoos avatar djoos commented on September 26, 2024

Hi @jotajota,

thanks for getting in touch!

The php-agent recipe actually restarts the web server service (default: apache2) during the run, I think an actual reload instead would be better in your case, that shouldn't trigger the APC cache to be flushed - right?

I'd suggest you to change :restart in https://github.com/escapestudios/chef-newrelic/blob/master/recipes/php-agent.rb on line 29, 34 & 105 to :reload in your local cookbook and upload that to run some tests. Let me know if that fixes your issue, then I'll have a look at implementing that in the community version.

Thanks in advance for your feedback!

Kind regards,
David

from newrelic.

jotajota avatar jotajota commented on September 26, 2024

No, it seems that reload also flushes the apc cache. Would it make sense to check if the newrelic agent is already present before (re)installing it? By the look of it we are reinstalling the agent on every chef run and that seems wasteful :)

from newrelic.

djoos avatar djoos commented on September 26, 2024

Hi @jotajota,

by just checking whether the agent is already present you could actually end up running an outdated agent, so I'm not very much in favour of that solution. What if we were to add in a way to find out whether the php-agent upgrade actually resulted in a new php-agent version or not? Then we would only trigger all the rest if a new agent actually got installed...

I'm in favour of writing it to a file (~compile_flags, see below) in the chef cache, so that even on an apt-get upgrade the next time the cookbook runs it will pick up the upgraded agent and will make the necessary changes. If the file is not present, the "base" version will be stored, which will then be used in the future.

In other cookbooks we use the compile flags (https://github.com/escapestudios/chef-mplayer/blob/master/recipes/source.rb) to trigger additional bits, but haven't done anything similar with the package resource to be honest :-)

Let me know what you think!

Kind regards,
David

from newrelic.

jotajota avatar jotajota commented on September 26, 2024

Yeah having an outdated agent doesn't seem like a nice idea. I'll hack around a bit and get back to you if I think of something.

from newrelic.

djoos avatar djoos commented on September 26, 2024

Hi,

a notifies on the package resource could actually help out to prevent reinstalling the agent:

package "newrelic-php5" do
action :upgrade
notifies :run, "execute[newrelic-install]", :immediately
end

execute "newrelic-install" do
command "newrelic-install install"
action :nothing
notifies :restart, "service[#{node[:newrelic][:web_server][:service_name]}]", :delayed
end

Could you give our development branch with these changes a go?
(https://github.com/escapestudios/chef-newrelic/tree/development)

Thanks in advance!

Kind regards,
David

from newrelic.

jotajota avatar jotajota commented on September 26, 2024

Well, it's got better for sure :) Now we are not reinstalling newrelic on every run. Now the only thing we need is make it so that the recipe only sends the restart event to the webserver when there is an actual change on the newrelic agent.

I will take a look into that this weekend. Thanks so much!

from newrelic.

djoos avatar djoos commented on September 26, 2024

Cool :)

Which startup mode are you using, agent or external? That is the other place where a restart is notified...

Thanks in advance for your feedback, have a great weekend!

from newrelic.

jotajota avatar jotajota commented on September 26, 2024

Agent, going with the default settings for now.

from newrelic.

jotajota avatar jotajota commented on September 26, 2024

Ok, I've been giving this another go and the problem is not where I thought (the package upgrade) but in the next block (the if startup_mode == agent). Can you tell me what are you trying to accomplish here? Again, why do you turn the agent off and on on every run?

from newrelic.

djoos avatar djoos commented on September 26, 2024

Hi,

when using the agent mode, the daemon (=external mode) is stopped and there is actually nothing else turned off and on to be honest... (https://newrelic.com/docs/php/newrelic-daemon-startup-modes)

Only if there are changes to newrelic.ini the template resource should notify a restart of the web server. As a test: could you take out line 106 (notifies restart of web server) and see whether your issue is still there? Just to make sure your web server's restart is triggered over there or somewhere else...

Thanks in advance for your feedback!

Kind regards,
David

from newrelic.

djoos avatar djoos commented on September 26, 2024

Hi,

could you pull down the latest version of the development branch? We've just pushed some changes in there that should address the issue you flagged: rather than on any daemon changes (stop/start), we now send notifications to restart the web server on actual config changes - for both agent mode as external mode.

Again, for more information: see https://newrelic.com/docs/php/newrelic-daemon-startup-modes for more information.

Let me know how it goes, thanks in advance!

Kind regards,
David

from newrelic.

jotajota avatar jotajota commented on September 26, 2024

Works flawlessly now. Thanks a lot!

from newrelic.

djoos avatar djoos commented on September 26, 2024

Hi @jotajota,

perfect! FYI: we've just released the updates as version 0.4.4 of the community cookbook...
Thanks for your feedback!

Kind regards,
David

from newrelic.

jotajota avatar jotajota commented on September 26, 2024

👍 !!

from newrelic.

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.