Skip to content
Snippets Groups Projects
Commit 7c408ae1 authored by Stéphane Diemer's avatar Stéphane Diemer
Browse files

Changed postgres setup to set root pwd (refs #24073).

parent c90651bd
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import utils
def setup(interactive=True):
db_host = utils.get_conf('DB_HOST')
if db_host and not db_host.startswith('127') and db_host != 'localhost':
utils.log('Skipping postgresql setup because the database host is set to "%s".' % db_host)
return
cmds = [
'DEBIAN_FRONTEND=noninteractive apt-get install -y postgresql',
]
root_pwd = utils.get_conf('DB_PG_ROOT_PWD')
if root_pwd:
cmds.append('sudo su - postgres -c "psql -w -q -A -c "ALTER USER postgres WITH PASSWORD \'%s\';"' % root_pwd)
utils.run_commands(cmds)
#!/bin/bash
# TODO: use PostgreSQL custom repo
DEBIAN_FRONTEND=noninteractive apt-get install -y postgresql
......@@ -13,11 +13,11 @@ def setup(interactive=True):
'cp "%s/override.conf" "/etc/systemd/system/mysql.service.d/override.conf"' % dir_path,
'/etc/init.d/mysql restart',
]
MYSQL_ROOT_PWD = utils.get_conf('MYSQL_ROOT_PWD')
if MYSQL_ROOT_PWD:
root_pwd = utils.get_conf('DB_MYSQL_ROOT_PWD')
if root_pwd:
# Set password if any
cmds.append('mysqladmin -u root password "%s"' % MYSQL_ROOT_PWD)
cmds.append('mysqladmin -u root password "%s"' % root_pwd)
utils.run_commands(cmds)
if not MYSQL_ROOT_PWD:
if not root_pwd:
utils.log('No root password was set in the configuration file.\nUse the following command to change it:\n mysqladmin -u root password <pwd>')
......@@ -67,12 +67,11 @@ CM_ADMIN_PWD='test'
CACHE_SERVER_NAME=
CACHE_SOURCE=
# -- MySQL --
# -- Database --
DB_HOST=
# if no password is set, it will not be changed or set
MYSQL_ROOT_PWD=
MYSQL_HOST=
# client IP seen by mysql server, use commas to separate values
MYSQL_CONTACT_IP=
DB_PG_ROOT_PWD=
DB_MYSQL_ROOT_PWD=
# -- Celerity --
CELERITY_SIGNING_KEY='test'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment