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

cannot install 3.0 with new Symfony project #300

Open
tacman opened this issue Mar 23, 2024 · 10 comments
Open

cannot install 3.0 with new Symfony project #300

tacman opened this issue Mar 23, 2024 · 10 comments

Comments

@tacman
Copy link
Contributor

tacman commented Mar 23, 2024

Installing shows this error:

 Uncaught Error: Class "Liip\MonitorBundle\LiipMonitorBundle" not found
symfony new --webapp monitor-test && cd monitor-test
composer config minimum-stability dev
composer require liip/monitor-bundle:^3.0
bin/console debug:route

Enabling assets in framework and setting enabled to true in monitor.yaml does not change the error, so I didn't include them in the instructions.

Configure the bundle and routes:
    1. You MUST verify the configuration in config/packages/monitor.yaml.
    2. You MAY configure additional your checks and reporters, see the README.md for instructions.
    3. You MAY configure the routes as specified in the README.md if you enable the controller.

No security vulnerability advisories found
Symfony\Component\ErrorHandler\Error\ClassNotFoundError^ {#10
  #message: """
    Attempted to load class "LiipMonitorBundle" from namespace "Liip\MonitorBundle".\n
    Did you forget a "use" statement for "Liip\Monitor\LiipMonitorBundle"?
    """
  #code: 0
  #file: "./vendor/symfony/framework-bundle/Kernel/MicroKernelTrait.php"
  #line: 136
  trace: {
    ./vendor/symfony/framework-bundle/Kernel/MicroKernelTrait.php:136 { …}
    ./vendor/symfony/http-kernel/Kernel.php:332 { …}
    ./vendor/symfony/http-kernel/Kernel.php:724 { …}
    ./vendor/symfony/http-kernel/Kernel.php:123 { …}
    ./vendor/symfony/framework-bundle/Console/Application.php:179 { …}
    ./vendor/symfony/framework-bundle/Console/Application.php:71 { …}
    ./vendor/symfony/console/Application.php:169 { …}
    ./vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49 { …}
    ./vendor/autoload_runtime.php:29 { …}
    ./bin/console:15 {
      › 
      › require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
      › 
      arguments: {
        "/home/tac/trash/monitor-test/vendor/autoload_runtime.php"
      }
    }
  }
}
2024-03-23T13:00:14+00:00 [critical] Uncaught Error: Class "Liip\MonitorBundle\LiipMonitorBundle" not found

@kbond
Copy link
Collaborator

kbond commented Mar 23, 2024

I think the recipe for 2.x is being used: https://github.com/symfony/recipes-contrib/tree/main/liip/monitor-bundle/2.6

You'll have to remove the adjustments the recipe made and manually enable. (new bundle class is Liip\Monitor\LiipMonitorBundle)

@tacman
Copy link
Contributor Author

tacman commented Mar 23, 2024

Thanks. The recipe system is one of the weakest parts of the Symfony ecosystem. It seems like it'd be so much easier for bundle developers to configure the recipe within their bundle, and when it's published to packagist that Symfony automatically takes care of it.

@xabbuh
Copy link

xabbuh commented Mar 30, 2024

I have opened a PR to update the recipe for 3.0: symfony/recipes-contrib#1605

@tacman
Copy link
Contributor Author

tacman commented Mar 30, 2024

Thanks! How about adding the routing and a small config file that at least has a basic health check working that is installed with the recipe?

Should I be following the instructions in 3.0 or in master? 3.0 has a lot of details, but doesn't have routing instructions.

The default config listed in the 3.0 instructions has nulls for integers, which fail. I'm adding this here because I think adding the package and routing config to the recipe would be very helpful.

@kbond
Copy link
Collaborator

kbond commented Apr 1, 2024

3.0 has a lot of details, but doesn't have routing instructions.

I removed the routing from v3. There is an OhDear base controller that can be extended and configure routing for. At this point, no generic health check controller. I may revisit adding later.

@tacman
Copy link
Contributor Author

tacman commented Apr 5, 2024

I'm still not quite following how to integrate it with OhDear. Doesn't OhDear need an API endpoint to check? If I need something like https://packagist.org/packages/bitbirddev/oh-dear-bundle, could you add it to suggests?

The CLI is working (YAY!), but I miss the /monitor/health route that was in Version 2. Can you document how to re-add it?

@xabbuh thanks for updating the recipe! What do you think of adding /config/packages/liip_monitor.yaml as well, with something like this?

# config/packages/liip_monitor.yaml

liip_monitor:
  checks:
    system_memory_usage: true # warn @ 70%, fail @ 90%

    system_disk_usage: true # warn @ 70%, fail @ 90%

    # requires configuration
    system_free_disk_space:
      warning: 20GB
      critical: 10GB

    system_reboot: true

    system_load_average:
      1_minute: true # warn @ 70%, fail @ 90%
      5_minute: true # warn @ 70%, fail @ 90%
      15_minute: true # warn @ 70%, fail @ 90%

    apcu_memory_usage: true # warn @ 70%, fail @ 90%

    apcu_fragmentation: true # warn @ 70%, fail @ 90%

    opcache_memory_usage: true # warn @ 70%, fail @ 90%

    php_version: true

    composer_audit: true

    symfony_version: true

    dbal_connection: true # auto creates a check for each dbal connection
#    dbal_connection: default # use specific dbal connection
#    dbal_connection: [default, alternate] # use specific dbal connections

Then we can update the installation demo to something similar to the commands in the first message of this thread.

@kbond
Copy link
Collaborator

kbond commented Apr 9, 2024

I'm still not quite following how to integrate it with OhDear. Doesn't OhDear need an API endpoint to check?

https://github.com/liip/LiipMonitorBundle/tree/3.x?tab=readme-ov-file#ohdear-application-monitoring shows how to add this endpoint.

https://packagist.org/packages/bitbirddev/oh-dear-bundle

This appears to be an alternative to this bundle (that is ohdear specific)

What do you think of adding /config/packages/liip_monitor.yaml as well, with something like this?

I'd be ok with this but we should comment everything out to let users uncomment if they want to enable a specific feature. For instance, system reboot only works on certain linux servers.

but I miss the /monitor/health route that was in Version 2. Can you document how to re-add it?

Yes, that's a good idea.

@tacman
Copy link
Contributor Author

tacman commented Apr 9, 2024

Thanks! It appears that OhDear only offers paid plans (after a free trial). Are there other integrations for open source projects that are free?

I'll follow the OhDear instructions regardless.

@Chris53897
Copy link
Contributor

@tacman OhDear is totally worth the money.
The endpoint "just" generates a json response, which ohDear picks up.
Generating a new Endpoint should be not to hard to implement i guess.
Do you know good and free HealthChecker services?

@tacman
Copy link
Contributor Author

tacman commented Apr 10, 2024

I have lots of demo sites, sometimes just to prove that a bundle is installable. (You'd be amazed how many aren't!) For example, https://barcode-demo.survos.com/ is a trivial site that uses a barcode bundle I wrote (that wraps someone else's barcode library). So I don't want to pay to monitor this. For commercial sites, I'll check out OhDear.

I'm doing PWA's more now, and I often want to know if the site is up and if not, to disable things like form submits and logins.  While there's a mechanism to check for a network, that's not the same as checking that the server is working.  

My plan is to regularly monitor the site and dispatch an event that let's the user know that the server part of the site isn't available.  Like seeing "offline", but you might be online but not be able to see the server.

This bundle has many more tests, there's a much simpler bundle but it doesn't work with postgres.

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

4 participants