Commit f6cba2aa authored by Marco Mariani's avatar Marco Mariani

abilian: moved redis to ipv4

parent de4541a6
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# #
############################################################################## ##############################################################################
import os
from slapos.recipe.librecipe import GenericBaseRecipe from slapos.recipe.librecipe import GenericBaseRecipe
...@@ -49,15 +48,38 @@ class Recipe(GenericBaseRecipe): ...@@ -49,15 +48,38 @@ class Recipe(GenericBaseRecipe):
else: else:
requirepass = "# requirepass foobared" requirepass = "# requirepass foobared"
if self.options.get('ipv6'):
bind6 = "bind6 %s" % self.options['ipv6']
else:
bind6 = "# bind6 <address>"
if self.options.get('ipv4'):
bind = "bind %s" % self.options['ipv4']
else:
bind = "# bind <address>"
if self.options.get('port6'):
port6 = "port6 %s" % self.options['port6']
else:
port6 = "# port6 6379"
if self.options.get('port'):
port = "port %s" % self.options['port']
else:
port = "# port 6379"
config_file = self.options['config_file'].strip() config_file = self.options['config_file'].strip()
configuration = dict(pid_file=self.options['pid_file'], configuration = {
port=self.options['port'], 'pid_file': self.options['pid_file'],
ipv6=self.options['ipv6'], 'bind6': bind6,
server_dir=self.options['server_dir'], 'bind': bind,
log_file=self.options['log_file'], 'port6': port6,
masterauth=masterauth, 'port': port,
requirepass=requirepass 'server_dir': self.options['server_dir'],
) 'log_file': self.options['log_file'],
'masterauth': masterauth,
'requirepass': requirepass
}
config = self.createFile(config_file, config = self.createFile(config_file,
self.substituteTemplate(self.getTemplateFilename('redis.conf.in'), self.substituteTemplate(self.getTemplateFilename('redis.conf.in'),
...@@ -78,7 +100,7 @@ class Recipe(GenericBaseRecipe): ...@@ -78,7 +100,7 @@ class Recipe(GenericBaseRecipe):
'%s.promise.main' % __name__, '%s.promise.main' % __name__,
{ {
'host': self.options['ipv6'], 'host': self.options['ipv6'],
'port': self.options['port'], 'port': self.options['port6'],
'requirepass_file': self.options.get('promise_requirepass_file') 'requirepass_file': self.options.get('promise_requirepass_file')
} }
) )
......
...@@ -22,15 +22,16 @@ pidfile %(pid_file)s ...@@ -22,15 +22,16 @@ pidfile %(pid_file)s
# Accept connections on the specified port, default is 6379. # Accept connections on the specified port, default is 6379.
# If port 0 is specified Redis will not listen on a TCP socket. # If port 0 is specified Redis will not listen on a TCP socket.
port6 %(port)s %(port6)s
port 0 %(port)s
# If you want you can bind a single interface, if the bind option is not # If you want you can bind a single interface, if the bind option is not
# specified all the interfaces will listen for incoming connections. # specified all the interfaces will listen for incoming connections.
# Bind can also be an IPv6 address # Bind can also be an IPv6 address
# bind 127.0.0.1 # bind 127.0.0.1
# bind ::1 # bind ::1
bind6 %(ipv6)s %(bind6)s
%(bind)s
# Specify the path for the unix socket that will be used to listen for # Specify the path for the unix socket that will be used to listen for
# incoming connections. There is no default, so Redis will not listen # incoming connections. There is no default, so Redis will not listen
......
...@@ -15,6 +15,8 @@ bytes = 16 ...@@ -15,6 +15,8 @@ bytes = 16
recipe = slapos.cookbook:redis.server recipe = slapos.cookbook:redis.server
server_bin = ${redis:location}/bin/redis-server server_bin = ${redis:location}/bin/redis-server
ipv6 = $${instance-parameters:ipv6-random} ipv6 = $${instance-parameters:ipv6-random}
port6 = 6379
ipv4 = $${instance-parameters:ipv4-random}
port = 6379 port = 6379
pid_file = $${directories:run}/redis.pid pid_file = $${directories:run}/redis.pid
server_dir = $${directories:srv} server_dir = $${directories:srv}
......
...@@ -45,8 +45,8 @@ cert = $${slap-connection:cert-file} ...@@ -45,8 +45,8 @@ cert = $${slap-connection:cert-file}
recipe = slapos.cookbook:jsondump recipe = slapos.cookbook:jsondump
json-output = $${buildout:directory}/abilian-config-extra.json json-output = $${buildout:directory}/abilian-config-extra.json
UNOCONV_LOCATION = ${unoconv-repository:location}/unoconv UNOCONV_LOCATION = ${unoconv-repository:location}/unoconv
BROKER_URL = redis://:$${redis-requirepass:passwd}@[$${redis:ipv6}]:$${redis:port}/2 BROKER_URL = redis://:$${redis-requirepass:passwd}@[$${redis:ipv4}]:$${redis:port}/2
CELERY_RESULT_BACKEND = redis://:$${redis-requirepass:passwd}@[$${redis:ipv6}]:$${redis:port}/2 CELERY_RESULT_BACKEND = redis://:$${redis-requirepass:passwd}@[$${redis:ipv4}]:$${redis:port}/2
SECRET_KEY = $${csrf-secret-key:passwd} SECRET_KEY = $${csrf-secret-key:passwd}
INSTANCE_HOST = $${instance-parameters:ipv6-random} INSTANCE_HOST = $${instance-parameters:ipv6-random}
......
...@@ -229,7 +229,7 @@ configure-command = ...@@ -229,7 +229,7 @@ configure-command =
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg.in url = ${:_profile_base_location_}/instance.cfg.in
output = ${buildout:directory}/instance.cfg output = ${buildout:directory}/instance.cfg
md5sum = 23167d761e13d9eb41e381beecfc7664 md5sum = 3b6105aa9335141c2d73871bdde80e9d
mode = 0644 mode = 0644
[instance-postgres] [instance-postgres]
...@@ -243,7 +243,7 @@ mode = 0644 ...@@ -243,7 +243,7 @@ mode = 0644
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-redis.cfg.in url = ${:_profile_base_location_}/instance-redis.cfg.in
output = ${buildout:directory}/instance-redis.cfg output = ${buildout:directory}/instance-redis.cfg
md5sum = e0f32e25d059ec67dfccd132cbb6095e md5sum = a322af67bcfd73f1782494c147499071
mode = 0644 mode = 0644
[instance-extranet] [instance-extranet]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment