Commit ce6d678ac99d12903c095874031345ac778015a6

Authored by Aurelio A. Heckert
Committed by Daniela Feitosa
1 parent afb05ea7

Create a noosfero configuration file for varnish

Today the varnish-noosfero.vcl has only the basic backend
configurations and the vcl_error routine to be compatible
with the noosfero error page. In the future more noosfero
configurations for varnish may be appended to this file.

(ActionItem1877)
INSTALL.varnish
... ... @@ -50,14 +50,22 @@ apache-compatible format. You should change your statistics generation software
50 50  
51 51 # invoke-rc.d varnish restart
52 52  
53   -6) Configure varnish to store separate caches for each language
  53 +6) Configure varnish to fit noosfero
  54 +(assuming Noosfero is installed in /var/lib/noosfero)
54 55  
55   -6a) Add the following line to your /etc/varnish/default.vcl file (assuming
56   -Noosfero is installed in /var/lib/noosfero):
  56 +6a) Configure noosfero specific rotines to varnish
  57 +
  58 +Add the following line to your /etc/varnish/default.vcl file:
  59 +
  60 + include "/var/lib/noosfero/etc/noosfero/varnish-noosfero.vcl";
  61 +
  62 +6b) Configure varnish to store separate caches for each language
  63 +
  64 +Add the following line to your /etc/varnish/default.vcl file:
57 65  
58 66 include "/var/lib/noosfero/etc/noosfero/varnish-accept-language.vcl";
59 67  
60   -6b) Restart Varnish
  68 +8) Restart Varnish
61 69  
62 70 # invoke-rc.d varnish restart
63 71  
... ...
etc/noosfero/varnish-noosfero.vcl 0 → 100644
... ... @@ -0,0 +1,137 @@
  1 +
  2 +backend default {
  3 + .host = "127.0.0.1";
  4 + .port = "8080";
  5 +}
  6 +
  7 +sub vcl_error {
  8 + set obj.http.Content-Type = "text/html; charset=utf-8";
  9 +
  10 + synthetic {"
  11 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  12 +<html xmlns="http://www.w3.org/1999/xhtml">
  13 + <head>
  14 + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  15 + <meta http-equiv="refresh" content="60"/>
  16 + <title>Technical problems</title>
  17 + <link rel="stylesheet" type="text/css" href="/designs/themes/default/errors.css"/>
  18 + <link rel="shortcut icon" href='/designs/themes/default/favicon.ico' type="image/x-icon" />
  19 + <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js'></script>
  20 + <script type='text/javascript'>
  21 + function display_error_message(language) {
  22 + if (!language) {
  23 + var language = ((navigator.language) ? navigator.language : navigator.userLanguage).replace('-', '_');
  24 + }
  25 + element = $(language);
  26 + if (!element) {
  27 + element = $(language.replace(/_.*$/, ''));
  28 + }
  29 + if (!element) {
  30 + element = $('en');
  31 + }
  32 + $$('.message').each(function(item) { item.hide() });
  33 + element.getElementsBySelector('h1').each(function(title) { document.title = title.innerHTML; });
  34 + element.show();
  35 + }
  36 + </script>
  37 +</head>
  38 +<body onload='display_error_message()'>
  39 + <div id='wrap'>
  40 + <div id='header'>
  41 + <div id='logo'>&nbsp;</div>
  42 + <div id='details'><b>"} obj.status "</b> - " obj.response {"</div>
  43 + </div>
  44 +
  45 + <div id='de' style='display: none' class='message'>
  46 + <h1>Kurzzeitiges Systemproblem</h1>
  47 + <p>
  48 + Unser technisches Team arbeitet gerade daran, bitte probieren Sie es nachher erneut. Wir entschuldigen uns f&uuml;r die Unannehmlichkeiten.
  49 + </p>
  50 + <ul>
  51 + <li><a href='javascript: history.back()'>Zur&uuml;ck</a></li>
  52 + <li><a href='/'>Gehe zur Homepage</a></li>
  53 + </ul>
  54 + </div>
  55 +
  56 + <div id='en' style='display: none' class='message'>
  57 + <h1>Temporary system problem</h1>
  58 + <p>
  59 + Our technical team is working on it, please try again later. Sorry for the inconvenience.
  60 + </p>
  61 + <ul>
  62 + <li><a href='javascript: history.back()'>Go back</a></li>
  63 + <li><a href='/'>Go to the site home page</a></li>
  64 + </ul>
  65 + </div>
  66 +
  67 + <div id='es' style='display: none' class='message'>
  68 + <h1>Temporary system problem</h1>
  69 + <p>
  70 + Our technical team is working on it, please try again later. Sorry for the inconvenience.
  71 + </p>
  72 + <ul>
  73 + <li><a href='javascript: history.back()'>Go back</a></li>
  74 + <li><a href='/'>Go to the site home page</a></li>
  75 + </ul>
  76 + </div>
  77 +
  78 + <div id='fr' style='display: none' class='message'>
  79 + <h1>Probl&egrave;me temporaire du syst&egrave;me.</h1>
  80 + <p>
  81 + Notre &eacute;quipe technique est en train d'y travailler. Merci de r&eacute;essayer plus tard. Nous sommes d&eacute;sol&eacute;s de la g&ecirc;ne occasionn&eacute;e.
  82 + </p>
  83 + <ul>
  84 + <li><a href='javascript: history.back()'>Retour</a></li>
  85 + <li><a href='/'>Aller &agrave; la page d'accueil du site</a></li>
  86 + </ul>
  87 + </div>
  88 +
  89 + <div id='hy' style='display: none' class='message'>
  90 + <h1>Temporary system problem</h1>
  91 + <p>
  92 + Our technical team is working on it, please try again later. Sorry for the inconvenience.
  93 + </p>
  94 + <ul>
  95 + <li><a href='javascript: history.back()'>&#x054e;&#x0565;&#x0580;&#x0561;&#x0564;&#x0561;&#x057c;&#x0576;&#x0561;&#x056c;</a></li>
  96 + <li><a href='/'>Go to the site home page</a></li>
  97 + </ul>
  98 + </div>
  99 +
  100 + <div id='pt' style='display: none' class='message'>
  101 + <h1>Problema tempor&aacute;rio no sistema</h1>
  102 + <p>
  103 + Nossa equipe t&eacute;cnica est&aacute; trabalhando nele, por favor tente mais tarde. Perdoe o incoveniente.
  104 + </p>
  105 + <ul>
  106 + <li><a href='javascript: history.back()'>Voltar</a></li>
  107 + <li><a href='/'>Ir para a p&aacute;gina inicial do site.</a></li>
  108 + </ul>
  109 + </div>
  110 +
  111 + <div id='ru' style='display: none' class='message'>
  112 + <h1>&#x0412;&#x0440;&#x0435;&#x043c;&#x0435;&#x043d;&#x043d;&#x0430;&#x044f; &#x043e;&#x0448;&#x0438;&#x0431;&#x043a;&#x0430; &#x0441;&#x0438;&#x0441;&#x0442;&#x0435;&#x043c;&#x044b;</h1>
  113 + <p>
  114 + &#x0422;&#x0435;&#x0445;&#x043d;&#x0438;&#x043a;&#x0438; &#x0443;&#x0436;&#x0435; &#x0440;&#x0430;&#x0431;&#x043e;&#x0442;&#x0430;&#x044e;&#x0442; &#x043d;&#x0430;&#x0434; &#x043f;&#x0440;&#x043e;&#x0431;&#x043b;&#x0435;&#x043c;&#x043e;&#x0439;, &#x043f;&#x043e;&#x0436;&#x0430;&#x043b;&#x0443;&#x0439;&#x0441;&#x0442;&#x0430;, &#x043f;&#x043e;&#x043f;&#x0440;&#x043e;&#x0431;&#x0443;&#x0439;&#x0442;&#x0435; &#x043f;&#x043e;&#x0437;&#x0436;&#x0435;.
  115 + </p>
  116 + <ul>
  117 + <li><a href='javascript:history.back()'>&#x041d;&#x0430;&#x0437;&#x0430;&#x0434;</a></li>
  118 + <li><a href='/'>&#x041f;&#x0435;&#x0440;&#x0435;&#x0439;&#x0442;&#x0438; &#x043d;&#x0430; &#x0434;&#x043e;&#x043c;&#x0430;&#x0448;&#x043d;&#x044e;&#x044e; &#x0441;&#x0442;&#x0440;&#x0430;&#x043d;&#x0438;&#x0446;&#x0443; &#x0441;&#x0430;&#x0439;&#x0442;&#x0430;</a></li>
  119 + </ul>
  120 + </div>
  121 +
  122 + <div id='languages'>
  123 + <a href="javascript: display_error_message('de')">Deutsch</a>
  124 + <a href="javascript: display_error_message('en')">English</a>
  125 + <a href="javascript: display_error_message('es')">Espa&ntilde;ol</a>
  126 + <a href="javascript: display_error_message('fr')">Fran&ccedil;ais</a>
  127 + <a href="javascript: display_error_message('hy')">&#x0570;&#x0561;&#x0575;&#x0565;&#x0580;&#x0565;&#x0576; &#x056c;&#x0565;&#x0566;&#x0578;&#x0582;</a>
  128 + <a href="javascript: display_error_message('pt')">Portugu&ecirc;s</a>
  129 + <a href="javascript: display_error_message('ru')">&#x0440;&#x0443;&#x0441;&#x0441;&#x043a;&#x0438;&#x0439; &#x044f;&#x0437;&#x044b;&#x043a;</a>
  130 + </div>
  131 +
  132 + </div>
  133 +</body>
  134 +</html>
  135 + "};
  136 + return(deliver);
  137 +}
... ...
public/designs/themes/base/errors.css
... ... @@ -19,17 +19,26 @@ body {
19 19 background: #ccc url(imgs/menu-top-bg-right.png) top right no-repeat;
20 20 height: 42px;
21 21 margin-top: 48px;
  22 + position: relative;
22 23 }
23 24  
24 25 #logo {
25 26 background: url(imgs/menu-top-bg-left.png) 0px 29px no-repeat;
26 27 position: absolute;
27   - top: 40px;
  28 + top: -29px;
28 29 height: 92px;
29 30 width: 400px;
30 31 z-index: 2;
31 32 }
32 33  
  34 +#details {
  35 + position: absolute;
  36 + bottom: 1px;
  37 + right: 13px;
  38 + color: #EEE;
  39 + Xtext-shadow: 1px 1px 1px #fff;
  40 +}
  41 +
33 42 .message,
34 43 #languages {
35 44 margin: 0px 20px;
... ...