If your Rails app requires Java and you’re using Cloud66, you’ll want to setup a script to automatically install it on your web servers during the build process.

You can do this with deployment hooks. These let you specify shell scripts to run during the build process of your servers.

Below I have an example of a shell script for installing Java. I’ve also included an example of what to add to your deploy_hooks.yml.

deploy_hooks.yml

production:
    first_thing:
      - source: /.cloud66/files/java.sh
        destination: ~/java.sh
        target: rails
        sudo: true
        execute: true
        apply_during: build_only
        halt_on_error: true

java.sh

sudo apt-get install -y openjdk-7-jdk