Files
jambonz-infrastructure/packer/jambonz-mini/aws/scripts/install_postgresql.sh
Dave Horton 80ec4a45da Feature/proxmox (#50)
* initial changes for proxmox support

* proxmox packer updates

* terraform template for Proxmox jambonz-mini

* update jambonz-mini to 0.8.3-3
2023-05-31 10:05:42 -04:00

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