Coder Social home page Coder Social logo

syliusmaintenanceplugin's Introduction

License CI - Analysis CI - Sylius Version Total Downloads

Sylius Maintenance Plugin

Features

When your website is under maintenance, and you want to :

  • Do not allow access to your website and display the message "the website is under maintenance" on the frontpage.
  • Allow access to your website to some Ips addresses or secret token
  • Activate and deactivate these behaviors by commands
  • Activate and deactivate behaviors in your Sylius Back-office
  • Custom your message in your Sylius Back-office
  • Allow access to search bots to avoid negative impact on SEO

Alt text

Requirements

Version
PHP ^8.0
Sylius ^1.10

Installation

  1. Add the bundle and dependencies in your composer.json :

    composer require synolia/sylius-maintenance-plugin
  2. Import required config in your config/packages/_sylius.yaml file:

    imports:
        - { resource: "@SynoliaSyliusMaintenancePlugin/Resources/config/config.yaml" }
  3. Import routing in your config/routes.yaml file:

    synolia_maintenance:
        resource: "@SynoliaSyliusMaintenancePlugin/Resources/config/admin_routing.yaml"
        prefix: '/%sylius_admin.path_name%'
  4. Clear cache

    php bin/console cache:clear

Usage

  • To turn your website under maintenance, please create a file maintenance.yaml at the root of your project.

  • If you want to allow access for some Ips, please add these Ip into maintenance.yaml
    For example :

    ips: [172.16.254.1, 255.255.255.255, 192.0.0.255]

You can turn your website under maintenance by console commands :

  1. Enable the plugin

     php bin/console maintenance:enable
  2. Enable the plugin and add one or multiple ips addresses separated with a space

    php bin/console maintenance:enable 172.16.254.1 255.255.255.255 192.0.0.255
  3. Disable the plugin

    php bin/console maintenance:disable
  4. Remove configuration file using CLI

By default, maintenance.yaml configuration file remains when running maintenance:disable or via admin panel using toggle disable Nevertheless passing option [-c|--clear] to command line above will reset previous saved configuration

You can also turn your website under maintenance in Back Office :

  • Enable/disable the plugin
  • Allow access for one or multiple ips addresses (optional)
  • Allow access for secret token (optional)
  • Create your custom message (optional)
  • Grant access to search bots during maintenance (optional)

If you want to put the maintenance.yaml in a directory, please add your directory in .env:

For example :

 SYNOLIA_MAINTENANCE_DIR=var/maintenance

If you want to add cache on the maintenance.yaml:

# .env
SYNOLIA_MAINTENANCE_CACHE=30 # ttl in seconds

And in project code (for exemple with redis)

# config/packages/prod/cache.yaml
framework:
    cache:
        ...
        pools:
            ...
            synolia_maintenance.cache:
                adapter: cache.adapter.redis

Development

See How to contribute.

License

This library is under the EUPL-1.2 license.

Credits

Developed by Synolia.

syliusmaintenanceplugin's People

Contributors

jibbarth avatar maxperei avatar oallain avatar timmess avatar tuyetrinhvo avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

syliusmaintenanceplugin's Issues

Go past maintenance page with a cookie instead of an IP

Restricting based on IPs is not always feasible. Eg. mobile 4G connections have dynamic IPs, corporate firewalls might pose problems, things can go south pretty fast.

in the past 4-5 years, the way I tackled going beyond maintenance page was with secret cookies:

  • you have the cookie, you see the website
  • you don't have the cookie, you see the maintenance page

you can get the cookie by manually fiddling around with your browser.
or by accessing a secret url that creates that cookie in your browser.
or through a bookmarklet.

this way, you can go past the maintenance page by using any kind of devices.

this came off from a Twitter conversation: https://twitter.com/oallain33/status/1449299407741067266

[Feature] Global Service

It's possible to know how to configure a global service to determine if the maintenance mode is enabled or not.

Because I don't found the way to do it.

Thanks in advance

[Bug] Field "custom message" is not saved

Hello,

Describe the bug
Field "custom message" is not saved
Each time, we put and retire the site in maintenance mode, the message is lose.

To Reproduce

Expected behavior
It will be better to keep the message because we use command line and we can't put it in parameter.

Screenshots

Additional context

[Feature] Sylius 1.11 compatibility

Hello, and thank you for this plugin !

Is your feature request related to a problem? Please describe.
I can't install this plugin because my project use Sylius 1.11 ("sylius/sylius": "^1.11").

Problem 1
- Root composer.json requires synolia/sylius-maintenance-plugin ^1.1 -> satisfiable by synolia/sylius-maintenance-plugin[v1.1.0].
- synolia/sylius-maintenance-plugin v1.1.0 requires sylius/sylius ~1.9.0 || ~1.10.0 -> found sylius/sylius[v1.9.0, ..., v1.10.14] but it conflicts with your root composer.json require (^1.11).

Describe the solution you'd like
The plugin should support Sylius 1.11

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.