├── project └── .gitignore ├── .gitignore ├── .gitmodules ├── LICENSE ├── Vagrantfile ├── puppet └── manifests │ └── base.pp └── README.md /project/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_STORE 2 | *.box 3 | .vagrant 4 | .bashrc 5 | 6 | *.gz 7 | 8 | puppet/modules/maven/files/ -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "puppet/modules/java"] 2 | path = puppet/modules/java 3 | url = git@github.com:puppetlabs/puppetlabs-java.git 4 | [submodule "puppet/modules/apt"] 5 | path = puppet/modules/apt 6 | url = git@github.com:puppetlabs/puppetlabs-apt.git 7 | [submodule "puppet/modules/stdlib"] 8 | path = puppet/modules/stdlib 9 | url = git@github.com:puppetlabs/puppetlabs-stdlib.git 10 | [submodule "puppet/modules/postgresql"] 11 | path = puppet/modules/postgresql 12 | url = git@github.com:puppetlabs/puppet-postgresql.git 13 | [submodule "puppet/modules/firewall"] 14 | path = puppet/modules/firewall 15 | url = git://github.com/puppetlabs/puppetlabs-firewall.git 16 | [submodule "puppet/modules/concat"] 17 | path = puppet/modules/concat 18 | url = git://github.com/ripienaar/puppet-concat.git 19 | [submodule "puppet/modules/maven"] 20 | path = puppet/modules/maven 21 | url = https://github.com/7terminals/puppet-maven 22 | [submodule "puppet/modules/wget"] 23 | path = puppet/modules/wget 24 | url = https://github.com/maestrodev/puppet-wget.git 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Robert Murray 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # 5 | # Vagrant configuration for vagrant-jdev-box 6 | # https://github.com/rob-murray/vagrant-javadev-box 7 | # 8 | Vagrant.configure("2") do |config| 9 | # All Vagrant configuration is done here. The most common configuration 10 | # options are documented and commented below. For a complete reference, 11 | # please see the online documentation at vagrantup.com. 12 | 13 | config.vm.box = "precise64" 14 | 15 | # Grab this via `vagrant box add precise64 http://files.vagrantup.com/precise64.box` 16 | config.vm.box_url = "http://files.vagrantup.com/precise64.box" 17 | 18 | # Forward ports 19 | config.vm.network :forwarded_port, guest: 8080, host: 8080 # Java app server; jetty 20 | config.vm.network :forwarded_port, guest: 5432, host: 5432 # Postgres DB 21 | 22 | # Share the working dir - host, guest 23 | config.vm.synced_folder "project", "/vagrant" 24 | config.vm.synced_folder "puppet/modules", "/puppet" 25 | 26 | config.vm.provision "shell", inline: "apt-get update --fix-missing" 27 | 28 | config.vm.provision :puppet do |puppet| 29 | puppet.manifests_path = "puppet/manifests" 30 | puppet.manifest_file = "base.pp" 31 | puppet.module_path = "puppet/modules" 32 | puppet.options = "--verbose" 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /puppet/manifests/base.pp: -------------------------------------------------------------------------------- 1 | # 2 | # base.pp 3 | # Build Vagrant box configuration from modules 4 | # 5 | # vagrant-javadev-box 6 | # https://github.com/rob-murray/vagrant-javadev-box 7 | # 8 | include wget 9 | include maven 10 | 11 | # Install latest jdk 12 | class { "java": 13 | distribution => "jdk", 14 | version => "latest", 15 | } 16 | 17 | # Postgresql general config 18 | class { "postgresql": 19 | version => "9.3", 20 | manage_package_repo => true, 21 | charset => "UTF8", 22 | locale => "en_US.UTF-8" 23 | } 24 | 25 | # Postgresql server config 26 | class { "postgresql::server": 27 | config_hash => { 28 | "ip_mask_deny_postgres_user" => "0.0.0.0/32", 29 | "ip_mask_allow_all_users" => "0.0.0.0/0", 30 | "listen_addresses" => "*", 31 | "manage_redhat_firewall" => true, 32 | "postgres_password" => "change_me", 33 | } 34 | } 35 | 36 | # Postgresql database config 37 | # If necessary, config here to build application specific database 38 | 39 | # Install Maven to the vagrant users home dir and shell 40 | file { [ "/puppet/maven/files" ]: 41 | ensure => "directory", 42 | } 43 | 44 | wget::fetch { "download-maven-bin": 45 | source => "http://mirrors.ukfast.co.uk/sites/ftp.apache.org/maven/maven-3/3.2.5/binaries/apache-maven-3.2.5-bin.tar.gz", 46 | destination => "/puppet/maven/files/apache-maven-3.2.5-bin.tar.gz", 47 | verbose => true, 48 | require => File[ "/puppet/maven/files" ] 49 | } 50 | 51 | maven::setup { "maven": 52 | ensure => "present", 53 | source => "apache-maven-3.2.5-bin.tar.gz", 54 | deploymentdir => "/home/vagrant/apache-maven", 55 | user => "vagrant", 56 | pathfile => "/home/vagrant/.bashrc", 57 | require => Wget::Fetch[ "download-maven-bin" ] 58 | } 59 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | vagrant-javadev-box 2 | ================ 3 | 4 | Build a basic Vagrant box set for Java development with Jdk, Postgres and Maven installed via puppet. 5 | 6 | This is intended as a base off which to add specific customisation; fork and adapt or use as is. 7 | 8 | ## Installed modules 9 | 10 | All as git submodules unless otherwise stated. Also not listing dependancies, only major modules. 11 | 12 | * [Java: latest jdk](https://github.com/puppetlabs/puppetlabs-java) 13 | * [Postgresql: 9.3](https://github.com/puppetlabs/puppet-postgresql) 14 | * [Maven: 3.2.5](https://github.com/7terminals/puppet-maven) 15 | 16 | 17 | ## Installation 18 | 19 | * If you haven't already, go over to [http://www.vagrantup.com/](http://www.vagrantup.com/) and follow the installation instructions 20 | * Add the box `precise64` via `vagrant box add precise64 http://files.vagrantup.com/precise64.box` 21 | * Clone this repo `git clone https://github.com/rob-murray/vagrant-javadev-box.git` 22 | * Init the submodules `git submodule update --init` 23 | * All done; `vagrant up` and box will be provisioned 24 | 25 | 26 | ## Usage 27 | 28 | Feel free to fork and customise further or use as is. 29 | 30 | The directory `project` is sync'd to `/vagrant` so place your code in there and hack away. 31 | 32 | Ports 8080 and 5432 are mapped to their respective ports on the VM. 33 | 34 | Jump onto the VM by `vagrant ssh`. 35 | 36 | Test it out with `java -version`, `mvn -v` or `psql -h localhost -U postgres`. 37 | 38 | You may want to edit Postgres config in the `puppet/manifests/base.pp` file. 39 | 40 | 41 | ## Changelog 42 | 43 | #### 10-04-2014 44 | 45 | * Update Maven to 3.2.5 46 | * Automatically download the Maven binary 47 | 48 | #### 15-11-2014 49 | 50 | * Update Postgres to 9.3 51 | * Update Maven to 3.2.3 52 | * Rename host project directory to `project` 53 | 54 | #### 21-02-2014 55 | 56 | * Update Postgres to 9.2 57 | * Update Maven to 3.1.1 58 | * Update Vagrant version 2 config. 59 | 60 | #### 14-06-2013 61 | 62 | * Add Postgres, Jdk and Maven. 63 | * Initial commit with Vagrant version 1 config. 64 | 65 | 66 | ## Contributions 67 | 68 | Please use the GitHub pull-request mechanism to submit contributions. 69 | 70 | ### License 71 | 72 | This project is available for use under the MIT software license. 73 | See LICENSE 74 | 75 | --------------------------------------------------------------------------------