← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands-website/update_ops_script into lp:widelands-website

 

@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.

Diff comments:

> === modified file '_ops/apt_update.sh'
> --- _ops/apt_update.sh	2016-08-26 10:55:57 +0000
> +++ _ops/apt_update.sh	2019-06-21 11:41:04 +0000
> @@ -1,28 +1,25 @@
>  #!/bin/sh
>  # Updates all packages on the server, but stops the widelands website before
>  # doing so, in case mysql gets updated - it always results in really ugly
> -# errors for users otherwise. Ideally, this script would switch the website to
> -# a "In Maintenance" banner.
> +# errors for users otherwise.
>  #
> -# This script requires root access.
> +# This script requires sudo.
>  
>  set -ex
>  
> -if [ -z "$STY" ] && [ -z "$TMUX" ]; then 
> +if [ -z "${TMUX}" ]; then 
>     echo "Run inside screen or tmux in case SSH gets updated."
>     exit 1
>  fi
>  
> -apt-get update
> -stop wlwebsite || true
> -
> -# TODO(sirver): Upgrading widelands-data takes a long time (~30 minutes or
> -# longer). Use apt-mark hold to not update widelands and widelands-data to
> -# bring the website up quicker again. Then only upgrade those packages later,
> -# after the website is up again.
> -# See http://askubuntu.com/questions/99774/exclude-packages-from-apt-get-upgrade
> -apt-get dist-upgrade
> -
> -start wlwebsite
> -
> -apt-get autoremove -y
> +sudo apt update
> +
> +sudo systemctl stop wl-website

see top post.

> +sudo systemctl start wl-bauarbeiten
> +
> +sudo apt dist-upgrade
> +
> +sudo systemctl stop wl-bauarbeiten

see top post.

> +sudo systemctl start wl-website
> +
> +sudo apt autoremove -y


-- 
https://code.launchpad.net/~widelands-dev/widelands-website/update_ops_script/+merge/369163
Your team Widelands Developers is subscribed to branch lp:widelands-website.


References