From 464294337b9004256995fd5996bd1d313a731779 Mon Sep 17 00:00:00 2001 From: Nikolaus Krismer <nikolaus.krismer@uibk.ac.at> Date: Mon, 27 Apr 2015 22:17:17 +0200 Subject: [PATCH] adding synced folders for log files (log files in home and in postgresql-log directory) --- .gitignore | 4 +++- README.md | 9 ++++++++- Vagrantfile | 10 +++++++++- bootstrap.sh | 2 ++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 8f5eee0..15d27fa 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 00005c5..1eada91 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 dd67763..14e93f2 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 dea234b..3aad516 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" -- GitLab