Skip to content

Instantly share code, notes, and snippets.

@tomconte
Created July 9, 2014 06:50
Show Gist options
  • Select an option

  • Save tomconte/e7032f265b0b3124a7ce to your computer and use it in GitHub Desktop.

Select an option

Save tomconte/e7032f265b0b3124a7ce to your computer and use it in GitHub Desktop.
Vagrant configuration and bootstrap shell script to create a PHP development box on an Azure VM
#!/bin/bash
# Add Node repo
add-apt-repository ppa:chris-lea/node.js
apt-get update
# Puppet
#apt-get -y install puppet-common
# LAMP etc.
# MySQL password
debconf-set-selections <<< 'mysql-server mysql-server/root_password password Pass123!'
debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password Pass123!'
# LAMP
apt-get -q -y install lamp-server^
# Misc PHP stuff
apt-get -q -y install php-apc php5-xdebug php5-intl
# Git
apt-get -q -y install git
# Node
apt-get install -q -y python-software-properties python g++ make nodejs
# Azure CLI
npm install azure-cli -g
# PHP configuration
for f in /etc/php5/cli/php.ini /etc/php5/apache2/php.ini
do
sed -i "s/;date.timezone =/date.timezone = Europe\/Paris/" $f
echo "xdebug.max_nesting_level=250" >> $f
done
Vagrant.configure('2') do |config|
config.vm.box = 'trusty64'
config.vm.provider :azure do |azure, override|
override.vm.box = 'azuredummybox'
override.ssh.username = 'tom' # assigned below
override.ssh.password = 'Pass123!' # assigned below
azure.mgmt_certificate = 'C:\Users\tconte\Dropbox\Dev\management_cert.pfx'
azure.mgmt_endpoint = 'https://management.core.windows.net'
azure.subscription_id = '252281c3-8a06-4af8-8f3f-d6af13e4fde3'
azure.storage_acct_name = 'tcontems' # optional. A new one will be generated if not provided.
# Ubuntu Precise 12.04 LTS
#azure.vm_image = 'b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-12_04_4-LTS-amd64-server-20140428-en-us-30GB'
# Ubuntu Trusty 14.04 LTS
azure.vm_image = 'b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04-LTS-amd64-server-20140416.1-en-us-30GB'
azure.vm_user = 'tom' # defaults to 'vagrant' if not provided
azure.vm_password = 'Pass123!' # min 8 characters. should contain a lower case letter, an uppercase letter, a number and a special character
azure.vm_name = 'tomphpdevbox2' # max 15 characters. contains letters, number and hyphens. can start with letters and can end with letters and numbers
azure.cloud_service_name = 'tomphpdevbox2' # same as vm_name. leave blank to auto-generate
#azure.deployment_name = '' # defaults to cloud_service_name
azure.vm_location = 'West Europe' # e.g., West US
azure.ssh_private_key_file = 'C:\Users\tconte\Dropbox\Dev\ssh\vpcz1\id_rsa'
azure.ssh_certificate_file = 'C:\Users\tconte\Dropbox\Dev\ssh\azure\myCert.pem'
# Provide the following values if creating a *Nix VM
azure.ssh_port = '22'
# Open HTTP port
azure.tcp_endpoints = '80,8000'
end
config.vm.provision :shell, :path => "bootstrap.sh"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment