From a45b5073cac989da084f1bdb44cac71b6c6a61a8 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Thu, 11 Jun 2015 14:26:47 +0200 Subject: Implement a maintenance mode Add support for a maintenance mode that disables both the website and the SSH interface and can be enabled easily using a configuration option. Signed-off-by: Lukas Fleischer --- conf/config.proto | 1 + git-interface/git-serve.py | 5 +++++ web/html/503.php | 15 +++++++++++++++ web/html/index.php | 6 ++++++ 4 files changed, 27 insertions(+) create mode 100644 web/html/503.php diff --git a/conf/config.proto b/conf/config.proto index 1d3e329..e5da57a 100644 --- a/conf/config.proto +++ b/conf/config.proto @@ -28,6 +28,7 @@ auto_delete_age = 86400 pkgbuild_uri = https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=%s log_uri = https://aur.archlinux.org/cgit/aur.git/log/?h=%s snapshot_uri = https://aur.archlinux.org/cgit/aur.git/snapshot/%s.tar.gz +enable-maintenance = 1 [auth] valid-keytypes = ssh-rsa ssh-dss ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 ssh-ed25519 diff --git a/git-interface/git-serve.py b/git-interface/git-serve.py index 9812acb..21b130c 100755 --- a/git-interface/git-serve.py +++ b/git-interface/git-serve.py @@ -21,6 +21,8 @@ repo_regex = config.get('serve', 'repo-regex') git_shell_cmd = config.get('serve', 'git-shell-cmd') ssh_cmdline = config.get('serve', 'ssh-cmdline') +enable_maintenance = config.getboolean('options', 'enable-maintenance') + def pkgbase_exists(pkgbase): db = mysql.connector.connect(host=aur_db_host, user=aur_db_user, passwd=aur_db_pass, db=aur_db_name, @@ -110,6 +112,9 @@ if not cmd: cmdargv = shlex.split(cmd) action = cmdargv[0] +if enable_maintenance: + die("The AUR is down due to maintenance. We will be back soon.") + if action == 'git-upload-pack' or action == 'git-receive-pack': if len(cmdargv) < 2: die_with_help("%s: missing path" % (action)) diff --git a/web/html/503.php b/web/html/503.php new file mode 100644 index 0000000..80eb436 --- /dev/null +++ b/web/html/503.php @@ -0,0 +1,15 @@ + + +
+

503 -

+

+
+ +