diff --git a/.gitignore b/.gitignore index 8f5eee06db0b8248a170bacbdc780c262734dc64..15d27fa1a6ce6befbf0938ddc7bf07bc827a4ce5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ /.gradle /.project /.settings -/.vagrant \ No newline at end of file +/.vagrant +/home +/log \ No newline at end of file diff --git a/README.md b/README.md index 00005c515388f53dc70bcbe9327be297560c00b5..1eada91522d6eae47af4db6545fbd99ae1da645e 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ dependencies: Vagrant can be installed by downloading the installation package (for your operating system) from http://vagrantup.com. -In addition to the vagrant's core system, two additional vagrant plugins have +In addition to the vagrant's core system, three additional vagrant plugins have to be installed on the system. Although this is not a dependency of the isochrone-vm system itself, it is a mandatory step. This has been implemented since it solves some of the most common problems that occurred with the vagrant @@ -38,6 +38,13 @@ use the user which will start the isochrone-vm afterwards). vagrant plugin install vagrant-vbguest ``` +The third (and last) vagrant plugin needed by isochrone-vm is **vagrant-triggers**. +This plugin will delete temporary folder when destroying the virtual machine, so +that no temporary files remain on the host system: +```shell +vagrant plugin install vagrant-triggers +``` + ### Installing virtualbox Virtualbox can be downloaded from the oracle homepage using the URL http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html diff --git a/Vagrantfile b/Vagrantfile index dd67763805dece12b65500e889ef604c1b67fc42..14e93f2149fb818c75ae573316959e27f356d938 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,7 +1,7 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -REQUIRED_PLUGINS = %w(vagrant-cachier vagrant-vbguest) +REQUIRED_PLUGINS = %w(vagrant-cachier vagrant-vbguest vagrant-triggers) exit unless REQUIRED_PLUGINS.all? do |plugin| Vagrant.has_plugin?(plugin) || ( puts "The #{plugin} plugin is required. Please install it with:" @@ -42,6 +42,12 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| v.customize ["modifyvm", :id, "--ostype", "RedHat_64"] end + config.trigger.after :destroy do + info "Deleting temporary synced folders" + run "rm -Rf home" + run "rm -Rf log" + end + # Enable vagrant-cachier plugin config.cache.enable :yum @@ -50,7 +56,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Setup of shared folders config.vm.synced_folder "conf", "/setup/conf" + config.vm.synced_folder "home", "/home/vagrant", create: true config.vm.synced_folder "img", "/setup/img" + config.vm.synced_folder "log", "/var/log/postgresql", create: true, owner: 26, group: 26 # Setup environment on startup (done using a shell script) config.vm.provision "shell", path: "bootstrap.sh", args: ["niko", "secretPhdPassword#2014!", (isLocalMode ? "true" : "false")] diff --git a/bootstrap.sh b/bootstrap.sh index dea234b8470c9b81a73674ddbfaffe9ba70a6d80..3aad5163b0fd6f807bf1da89f2985ad330b026d6 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -574,6 +574,8 @@ fi if $INSTALL_POSTGRES; then echo "Installing $POSTGRESQL_SERVICE_NAME" + groupadd -g 26 postgres + useradd -u 26 -g 26 -c "PostgreSQL Server" postgres yum -y install $POSTGRESQL_PKG_NAME $POSTGRESQL_PKG_NAME-contrib $POSTGRESQL_PKG_NAME-server >> install_postgresql.log 2>&1 echo " - exporting postgresql options"