mirror of
https://github.com/jambonz/jambonz-infrastructure.git
synced 2025-12-19 08:47:43 +00:00
* initial changes for proxmox support * proxmox packer updates * terraform template for Proxmox jambonz-mini * update jambonz-mini to 0.8.3-3
22 lines
820 B
Bash
22 lines
820 B
Bash
#!/bin/bash
|
|
|
|
if [ "$1" == "yes" ]; then
|
|
|
|
DB_USER=$2
|
|
DB_PASS=$3
|
|
|
|
wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O- | sudo apt-key add -
|
|
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/postgresql.list'
|
|
sudo apt-get update
|
|
sudo apt-get install -y postgresql-12
|
|
sudo systemctl daemon-reload
|
|
sudo systemctl enable postgresql
|
|
sudo systemctl restart postgresql
|
|
|
|
sudo -u postgres psql -c "CREATE DATABASE homer_config;"
|
|
sudo -u postgres psql -c "CREATE DATABASE homer_data;"
|
|
sudo -u postgres psql -c "CREATE ROLE ${DB_USER} WITH SUPERUSER LOGIN PASSWORD '$DB_PASS';"
|
|
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE homer_config to ${DB_USER};"
|
|
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE homer_data to ${DB_USER};"
|
|
|
|
fi |