Use nginx and python to prevent the site from shutting down during the update

I have an active site hosted on Ubuntu, using nginx, the site is written in Python (CherryPy is the server, Bottle is the framework).

I have a shell script that copies the python file I uploaded on an existing live site, and then of course causes CherryPy to restart the server, so it runs the latest code (I want it). The problem is that it stops and starts In between, the default static page will be displayed to any unfortunate people trying to view the website page at the time (hope they don’t submit the form). I have seen this page many times during the update.

My current settings Are two copies running on two ports, using nginx reverse proxy on both ports. So I think if I update one, wait a few seconds, and then update the other, then the website will be in 100% of the time Rise, but this does not seem to be the case?

Assuming I have reverse proxy on ports 8095 and 8096, both show the same site, but show two identical copies on the hard drive. I updated the python file for port 8095, which resulted in The port is closed when CherryPy restarts. Shouldn’t everyone call 8096? It doesn’t seem to work like this. My file copy script has an 8 second delay, according to the CherryPy log, the restart stopped for the second time and restarted 6 seconds after the first restart, but I see the default static offline page displayed when the server is shut down . I am confused. According to the log, there is always a port.

This is part of my nginx.conf:

upstream app_servers {
server 127.0.0.1:8095;
server 127.0.0.1:8096;
}

server {
server_name www.mydomain.com;
listen 80;

error_page 502 503 /offline/offline.html;

location /offline {
alias /usr/share/nginx/html/mysite/1/ views/;
}

location / {
proxy_pass http://app_servers;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Scheme $scheme;
proxy_connect_timeout 10;
proxy_read_timeout 10;
}
}

try this: From the manual

upstream app_servers {
server 127.0.0.1:8095 max_fails=1 fail_timeout=1;
server 127.0.0.1:8096 max_fails=1 fail_timeout=1;;
}

I have an active site hosted on Ubuntu, using nginx, the site is written in Python (CherryPy is the server, Bottle is the framework).

I have a shell script that copies the python file I uploaded on an existing live site, and then of course causes CherryPy to restart the server, so it runs the latest code (I want it). The problem is, in Between it stop and start, the default static page will be displayed to any unfortunate people trying to view the website page at the time (hope they don’t submit the form). I have seen this page many times during the update.

My current setup is two copies running on two ports, using nginx reverse proxy on both ports. So I guess if I update one, wait a few seconds, and then update the other, then the website will be at 100 % Of the time, but this does not seem to be the case?

Assuming I have reverse proxy on ports 8095 and 8096, both show the same site, but show two identical copies on the hard drive. I updated the python file for port 8095, which resulted in The port is closed when CherryPy restarts. Shouldn’t everyone call 8096? It doesn’t seem to work like this. My file copy script has an 8 second delay, according to the CherryPy log, the restart stopped for the second time and restarted 6 seconds after the first restart, but I see the default static offline page displayed when the server is shut down . I am confused. According to the log, there is always a port.

This is part of my nginx.conf:

upstream app_servers {
server 127.0.0.1:8095;
server 127.0.0.1:8096;
}

server {
server_name www.mydomain.com;
listen 80;

error_page 502 503 /offline/offline.html;

location /offline {
alias /usr/share/nginx/html/mysite/1/ views/;
}

location / {
proxy_pass http://app_servers;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Scheme $scheme;
proxy_connect_timeout 10;
proxy_read_timeout 10;
}
}

Try this: From the manual

upstream app_servers {
server 127.0.0.1:8095 max_fails=1 fail_timeout=1;
server 127.0.0.1:8096 max_fails=1 fail_timeout=1;;
}

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4665 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.