From c6a687736b3e4de94b5473439b31d58c3986904e Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Thu, 21 May 2015 20:29:29 +0000 Subject: [PATCH] More robust bash backends using heredoc --- orchestra/contrib/webapps/backends/php.py | 11 ++++++++--- orchestra/contrib/webapps/backends/wordpress.py | 9 ++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/orchestra/contrib/webapps/backends/php.py b/orchestra/contrib/webapps/backends/php.py index 39161e72..cab3e92d 100644 --- a/orchestra/contrib/webapps/backends/php.py +++ b/orchestra/contrib/webapps/backends/php.py @@ -185,12 +185,17 @@ class PHPBackend(WebAppServiceMixin, ServiceController): listen = {{ fpm_listen | safe }} listen.owner = {{ user }} listen.group = {{ group }} + pm = ondemand pm.max_requests = {{ max_requests }} pm.max_children = {{ max_children }} - {% if request_terminate_timeout %}request_terminate_timeout = {{ request_terminate_timeout }}{% endif %} - {% for name, value in init_vars.items %} - php_admin_value[{{ name | safe }}] = {{ value | safe }}{% endfor %} + + {% if request_terminate_timeout %}\ + request_terminate_timeout = {{ request_terminate_timeout }}\ + {% endif %} + {% for name, value in init_vars.items %}\ + php_admin_value[{{ name | safe }}] = {{ value | safe }}\ + {% endfor %} """ )) return fpm_config.render(Context(context)) diff --git a/orchestra/contrib/webapps/backends/wordpress.py b/orchestra/contrib/webapps/backends/wordpress.py index 62e85740..c86f4143 100644 --- a/orchestra/contrib/webapps/backends/wordpress.py +++ b/orchestra/contrib/webapps/backends/wordpress.py @@ -46,10 +46,13 @@ class WordPressBackend(WebAppServiceMixin, ServiceController): shell_exec("mkdir -p %(app_path)s # Prevent other backends from writting here touch %(app_path)s/.lock - filename=\\$(wget https://wordpress.org/latest.tar.gz --server-response --spider --no-check-certificate 2>&1 | grep filename | cut -d'=' -f2) + filename=\\$(wget https://wordpress.org/latest.tar.gz --server-response --spider --no-check-certificate 2>&1 \\ + | grep filename | cut -d'=' -f2) mkdir -p %(cms_cache_dir)s - if [ \\$(basename \\$(readlink %(cms_cache_dir)s/wordpress) 2> /dev/null ) != \\$filename ]; then - wget https://wordpress.org/latest.tar.gz -O - --no-check-certificate | tee %(cms_cache_dir)s/\\$filename | tar -xzvf - -C %(app_path)s --strip-components=1 + if [ ! -e %(cms_cache_dir)s/wordpress ] || [ \\$(basename \\$(readlink %(cms_cache_dir)s/wordpress) 2> /dev/null ) != \\$filename ]; then + wget https://wordpress.org/latest.tar.gz -O - --no-check-certificate \\ + | tee %(cms_cache_dir)s/\\$filename \\ + | tar -xzvf - -C %(app_path)s --strip-components=1 rm -f %(cms_cache_dir)s/wordpress ln -s %(cms_cache_dir)s/\\$filename %(cms_cache_dir)s/wordpress else