V
V
voe2015-11-22 13:23:11
Nginx
voe, 2015-11-22 13:23:11

How to make a stub during technical work?

Actually the question itself :)
For now, see this way:
On the site database, make a field that will be responsible for the status of the site - 1 regular mode, 2 - maintenance.
When transferring to maintenance, we change the value in the database. We throw off all sessions from the site (using gem devise) and when logging in we check the status of the site and user rights, if the service is then when logging in (if there are no admin rights) we redirect to a page with 503 and the text - maintenance ...
Of course, you can stupidly block access altogether , but you need to leave access to the site to admins.
What other ideas are there? Is there a general practice?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Romanenko, 2015-11-22
@voe

On one of the projects we use the following config:

...
if (-f /var/www/project/deploy) {
    return 503;
  }
  error_page 503 @maintenance;
  location @maintenance {
    rewrite ^(.*)$ /maintenance.html break;
  }
...

At the beginning of the deployment, the /var/www/project/deloy file is created, after the deployment it is deleted. The project has a maintenance.html file, which says that technical work is underway.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question