Skip to content

Commit

Permalink
Add vagrantfile
Browse files Browse the repository at this point in the history
  • Loading branch information
swlkr committed Jul 31, 2020
1 parent 0ceb9d7 commit ce3218f
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ pom.xml.asc
*.iml
.env
.cpcache
ubuntu-*console.log
14 changes: 14 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -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
44 changes: 44 additions & 0 deletions provision.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ce3218f

Please sign in to comment.