GithubHelp home page GithubHelp logo

lexik / lexikmaintenancebundle Goto Github PK

View Code? Open in Web Editor NEW
257.0 257.0 90.0 118 KB

This Symfony2 bundle allows you to place your website in maintenance mode by calling two commands in your console. A page with status code 503 appears to users, it is possible to authorize certain ips addresses stored in your configuration.

License: MIT License

PHP 100.00%
bundle php symfony symfony-bundle

lexikmaintenancebundle's People

Contributors

afurculita avatar aivus avatar akovalyov avatar demoboy avatar djurict avatar gilles-g avatar gperdomor avatar guilhemn avatar guillaume-sainthillier avatar inoryy avatar jeremyb avatar jjsaunier avatar leek avatar monvillalon avatar pborreli avatar roverwolf avatar rvanlaak avatar tiagojsag avatar tkuska avatar umens avatar uwej711 avatar virtualize avatar wcluijt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lexikmaintenancebundle's Issues

Project abandoned ?

Hi @lexikteam ,

Could you accept/process the current PRs ? and comment/close issues ? Or mark project as abandoned ?

There is a lot of good PR open that are awaiting your moderation.

Thanks,
Samuel

Lock, no such file or directory

When executing the lock command, Symfony throws a ContextErrorException :
Warning: fopen(/var/www/1day-symfony/app/var/cache/lock): failed to open stream: No such file or directory

How can I fix this?

Nothing happens

Hi all,

I use the bundle with my website from a long time and i didn't have any problem with it until now.

Now when i activate the maintenance, nothing happens, the site is still accesible and there is no errors in my logs, nothing to help me to know what happens.

It's sound that happens because of some change i did but which one ?

Any idea ?

TTL lock command argument is required for FileDriver

The TTL now seems to be required for the lock command when we use the FileDriver, even if this argument is not really used for this driver.
I think thaht the problem is in DriverLockCommand, line 63, when you call $driver->getTtl() on FileDriver, wich is not a DriverTtlInterface, this generate a php error.

Maybe a simple check with ($driver instanceof DriverTtlInterface) might fix the bug.

Anyway thanks for the bundle ;)

Call to undefined method NodeBuilder::integerNode()

I am getting the following error from php app/console:

Fatal error: Call to undefined method Symfony\Component\Config\Definition\Builder\NodeBuilder::integerNode() in /home/jbruni/ld/LoadingDeck/vendor/lexik/maintenance-bundle/Lexik/Bundle/MaintenanceBundle/DependencyInjection/Configuration.php on line 58

What should I do to correct this?

InactiveScopeException

When I try to run lexik:maintenance:lock , it throws InactiveScopeException with message "You cannot create a service ("request") of an inactive scope ("request") "

Symfony 2.1 support

Can't install with composer right now because it requires 2.0.* version. Is this intentional? Do you have plans to support 2.1?

Postgres 9.5 - Datetime not exists

Hello,

I move from MySQL to Postgresql. But it seems this bundle is not compatible. This is the full LOG.

Thanks !

DriverException in AbstractPostgreSQLDriver.php line 91: An exception occurred while executing 'CREATE TABLE IF NOT EXISTS lexik_maintenance (ttl datetime DEFAULT NULL)':

SQLSTATE[42704]: Undefined object: 7 ERROR: type "datetime" does not exist
LINE 1: CREATE TABLE IF NOT EXISTS lexik_maintenance (ttl datetime D...
^

    in AbstractPostgreSQLDriver.php line 91
    at AbstractPostgreSQLDriver->convertException('An exception occurred while executing 'CREATE TABLE IF NOT EXISTS lexik_maintenance (ttl datetime DEFAULT NULL)': SQLSTATE[42704]: Undefined object: 7 ERROR: type "datetime" does not exist LINE 1: CREATE TABLE IF NOT EXISTS lexik_maintenance (ttl datetime D... ^', object(PDOException)) in DBALException.php line 116
    at DBALException::driverExceptionDuringQuery(object(Driver), object(PDOException), 'CREATE TABLE IF NOT EXISTS lexik_maintenance (ttl datetime DEFAULT NULL)') in Connection.php line 1027
    at Connection->exec('CREATE TABLE IF NOT EXISTS lexik_maintenance (ttl datetime DEFAULT NULL)') in DefaultQuery.php line 51
    at DefaultQuery->createTableQuery() in DefaultQuery.php line 38
    at DefaultQuery->initDb() in DatabaseDriver.php line 98
    at DatabaseDriver->isExists() in AbstractDriver.php line 111
    at AbstractDriver->decide() in MaintenanceListener.php line 175
    at MaintenanceListener->onKernelRequest(object(GetResponseEvent), 'kernel.request', object(TraceableEventDispatcher))
    at call_user_func(array(object(MaintenanceListener), 'onKernelRequest'), object(GetResponseEvent), 'kernel.request', object(TraceableEventDispatcher)) in WrappedListener.php line 61
    at WrappedListener->__invoke(object(GetResponseEvent), 'kernel.request', object(TraceableEventDispatcher))
    at call_user_func(object(WrappedListener), object(GetResponseEvent), 'kernel.request', object(TraceableEventDispatcher)) in WrappedListener.php line 61
    at WrappedListener->__invoke(object(GetResponseEvent), 'kernel.request', object(ContainerAwareEventDispatcher))
    at call_user_func(object(WrappedListener), object(GetResponseEvent), 'kernel.request', object(ContainerAwareEventDispatcher)) in classes.php line 1853
    at EventDispatcher->doDispatch(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.request', object(GetResponseEvent)) in classes.php line 1771
    at EventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in TraceableEventDispatcher.php line 132
    at TraceableEventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in bootstrap.php.cache line 3199
    at HttpKernel->handleRaw(object(Request), '2') in bootstrap.php.cache line 3172
    at HttpKernel->handle(object(Request), '2', false) in bootstrap.php.cache line 3323
    at ContainerAwareHttpKernel->handle(object(Request), '2', false) in ExceptionListener.php line 50
    at ExceptionListener->onKernelException(object(GetResponseForExceptionEvent), 'kernel.exception', object(TraceableEventDispatcher))
    at call_user_func(array(object(ExceptionListener), 'onKernelException'), object(GetResponseForExceptionEvent), 'kernel.exception', object(TraceableEventDispatcher)) in WrappedListener.php line 61
    at WrappedListener->__invoke(object(GetResponseForExceptionEvent), 'kernel.exception', object(ContainerAwareEventDispatcher))
    at call_user_func(object(WrappedListener), object(GetResponseForExceptionEvent), 'kernel.exception', object(ContainerAwareEventDispatcher)) in classes.php line 1853
    at EventDispatcher->doDispatch(array(object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.exception', object(GetResponseForExceptionEvent)) in classes.php line 1771
    at EventDispatcher->dispatch('kernel.exception', object(GetResponseForExceptionEvent)) in TraceableEventDispatcher.php line 132
    at TraceableEventDispatcher->dispatch('kernel.exception', object(GetResponseForExceptionEvent)) in bootstrap.php.cache line 3242
    at HttpKernel->handleException(object(DriverException), object(Request), '1') in bootstrap.php.cache line 3178
    at HttpKernel->handle(object(Request), '1', true) in bootstrap.php.cache line 3323
    at ContainerAwareHttpKernel->handle(object(Request), '1', true) in bootstrap.php.cache line 2511
    at Kernel->handle(object(Request)) in app_dev.php line 29


Feature missing and other problems

Hi, i start using this bundle and i fix some issues that i notice but some problems are still present...

For example:

  • The allowed IPs are hardcoded, what happed if my ip change?

  • In the MaintenanceListener the validation of autorization parameters don't work as expected, for example, using:

    lexik_maintenance:
    authorized:
        query: { foo: bar }

    When you lock the app and open http://app_domain/?foo=barrrrrr the listener not throw the exception

Maintenance mode for commands

I want to disable even some commands (cronjobs) when the site is in maintenance mode. I think it can be done:

Option 1.-
In my commands I can call a service in your bundle to check if app is in maintenance mode or not.
Then I do skip command execution. Is there such a service in your bundle? (I have not found it).

Option 2.-
You can add one more listener to listen for The ConsoleEvents::COMMAND Event (http://symfony.com/doc/current/components/console/events.html#the-consoleevents-command-event)
and disable commands execution when maintenance mode is enable.

Waht do you think is the better option?

I pfrefer option 1 because I can decide which commands I want to disable.

I can do it with your current bundle version or I have to patch it?

Thanks.

Monolog email handler

When using bundle with Monolog email handler at logging level: critical

This will cause the mail to flood with invalid error messages about uncaught exception

How about adding an option to render the twig file rather than throwing the exception? (optionally)

Warning: count(): Parameter must be an array or an object that implements Countable

Stack Trace

in vendor/lexik/maintenance-bundle/Listener/MaintenanceListener.php at line 184 

at ErrorHandler ->handleError ('2', 'count(): Parameter must be an array or an object that implements Countable', '/.../symfony-www/vendor/lexik/maintenance-bundle/Listener/MaintenanceListener.php', '184', array('event' => object(GetResponseEvent), 'request' => object(Request))) 

at count (null) 
in vendor/lexik/maintenance-bundle/Listener/MaintenanceListener.php at line 184

IMHO

I suspect the problem to be in the server configuration, as otherwise the $ips could not be null โ€“ but where exactly?

503 Exception not catched

Hello,

In maintenance mode, when i try to go on my website in app_dev, i see a "503 Service Unavailable - ServiceUnavailableException ". It's ok.

But in prod environement, this exception is not catched like htttpException and my error page error503.html.twig is not called. In this case i have a blank page in Firefox and a "error 500" in Chrome.

All error page in my project are override and works perfectly, and if i try "throw new HttpException('503');" in any controller, my error503 page is called with no problem.

response: code and status options ignored

In docs there is part about:

 #Optional. response code and status of the mantainence page
    response:
        code: 503 
        status: "Service Temporarily Unavailable"    

I see $response->setStatusCode($this->http_code, $this->http_status); in code but somehow whatever I do I get

503 Service Unavailable - ServiceUnavailableException

to the browser in the end

Error on MaintenanceListener

Symfony 2.7

I got this error in profiler : Uncaught PHP Exception Lexik\Bundle\MaintenanceBundle\Exception\ServiceUnavailableException

Line concerned is 194 :
throw new ServiceUnavailableException();

I can't display a custom error 503

Several IPs in configuration

When I put a array of IPs in the config (like in the documentation), I've got this error :

ErrorException: Warning: strpos() expects parameter 1 to be string, array given in /var/www/symfony2/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/IpUtils.php line 53

Here my config.yml :

lexik_maintenance:
    authorized:
        ips: ['127.0.0.1', '172.123.10.14']
    driver:      
        ttl: 3600

         # File driver    
        class: '\Lexik\Bundle\MaintenanceBundle\Drivers\FileDriver'
        options: {file_path: %kernel.root_dir%/cache/lock}

         # MemCache driver
        class: Lexik\Bundle\MaintenanceBundle\Drivers\MemCacheDriver
        options: {key_name: 'maintenance', host: 127.0.0.1, port: 11211}

        # Database driver:               
        class: 'Lexik\Bundle\MaintenanceBundle\Drivers\DatabaseDriver'

        # Option 1 : for doctrine   
        options: {connection: custom}

        # Option 2 : for dsn, you must have a column ttl type datetime in your table.
        options: {dsn: "mysql:dbname=%database_name%;host=%database_host%", table: maintenance, user: %database_user%, password: %database_password%}

Orocommerce Maintenance (Impossible to do this action)

Hello masters,

I would like to ask the question, is there anybody here who facing the problem when maintenance Orocommerce (upgrade the last version) -- > when do the command : app/console lexik:maintenance:unlock --env prod
got the warning "Impossible to do this action". Please help me if anyone solved.

Thanks

compatible SF 3?

hi and thank for this bundle.
i was using with SF2 not probleme, but i start to code on SF3 and it das not work.

i wanted to know if it's compatible SF3?

Thank

--env=prod throws exception

./app/console lexik:maintenance:lock --env=prod

gives:

[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
You have requested a non-existent service "lexik_maintenance.driver.factory".

Feature request: add cookie option to allow access

In addition to the existing methods I would like to add cookies for authorization:

Have authorized users login into your backend (authorized by path /admin/*) and set a cookie there so that they can browse the site during maintenance. This is more comfortable than the query parameter.

I can do a PR if you want to.

Pass the allowed IPs as the lock command option

We are placing IPs that are allowed in the config file. This works for the pre determined IPs but what if we need to allow certain IP which is not mentioned in the config.yml ? Is there any possible way to pass the IPs to the lock command ?

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.