Merge lp:~widelands-dev/widelands-website/update_ops_script into lp:widelands-website

Proposed by SirVer
Status: Merged
Merged at revision: 541
Proposed branch: lp:~widelands-dev/widelands-website/update_ops_script
Merge into: lp:widelands-website
Diff against target: 44 lines (+12/-17)
1 file modified
_ops/apt_update.sh (+12/-17)
To merge this branch: bzr merge lp:~widelands-dev/widelands-website/update_ops_script
Reviewer Review Type Date Requested Status
Toni Förster Approve
SirVer Needs Resubmitting
kaputtnik Pending
Review via email: mp+369163@code.launchpad.net

Commit message

Adapt the update script for the new server.

To post a comment you must log in.
Revision history for this message
Toni Förster (stonerl) :
review: Needs Fixing
Revision history for this message
SirVer (sirver) wrote :

@stonerl: push back on your comments. In fact, if you try revision 541 of this script on the server, you'll see that the website ends up with the nginx default site being served after the script has ran. I debugged so far to see that there was no www.widelands.org link in /etc/nginx/sites-enabled.

My hunch is that there is a race condition between this link being deleted and created by the two systemd units, so there is a bug. Feel free to test and debug yourself.

However, even though the implementation would work as advertised, I still feel that the way I wrote the code in 542 is more defensive, hence better.

Revision history for this message
Toni Förster (stonerl) wrote :

Fixed it. You just need:

sudo systemctl stop wl-website

at the beginning and

sudo systemctl start wl-website

ath the and.

I left the wl-bauarbeiten.service in place but it is not necessary to call it anymore. When stopping the wl-website service it will automatically enable the bauarbeiten configuration for nginx.

Revision history for this message
Toni Förster (stonerl) :
Revision history for this message
kaputtnik (franku) wrote :

Since this is used by Sirver, he should decide if the 'fix' works or not and if he want more control or not.

@SirVer: Do you want me to merge this once it is ready?

543. By SirVer

Adressed reviewer comments.

Revision history for this message
SirVer (sirver) wrote :

Toni, as discussed in IRC. ptal.

Kaputtnik, jup, will take care of merging.

review: Needs Resubmitting
Revision history for this message
Toni Förster (stonerl) wrote :

LGTM :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '_ops/apt_update.sh'
2--- _ops/apt_update.sh 2016-08-26 10:55:57 +0000
3+++ _ops/apt_update.sh 2019-06-21 18:30:35 +0000
4@@ -1,28 +1,23 @@
5 #!/bin/sh
6 # Updates all packages on the server, but stops the widelands website before
7 # doing so, in case mysql gets updated - it always results in really ugly
8-# errors for users otherwise. Ideally, this script would switch the website to
9-# a "In Maintenance" banner.
10+# errors for users otherwise.
11 #
12-# This script requires root access.
13+# This script requires sudo.
14
15 set -ex
16
17-if [ -z "$STY" ] && [ -z "$TMUX" ]; then
18+if [ -z "${TMUX}" ]; then
19 echo "Run inside screen or tmux in case SSH gets updated."
20 exit 1
21 fi
22
23-apt-get update
24-stop wlwebsite || true
25-
26-# TODO(sirver): Upgrading widelands-data takes a long time (~30 minutes or
27-# longer). Use apt-mark hold to not update widelands and widelands-data to
28-# bring the website up quicker again. Then only upgrade those packages later,
29-# after the website is up again.
30-# See http://askubuntu.com/questions/99774/exclude-packages-from-apt-get-upgrade
31-apt-get dist-upgrade
32-
33-start wlwebsite
34-
35-apt-get autoremove -y
36+sudo apt update
37+
38+sudo systemctl stop wl-website
39+
40+sudo apt dist-upgrade
41+
42+sudo systemctl start wl-website
43+
44+sudo apt autoremove -y

Subscribers

People subscribed via source and target branches