Commit 7a4ef3b6 authored by Marco Mariani's avatar Marco Mariani

create the superuser, set his password, provide a php.ini

parent 94f62e08
......@@ -25,6 +25,7 @@
#
##############################################################################
import md5
import os
import sys
import subprocess
......@@ -74,6 +75,7 @@ class Recipe(GenericBaseRecipe):
pgdata = self.options['pgdata-directory']
with open(os.path.join(pgdata, 'postgresql.conf'), 'wb') as cfg:
# XXX TODO listen_addresses
cfg.write(textwrap.dedent("""\
logging_collector = on
log_rotation_size = 50MB
......@@ -118,7 +120,17 @@ class Recipe(GenericBaseRecipe):
'-D', pgdata,
'postgres',
], stdin=subprocess.PIPE)
p.communicate('CREATE DATABASE %s\n' % self.options['dbname'])
password = 'insecure'
enc_password = md5.md5(password).hexdigest()
# to execute multiple commands, all newlines (but the last) must be preceded by backslash.
# see http://www.postgresql.org/docs/9.1/static/app-postgres.html
sql = '\n'.join([
'CREATE DATABASE %s\\\n' % self.options['dbname'],
"CREATE USER '%s' PASSWORD '%s' SUPERUSER'\n" % (self.options['user'], enc_password),
])
p.communicate(sql)
except subprocess.CalledProcessError:
raise UserError('Could not create database %s' % pgdata)
......
[PHP]
engine = On
safe_mode = Off
expose_php = Off
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED
display_errors = On
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
session.save_path = "%(tmp_directory)s"
session.auto_start = 0
date.timezone = Europe/Paris
file_uploads = On
upload_max_filesize = 8M
post_max_size = 8M
magic_quotes_gpc=Off
......@@ -41,3 +41,7 @@ install_cmd =
${apache-php-postgres:location}/bin/pear install maarch/CLITools-0.3.1
${apache-php-postgres:location}/bin/pear install MIME_Type
[apache-php-postgres]
php-ini-dir = ${buildout:directory}
......@@ -43,7 +43,7 @@ recipe = slapos.cookbook:postgres
# Options
ipv6_host = $${instance-parameters:ipv6}
user = user
user = postgres
port = 5432
dbname = db
# pgdata_directory is created by initdb, and should not exist beforehand.
......
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