From 9c43fca8b394c76c28ed82487c523967becbd12d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Le=20Ninivin?= <cedric.leninivin@tiolive.com>
Date: Fri, 3 May 2013 11:12:59 +0200
Subject: [PATCH] Fix instance.cfg for apache frontend, no squid in recipe

---
 slapos/recipe/apache_frontend/__init__.py | 14 +++---
 software/apache-frontend/common.cfg       | 52 +++++++++++++----------
 software/apache-frontend/instance.cfg     | 34 +++++++--------
 3 files changed, 53 insertions(+), 47 deletions(-)

diff --git a/slapos/recipe/apache_frontend/__init__.py b/slapos/recipe/apache_frontend/__init__.py
index c196e6fa7..24d9eb3f5 100644
--- a/slapos/recipe/apache_frontend/__init__.py
+++ b/slapos/recipe/apache_frontend/__init__.py
@@ -272,13 +272,13 @@ class Recipe(BaseSlapRecipe):
     service_name = "squid_%s" % reference
     squid_ip = self.getLocalIPv4Address()
     stunnel_port = base_squid_port + 1
-    self.installSquidCache(service_name,
-      ip=squid_ip,
-      port=base_squid_port,
-      backend_host=squid_ip,
-      backend_port=stunnel_port,
-      domain=domain,
-      size="1G")
+    #self.installSquidCache(service_name,
+    #  ip=squid_ip,
+    #  port=base_squid_port,
+    #  backend_host=squid_ip,
+    #  backend_port=stunnel_port,
+    #  domain=domain,
+    #  size="1G")
     service_dict[service_name] = dict(public_ip=squid_ip,
         public_port=stunnel_port,
         private_ip=slave_host.replace("[", "").replace("]", ""),
diff --git a/software/apache-frontend/common.cfg b/software/apache-frontend/common.cfg
index fd3ce59d5..9a91dc815 100644
--- a/software/apache-frontend/common.cfg
+++ b/software/apache-frontend/common.cfg
@@ -1,51 +1,57 @@
 [buildout]
 extends =
+# dev Stuff
+  ../../component/git/buildout.cfg
+
+  ../../stack/slapos.cfg
   ../../component/binutils/buildout.cfg
   ../../component/lxml-python/buildout.cfg
   ../../component/apache/buildout.cfg
   ../../component/gzip/buildout.cfg
   ../../component/stunnel/buildout.cfg
-  ../../component/varnish/buildout.cfg
   ../../component/dcron/buildout.cfg
   ../../component/logrotate/buildout.cfg
   ../../component/rdiff-backup/buildout.cfg
   ../../component/squid/buildout.cfg
-  ../../stack/slapos.cfg
 
 parts =
+  slapos-cookbook
   template
   binutils
   apache-2.2
   apache-antiloris-apache-2.2
 
   stunnel
-  varnish-2.1
 
   dcron
   logrotate
   rdiff-backup
   squid
 
-## Buildoutish
-#  eggs
-#  instance-recipe-egg
-#
-#[instance-recipe]
-## Note: In case if specific instantiation recipe is used this is the place to
-## put its name
-#egg = slapos.cookbook
-#module = apache.frontend
-#
-#[instance-recipe-egg]
-#recipe = zc.recipe.egg
-#eggs = ${instance-recipe:egg}
-#
-#[eggs]
-#recipe = z3c.recipe.scripts
-#eggs =
-#  ${lxml-python:egg}
-#  slapos.toolbox
-#
+# Development profile of apache-frontend.
+# Exactly the same as software.cfg, but fetch the slapos.cookbook
+# from git repository instead of fetching stable version,
+# allowing to play with bleeding edge environment.
+
+# You'll need to run buildout twice for this profile.
+  slapos.cookbook-repository
+
+develop =
+	 ${:parts-directory}/slapos.cookbook-repository
+
+[slapos.cookbook-repository]
+recipe = slapos.recipe.build:gitclone
+repository = http://git.erp5.org/repos/slapos.git
+branch = starteggs-frontend
+git-executable = ${git:location}/bin/git
+
+[check-recipe]
+recipe = plone.recipe.command
+stop-on-error = true
+update-command = ${:command}
+command =
+  grep parts ${buildout:develop-eggs-directory}/slapos.cookbook.egg-link &&
+
 [template]
 # Default template for apache instance.
 recipe = slapos.recipe.template
diff --git a/software/apache-frontend/instance.cfg b/software/apache-frontend/instance.cfg
index fb00ba017..7bded0fd7 100644
--- a/software/apache-frontend/instance.cfg
+++ b/software/apache-frontend/instance.cfg
@@ -53,9 +53,9 @@ cert = $${slap_connection:cert_file}
 # All parameters are available through the configuration.XX syntax.
 # All possible parameters should have a default.
 configuration.domain = "example.org"
-configuration.public-ipv4 =
+configuration.public-ipv4 = ''
 configuration.port = 4443
-configuration.plain_http_port =
+configuration.plain_http_port = ''
 
 
 # Deploy Apache (old way, with monolithic recipe)
@@ -164,21 +164,21 @@ create = true
 
 [squid-cache]
 recipe = slapos.cookbook:squid
-prepare-path = ${directory:service}/squid-prepare
-wrapper-path = ${directory:service}/squid
+prepare-path = $${directory:service}/squid-prepare
+wrapper-path = $${directory:service}/squid
 binary-path = ${squid:location}/sbin/squid
-conf-path = ${directory:etc}/squid.cfg
-cache-path = ${directory:squid-cache}
-ip = ${squid-softinst34784:ip}
-port = ${squid-softinst34784:port}
-backend-ip = ${squid-softinst34784:backend-ip}
-backend-port = ${squid-softinst34784:backend-port}
-access-log-path = ${directory:log}/squid-access.log
-cache-log-path = ${directory:log}/squid-cache.log
-pid-filename-path = ${directory:run}/squid.pid
-
-[squid-softinst34784]
-ip = '10.0.24.140'
+conf-path = $${directory:etc}/squid.cfg
+cache-path = $${directory:squid-cache}
+ip = $${squid-hardcoded:ip}
+port = $${squid-hardcoded:port}
+backend-ip = $${squid-hardcoded:backend-ip}
+backend-port = $${squid-hardcoded:backend-port}
+access-log-path = $${directory:log}/squid-access.log
+cache-log-path = $${directory:log}/squid-cache.log
+pid-filename-path = $${directory:run}/squid.pid
+
+[squid-hardcoded]
+ip = 10.0.24.140
 port = 26010
-backend-ip = '10.0.24.140'
+backend-ip = 10.0.24.140
 backend-port = 26011
-- 
2.30.9