diff --git a/Vagrantfile b/Vagrantfile index a106d997f..652807ce7 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -75,6 +75,7 @@ Vagrant.configure('2') do |config| set -e cd /vagrant + LIBRETIME_POSTGRESQL_PASSWORD=libretime \ bash install \ --listen-port 8080 \ --allow-restart \ @@ -88,6 +89,10 @@ Vagrant.configure('2') do |config| SCRIPT config.vm.provision 'install', type: 'shell', inline: $script + + config.vm.provision 'post-install', + type: 'shell', + path: 'installer/vagrant/post-install.sh' end # Define all the OS boxes we support diff --git a/installer/vagrant/post-install.sh b/installer/vagrant/post-install.sh new file mode 100755 index 000000000..bc0c9bd10 --- /dev/null +++ b/installer/vagrant/post-install.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +# append_if_missing +append_if_missing() { + grep -xqF "$1" "$2" || echo "$1" >> "$2" +} + +# Setup postgresql remote access +append_if_missing "listen_addresses = '*'" /etc/postgresql/*/main/postgresql.conf +append_if_missing "host all all 0.0.0.0/0 md5" /etc/postgresql/*/main/pg_hba.conf +append_if_missing "host all all ::/0 md5" /etc/postgresql/*/main/pg_hba.conf + +systemctl restart postgresql.service