Last active
December 21, 2015 14:10
-
-
Save ciscoheat/2487a2de5bf236103098 to your computer and use it in GitHub Desktop.
Vagrant setup for Haxe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Use a Vagrantfile based on hashicorp/precise64 | |
apt-get update >/dev/null 2>&1 | |
cd /vagrant | |
mkdir www | |
chown vagrant:vagrant www | |
echo "=== Installing Apache..." | |
apt-get install -y apache2 | |
# Enable mod_rewrite, allow .htaccess and fix a virtualbox bug according to | |
# https://github.com/mitchellh/vagrant/issues/351#issuecomment-1339640 | |
a2enmod rewrite | |
sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/sites-enabled/000-default | |
echo EnableSendFile Off > /etc/apache2/conf.d/virtualbox-bugfix | |
# Link to www dir | |
rm -rf /var/www | |
ln -fs /vagrant/www /var/www | |
echo "=== Installing curl..." | |
apt-get install -y curl | |
echo "=== Installing PHP..." | |
apt-get install -y php5 php5-gd php5-mysql php5-curl php5-cli php5-sqlite | |
echo "=== Installing PHP utilities (Composer)..." | |
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin | |
echo "=== Installing PHP utilities (phing)..." | |
wget -q -O /usr/local/bin/phing.phar http://www.phing.info/get/phing-latest.phar && chmod 755 /usr/local/bin/phing.phar | |
echo "=== Installing Mysql..." | |
export DEBIAN_FRONTEND=noninteractive | |
apt-get -q -y install mysql-server mysql-client | |
echo "=== Creating Mysql DB (named haxe)..." | |
mysql -u root -e "create database haxe" | |
echo "=== Restarting Apache..." | |
service apache2 restart | |
# ----- Services installed, time for Haxe and all its targets ----- | |
echo "=== Installing Haxe..." | |
wget -q http://www.openfl.org/builds/haxe/haxe-3.1.3-linux-installer.tar.gz -O - | tar -xz | |
sh install-haxe.sh -y >/dev/null 2>&1 | |
rm -f install-haxe.sh | |
echo "=== Installing C++..." | |
apt-get install -y gcc-multilib g++-multilib | |
haxelib install hxcpp >/dev/null 2>&1 | |
echo "=== Installing C#..." | |
apt-get install -y mono-devel | |
haxelib install hxcs >/dev/null 2>&1 | |
echo "=== Installing Java..." | |
apt-get install -y default-jdk | |
haxelib install hxjava >/dev/null 2>&1 | |
echo "=== Installing Node.js..." | |
apt-get install -y nodejs | |
echo "=== Installing Phantomjs..." | |
apt-get install -y phantomjs | |
echo "=== Installing mod_neko for Apache..." | |
cat > /etc/apache2/conf.d/neko <<EOL | |
LoadModule neko_module /usr/lib/neko/mod_neko2.ndll | |
AddHandler neko-handler .n | |
DirectoryIndex index.n | |
EOL | |
mkdir /vagrant/src | |
cat > /vagrant/src/Index.hx <<EOL | |
class Index { | |
static function main() { | |
trace("Hello World !"); | |
} | |
} | |
EOL | |
cat > /vagrant/src/build.hxml <<EOL | |
-neko ../www/index.n | |
-main Index | |
EOL | |
chown -R vagrant:vagrant src | |
su vagrant -c 'cd /vagrant/src && haxe build.hxml' | |
service apache2 restart | |
cd /vagrant | |
echo "=== Done!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
# All Vagrant configuration is done here. The most common configuration | |
# options are documented and commented below. For a complete reference, | |
# please see the online documentation at vagrantup.com. | |
# Every Vagrant virtual environment requires a box to build off of. | |
config.vm.box = "hashicorp/precise64" | |
# Disable automatic box update checking. If you disable this, then | |
# boxes will only be checked for updates when the user runs | |
# `vagrant box outdated`. This is not recommended. | |
# config.vm.box_check_update = false | |
# Create a forwarded port mapping which allows access to a specific port | |
# within the machine from a port on the host machine. In the example below, | |
# accessing "localhost:8080" will access port 80 on the guest machine. | |
config.vm.network "forwarded_port", guest: 80, host: 4568 | |
# Create a private network, which allows host-only access to the machine | |
# using a specific IP. | |
# config.vm.network "private_network", ip: "192.168.33.10" | |
# Create a public network, which generally matched to bridged network. | |
# Bridged networks make the machine appear as another physical device on | |
# your network. | |
# config.vm.network "public_network" | |
# If true, then any SSH connections made will enable agent forwarding. | |
# Default value: false | |
# config.ssh.forward_agent = true | |
# Share an additional folder to the guest VM. The first argument is | |
# the path on the host to the actual folder. The second argument is | |
# the path on the guest to mount the folder. And the optional third | |
# argument is a set of non-required options. | |
# config.vm.synced_folder "./www", "/var/www" | |
config.vm.provider :virtualbox do |v| | |
v.customize ["modifyvm", :id, "--memory", 512] | |
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] # Use NAT DNS host resolver | |
end | |
# Provider-specific configuration so you can fine-tune various | |
# backing providers for Vagrant. These expose provider-specific options. | |
# Example for VirtualBox: | |
# | |
# config.vm.provider "virtualbox" do |vb| | |
# # Don't boot with headless mode | |
# vb.gui = true | |
# | |
# # Use VBoxManage to customize the VM. For example to change memory: | |
# vb.customize ["modifyvm", :id, "--memory", "1024"] | |
# end | |
# | |
# View the documentation for the provider you're using for more | |
# information on available options. | |
config.vm.provision :shell, path: "provision.sh" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment