mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Moved ers database creation in a separate script
This commit is contained in:
committed by
Dan Christian Bogos
parent
e0fdc54ca3
commit
2de9da2349
@@ -147,12 +147,24 @@
|
||||
args:
|
||||
chdir: '{{ cgrates_dir }}/data/storage/mysql/'
|
||||
|
||||
- name: post install for ers mysql
|
||||
become: yes
|
||||
command: 'sh {{ cgrates_dir }}/data/storage/mysql/setup_ers_db.sh root CGRateS.org localhost'
|
||||
args:
|
||||
chdir: '{{ cgrates_dir }}/data/storage/mysql/'
|
||||
|
||||
- name: post install postgres2
|
||||
become: yes
|
||||
command: 'sh {{ cgrates_dir }}/data/storage/postgres/create_db_with_users.sh'
|
||||
args:
|
||||
chdir: '{{ cgrates_dir }}/data/storage/postgres/'
|
||||
|
||||
- name: post install for ers postgres
|
||||
become: yes
|
||||
command: 'sh {{ cgrates_dir }}/data/storage/postgres/create_ers_db.sh'
|
||||
args:
|
||||
chdir: '{{ cgrates_dir }}/data/storage/postgres/'
|
||||
|
||||
- name: post install mongo
|
||||
become: yes
|
||||
command: 'sh {{ cgrates_dir }}/data/storage/mongo/setup_cgr_db.sh'
|
||||
|
||||
@@ -7,9 +7,3 @@ DROP DATABASE IF EXISTS cgrates;
|
||||
CREATE DATABASE cgrates;
|
||||
|
||||
GRANT ALL on cgrates.* TO 'cgrates'@'localhost' IDENTIFIED BY 'CGRateS.org';
|
||||
|
||||
-- extra DB for ees and ers
|
||||
DROP DATABASE IF EXISTS cgrates2;
|
||||
CREATE DATABASE cgrates2;
|
||||
|
||||
GRANT ALL on cgrates2.* TO 'cgrates'@'localhost' IDENTIFIED BY 'CGRateS.org';
|
||||
|
||||
15
data/storage/mysql/create_ers_db.sql
Normal file
15
data/storage/mysql/create_ers_db.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
--
|
||||
-- Sample db and users creation. Replace here with your own details
|
||||
--
|
||||
|
||||
DROP DATABASE IF EXISTS cgrates;
|
||||
CREATE DATABASE cgrates;
|
||||
|
||||
GRANT ALL on cgrates.* TO 'cgrates'@'localhost' IDENTIFIED BY 'CGRateS.org';
|
||||
|
||||
-- extra DB for ees and ers
|
||||
DROP DATABASE IF EXISTS cgrates2;
|
||||
CREATE DATABASE cgrates2;
|
||||
|
||||
GRANT ALL on cgrates2.* TO 'cgrates'@'localhost' IDENTIFIED BY 'CGRateS.org';
|
||||
25
data/storage/mysql/setup_ers_db.sh
Executable file
25
data/storage/mysql/setup_ers_db.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#! /usr/bin/env sh
|
||||
|
||||
if test $# -lt 2; then
|
||||
echo ""
|
||||
echo "setup_cgr_db.sh <db_user> <db_password> [<db_host>]"
|
||||
echo ""
|
||||
exit 0
|
||||
fi
|
||||
|
||||
host=$3
|
||||
if [ -z "$3" ]; then
|
||||
host="localhost"
|
||||
fi
|
||||
|
||||
DIR="$(dirname "$(readlink -f "$0")")"
|
||||
|
||||
mysql -u $1 -p$2 -h $host < "$DIR"/create_ers_db.sql
|
||||
cu=$?
|
||||
|
||||
if [ $cu = 0 ]; then
|
||||
echo "\n\t+++ CGR-DB successfully set-up! +++\n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
@@ -7,7 +7,3 @@ sudo -u postgres dropdb -e cgrates
|
||||
sudo -u postgres dropuser -e cgrates
|
||||
sudo -u postgres psql -c "CREATE USER cgrates password 'CGRateS.org';"
|
||||
sudo -u postgres createdb -e -O cgrates cgrates
|
||||
|
||||
# extra DB for ees and ers
|
||||
sudo -u postgres dropdb -e cgrates2
|
||||
sudo -u postgres createdb -e -O cgrates cgrates2
|
||||
|
||||
4
data/storage/postgres/create_ers_db.sh
Executable file
4
data/storage/postgres/create_ers_db.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
|
||||
# extra DB for ees and ers
|
||||
sudo -u postgres dropdb -e cgrates2
|
||||
sudo -u postgres createdb -e -O cgrates cgrates2
|
||||
Reference in New Issue
Block a user