diff --git a/.gitignore b/.gitignore index 1f27757..06b1107 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ pom.xml.asc *.iml .env .cpcache +ubuntu-*console.log diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..6188898 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,14 @@ + +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure(2) do |config| + config.vm.box = 'ubuntu/bionic64' + + config.vm.network 'forwarded_port', guest: 9100, host: 9100 + config.vm.hostname = 'coast' + + config.vm.synced_folder '.', '/coast' + + config.vm.provision 'shell', path: 'provision.sh' +end diff --git a/provision.sh b/provision.sh new file mode 100644 index 0000000..dd36954 --- /dev/null +++ b/provision.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +set -o nounset +set -o errexit + +readonly BasePath="/coast" + +clojure () { + echo "Installing clojure" + + apt-get install -y default-jre + curl -O https://download.clojure.org/install/linux-install-1.10.1.561.sh + chmod +x linux-install-1.10.1.561.sh + sudo ./linux-install-1.10.1.561.sh +} + +main () { + echo "PROVISIONING" + + export DEBIAN_FRONTEND=noninteractive + + # Update apt cache + apt-get update + apt-get autoclean + apt-get autoremove -y + + # Install some base software + apt-get install -y curl vim unzip + + # Create bin dir for user vagrant + mkdir -p /home/vagrant/bin + chown vagrant:vagrant /home/vagrant/bin + + # Navigate to project directory on login + LINE="cd ${BasePath}" + FILE=/home/vagrant/.bashrc + grep -q "$LINE" "$FILE" || echo "$LINE" >> "$FILE" + + # Add greeting + echo "Hello coaster :)" > /etc/motd + + clojure +} +main