├── .gitignore ├── .travis.yml ├── Vagrantfile ├── contributing.md ├── helpers ├── ngxcb.sh ├── ngxdis.sh ├── ngxen.sh ├── nvm_install.sh ├── vhost.sh └── vimrc ├── readme.md ├── scripts ├── android.sh ├── ansible.sh ├── apache.sh ├── base.sh ├── base_box_optimizations.sh ├── beanstalkd.sh ├── composer.sh ├── couchbase.sh ├── couchdb.sh ├── docker.sh ├── elastichq.sh ├── elasticsearch.sh ├── git-ftp.sh ├── go.sh ├── kibana.sh ├── laravel.sh ├── mailcatcher.sh ├── mariadb.sh ├── memcached.sh ├── mongodb.sh ├── mssql.sh ├── mysql.sh ├── neo4j.sh ├── nginx.sh ├── nodejs.sh ├── pgsql.sh ├── php.sh ├── rabbitmq.sh ├── redis.sh ├── rethinkdb.sh ├── rvm.sh ├── screen.sh ├── sphinxsearch.sh ├── sqlite.sh ├── supervisord.sh ├── symfony.sh ├── vim.sh └── zeromq.sh └── test.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | notes.md 3 | .vagrant 4 | play 5 | 6 | # editor backup files 7 | *~ 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: bash 2 | 3 | script: 4 | - bash test.sh 5 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # Config Github Settings 5 | github_username = "fideloper" 6 | github_repo = "Vaprobash" 7 | github_branch = "1.4.2" 8 | github_url = "https://raw.githubusercontent.com/#{github_username}/#{github_repo}/#{github_branch}" 9 | 10 | # Because this:https://developer.github.com/changes/2014-12-08-removing-authorizations-token/ 11 | # https://github.com/settings/tokens 12 | github_pat = "" 13 | 14 | # Server Configuration 15 | 16 | hostname = "vaprobash.dev" 17 | 18 | # Set a local private network IP address. 19 | # See http://en.wikipedia.org/wiki/Private_network for explanation 20 | # You can use the following IP ranges: 21 | # 10.0.0.1 - 10.255.255.254 22 | # 172.16.0.1 - 172.31.255.254 23 | # 192.168.0.1 - 192.168.255.254 24 | server_ip = "192.168.22.10" 25 | server_cpus = "1" # Cores 26 | server_memory = "384" # MB 27 | server_swap = "768" # Options: false | int (MB) - Guideline: Between one or two times the server_memory 28 | 29 | # UTC for Universal Coordinated Time 30 | # EST for Eastern Standard Time 31 | # CET for Central European Time 32 | # US/Central for American Central 33 | # US/Eastern for American Eastern 34 | server_timezone = "UTC" 35 | 36 | # Database Configuration 37 | mysql_root_password = "root" # We'll assume user "root" 38 | mysql_version = "5.5" # Options: 5.5 | 5.6 39 | mysql_enable_remote = "false" # remote access enabled when true 40 | pgsql_root_password = "root" # We'll assume user "root" 41 | mongo_version = "2.6" # Options: 2.6 | 3.0 42 | mongo_enable_remote = "false" # remote access enabled when true 43 | 44 | # Languages and Packages 45 | php_timezone = "UTC" # http://php.net/manual/en/timezones.php 46 | php_version = "5.6" # Options: 5.5 | 5.6 | 7.0 | 7.1 47 | ruby_version = "latest" # Choose what ruby version should be installed (will also be the default version) 48 | ruby_gems = [ # List any Ruby Gems that you want to install 49 | #"jekyll", 50 | #"sass", 51 | #"compass", 52 | ] 53 | 54 | go_version = "latest" # Example: go1.4 (latest equals the latest stable version) 55 | 56 | # To install HHVM instead of PHP, set this to "true" 57 | hhvm = "false" 58 | 59 | # PHP Options 60 | composer_packages = [ # List any global Composer packages that you want to install 61 | #"phpunit/phpunit:4.0.*", 62 | #"codeception/codeception=*", 63 | #"phpspec/phpspec:2.0.*@dev", 64 | #"squizlabs/php_codesniffer:1.5.*", 65 | ] 66 | 67 | # Default web server document root 68 | # Symfony's public directory is assumed "web" 69 | # Laravel's public directory is assumed "public" 70 | public_folder = "/vagrant" 71 | 72 | laravel_root_folder = "/vagrant/laravel" # Where to install Laravel. Will `composer install` if a composer.json file exists 73 | laravel_version = "latest-stable" # If you need a specific version of Laravel, set it here 74 | symfony_root_folder = "/vagrant/symfony" # Where to install Symfony. 75 | 76 | nodejs_version = "latest" # By default "latest" will equal the latest stable version 77 | nodejs_packages = [ # List any global NodeJS packages that you want to install 78 | #"grunt-cli", 79 | #"gulp", 80 | #"bower", 81 | #"yo", 82 | ] 83 | 84 | # RabbitMQ settings 85 | rabbitmq_user = "user" 86 | rabbitmq_password = "password" 87 | 88 | sphinxsearch_version = "rel22" # rel20, rel21, rel22, beta, daily, stable 89 | 90 | elasticsearch_version = "2.3.1" # 5.0.0-alpha1, 2.3.1, 2.2.2, 2.1.2, 1.7.5 91 | 92 | Vagrant.configure("2") do |config| 93 | 94 | # Set server to Ubuntu 14.04 95 | config.vm.box = "ubuntu/trusty64" 96 | 97 | config.vm.define "Vaprobash" do |vapro| 98 | end 99 | 100 | if Vagrant.has_plugin?("vagrant-hostmanager") 101 | config.hostmanager.enabled = true 102 | config.hostmanager.manage_host = true 103 | config.hostmanager.ignore_private_ip = false 104 | config.hostmanager.include_offline = false 105 | end 106 | 107 | # Create a hostname, don't forget to put it to the `hosts` file 108 | # This will point to the server's default virtual host 109 | # TO DO: Make this work with virtualhost along-side xip.io URL 110 | config.vm.hostname = hostname 111 | 112 | # Create a static IP 113 | if Vagrant.has_plugin?("vagrant-auto_network") 114 | config.vm.network :private_network, :ip => "0.0.0.0", :auto_network => true 115 | else 116 | config.vm.network :private_network, ip: server_ip 117 | config.vm.network :forwarded_port, guest: 80, host: 8000 118 | end 119 | 120 | # Enable agent forwarding over SSH connections 121 | config.ssh.forward_agent = true 122 | 123 | # Use NFS for the shared folder 124 | config.vm.synced_folder ".", "/vagrant", 125 | id: "core", 126 | :nfs => true, 127 | :mount_options => ['nolock,vers=3,udp,noatime,actimeo=2,fsc'] 128 | 129 | # Replicate local .gitconfig file if it exists 130 | if File.file?(File.expand_path("~/.gitconfig")) 131 | config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig" 132 | end 133 | 134 | # If using VirtualBox 135 | config.vm.provider :virtualbox do |vb| 136 | 137 | vb.name = hostname 138 | 139 | # Set server cpus 140 | vb.customize ["modifyvm", :id, "--cpus", server_cpus] 141 | 142 | # Set server memory 143 | vb.customize ["modifyvm", :id, "--memory", server_memory] 144 | 145 | # Set the timesync threshold to 10 seconds, instead of the default 20 minutes. 146 | # If the clock gets more than 15 minutes out of sync (due to your laptop going 147 | # to sleep for instance, then some 3rd party services will reject requests. 148 | vb.customize ["guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000] 149 | 150 | # Prevent VMs running on Ubuntu to lose internet connection 151 | # vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] 152 | # vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"] 153 | 154 | end 155 | 156 | # If using VMWare Fusion 157 | config.vm.provider "vmware_fusion" do |vb, override| 158 | override.vm.box_url = "http://files.vagrantup.com/precise64_vmware.box" 159 | 160 | # Set server memory 161 | vb.vmx["memsize"] = server_memory 162 | 163 | end 164 | 165 | # If using Vagrant-Cachier 166 | # http://fgrehm.viewdocs.io/vagrant-cachier 167 | if Vagrant.has_plugin?("vagrant-cachier") 168 | # Configure cached packages to be shared between instances of the same base box. 169 | # Usage docs: http://fgrehm.viewdocs.io/vagrant-cachier/usage 170 | config.cache.scope = :box 171 | 172 | config.cache.synced_folder_opts = { 173 | type: :nfs, 174 | mount_options: ['rw', 'vers=3', 'tcp', 'nolock'] 175 | } 176 | end 177 | 178 | # Adding vagrant-digitalocean provider - https://github.com/smdahlen/vagrant-digitalocean 179 | # Needs to ensure that the vagrant plugin is installed 180 | config.vm.provider :digital_ocean do |provider, override| 181 | override.ssh.private_key_path = '~/.ssh/id_rsa' 182 | override.ssh.username = 'vagrant' 183 | override.vm.box = 'digital_ocean' 184 | override.vm.box_url = "https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box" 185 | 186 | provider.token = 'YOUR TOKEN' 187 | provider.image = 'ubuntu-14-04-x64' 188 | provider.region = 'nyc2' 189 | provider.size = '512mb' 190 | end 191 | 192 | #### 193 | # Base Items 194 | ########## 195 | 196 | # Provision Base Packages 197 | config.vm.provision "shell", path: "#{github_url}/scripts/base.sh", args: [github_url, server_swap, server_timezone] 198 | 199 | # optimize base box 200 | config.vm.provision "shell", path: "#{github_url}/scripts/base_box_optimizations.sh", privileged: true 201 | 202 | # Provision PHP 203 | config.vm.provision "shell", path: "#{github_url}/scripts/php.sh", args: [php_timezone, hhvm, php_version] 204 | 205 | # Enable MSSQL for PHP 206 | # config.vm.provision "shell", path: "#{github_url}/scripts/mssql.sh" 207 | 208 | # Provision Vim 209 | # config.vm.provision "shell", path: "#{github_url}/scripts/vim.sh", args: github_url 210 | 211 | # Provision Docker 212 | # config.vm.provision "shell", path: "#{github_url}/scripts/docker.sh", args: "permissions" 213 | 214 | #### 215 | # Web Servers 216 | ########## 217 | 218 | # Provision Apache Base 219 | # config.vm.provision "shell", path: "#{github_url}/scripts/apache.sh", args: [server_ip, public_folder, hostname, github_url] 220 | 221 | # Provision Nginx Base 222 | # config.vm.provision "shell", path: "#{github_url}/scripts/nginx.sh", args: [server_ip, public_folder, hostname, github_url, php_version] 223 | 224 | 225 | #### 226 | # Databases 227 | ########## 228 | 229 | # Provision MySQL 230 | # config.vm.provision "shell", path: "#{github_url}/scripts/mysql.sh", args: [mysql_root_password, mysql_version, mysql_enable_remote] 231 | 232 | # Provision PostgreSQL 233 | # config.vm.provision "shell", path: "#{github_url}/scripts/pgsql.sh", args: pgsql_root_password 234 | 235 | # Provision SQLite 236 | # config.vm.provision "shell", path: "#{github_url}/scripts/sqlite.sh" 237 | 238 | # Provision RethinkDB 239 | # config.vm.provision "shell", path: "#{github_url}/scripts/rethinkdb.sh", args: pgsql_root_password 240 | 241 | # Provision Couchbase 242 | # config.vm.provision "shell", path: "#{github_url}/scripts/couchbase.sh", args: [php_version] 243 | 244 | # Provision CouchDB 245 | # config.vm.provision "shell", path: "#{github_url}/scripts/couchdb.sh" 246 | 247 | # Provision MongoDB 248 | # config.vm.provision "shell", path: "#{github_url}/scripts/mongodb.sh", args: [mongo_enable_remote, mongo_version] 249 | 250 | # Provision MariaDB 251 | # config.vm.provision "shell", path: "#{github_url}/scripts/mariadb.sh", args: [mysql_root_password, mysql_enable_remote] 252 | 253 | # Provision Neo4J 254 | # config.vm.provision "shell", path: "#{github_url}/scripts/neo4j.sh" 255 | 256 | #### 257 | # Search Servers 258 | ########## 259 | 260 | # Install Elasticsearch 261 | # config.vm.provision "shell", path: "#{github_url}/scripts/elasticsearch.sh", args: [elasticsearch_version] 262 | 263 | # Install SphinxSearch 264 | # config.vm.provision "shell", path: "#{github_url}/scripts/sphinxsearch.sh", args: [sphinxsearch_version] 265 | 266 | #### 267 | # Search Server Administration (web-based) 268 | ########## 269 | 270 | # Install ElasticHQ 271 | # Admin for: Elasticsearch 272 | # Works on: Apache2, Nginx 273 | # config.vm.provision "shell", path: "#{github_url}/scripts/elastichq.sh" 274 | 275 | 276 | #### 277 | # In-Memory Stores 278 | ########## 279 | 280 | # Install Memcached 281 | # config.vm.provision "shell", path: "#{github_url}/scripts/memcached.sh" 282 | 283 | # Provision Redis (without journaling and persistence) 284 | # config.vm.provision "shell", path: "#{github_url}/scripts/redis.sh" 285 | 286 | # Provision Redis (with journaling and persistence) 287 | # config.vm.provision "shell", path: "#{github_url}/scripts/redis.sh", args: "persistent" 288 | # NOTE: It is safe to run this to add persistence even if originally provisioned without persistence 289 | 290 | 291 | #### 292 | # Utility (queue) 293 | ########## 294 | 295 | # Install Beanstalkd 296 | # config.vm.provision "shell", path: "#{github_url}/scripts/beanstalkd.sh" 297 | 298 | # Install Heroku Toolbelt 299 | # config.vm.provision "shell", path: "https://toolbelt.heroku.com/install-ubuntu.sh" 300 | 301 | # Install Supervisord 302 | # config.vm.provision "shell", path: "#{github_url}/scripts/supervisord.sh" 303 | 304 | # Install Kibana 305 | # config.vm.provision "shell", path: "#{github_url}/scripts/kibana.sh" 306 | 307 | # Install ØMQ 308 | # config.vm.provision "shell", path: "#{github_url}/scripts/zeromq.sh", args: [php_version] 309 | 310 | # Install RabbitMQ 311 | # config.vm.provision "shell", path: "#{github_url}/scripts/rabbitmq.sh", args: [rabbitmq_user, rabbitmq_password] 312 | 313 | #### 314 | # Additional Languages 315 | ########## 316 | 317 | # Install Nodejs 318 | # config.vm.provision "shell", path: "#{github_url}/scripts/nodejs.sh", privileged: false, args: nodejs_packages.unshift(nodejs_version, github_url) 319 | 320 | # Install Ruby Version Manager (RVM) 321 | # config.vm.provision "shell", path: "#{github_url}/scripts/rvm.sh", privileged: false, args: ruby_gems.unshift(ruby_version) 322 | 323 | # Install Go Version Manager (GVM) 324 | # config.vm.provision "shell", path: "#{github_url}/scripts/go.sh", privileged: false, args: [go_version] 325 | 326 | #### 327 | # Frameworks and Tooling 328 | ########## 329 | 330 | # Provision Composer 331 | # You may pass a github auth token as the first argument 332 | # config.vm.provision "shell", path: "#{github_url}/scripts/composer.sh", privileged: false, args: [github_pat, composer_packages.join(" ")] 333 | 334 | # Provision Laravel 335 | # config.vm.provision "shell", path: "#{github_url}/scripts/laravel.sh", privileged: false, args: [server_ip, laravel_root_folder, public_folder, laravel_version] 336 | 337 | # Provision Symfony 338 | # config.vm.provision "shell", path: "#{github_url}/scripts/symfony.sh", privileged: false, args: [server_ip, symfony_root_folder, public_folder] 339 | 340 | # Install Screen 341 | # config.vm.provision "shell", path: "#{github_url}/scripts/screen.sh" 342 | 343 | # Install Mailcatcher 344 | # config.vm.provision "shell", path: "#{github_url}/scripts/mailcatcher.sh", args: [php_version] 345 | 346 | # Install git-ftp 347 | # config.vm.provision "shell", path: "#{github_url}/scripts/git-ftp.sh", privileged: false 348 | 349 | # Install Ansible 350 | # config.vm.provision "shell", path: "#{github_url}/scripts/ansible.sh" 351 | 352 | # Install Android 353 | # config.vm.provision "shell", path: "#{github_url}/scripts/android.sh" 354 | 355 | #### 356 | # Local Scripts 357 | # Any local scripts you may want to run post-provisioning. 358 | # Add these to the same directory as the Vagrantfile. 359 | ########## 360 | # config.vm.provision "shell", path: "./local-script.sh" 361 | 362 | end 363 | -------------------------------------------------------------------------------- /contributing.md: -------------------------------------------------------------------------------- 1 | # Contributing to Vaprobash 2 | 3 | Please make pull requests to the **Master** branch. 4 | 5 | Vaprobash now uses SemVer, so bug fixes/tweaks will create patch releases and new features will create minor releases. 6 | 7 | Note that this means that bug fixes and minor tweaks will likely get accepted before feature additions, however all PR's will be reviewed! 8 | -------------------------------------------------------------------------------- /helpers/ngxcb.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Show the usage for NGXCB 4 | function show_usage { 5 | cat < /dev/null 2>&1 32 | PHP_IS_INSTALLED=$? 33 | 34 | # Test if HHVM is installed 35 | hhvm --version > /dev/null 2>&1 36 | HHVM_IS_INSTALLED=$? 37 | [[ $HHVM_IS_INSTALLED -eq 0 ]] && { PHP_IS_INSTALLED=-1; } 38 | 39 | # Default empty PHP Config 40 | PHP_NO_SSL="" 41 | PHP_WITH_SSL="" 42 | 43 | if [[ $PHP_IS_INSTALLED -eq 0 ]]; then 44 | 45 | # Nginx Server Block config for PHP (without using SSL) 46 | read -d '' PHP_NO_SSL </dev/null 238 | if [[ $? -eq 0 ]]; then 239 | # if file has been removed, provide user with information that existing server 240 | # block is being overwritten 241 | echo ">>> ${ServerBlockName} is enabled and will be overwritten" 242 | echo ">>> to enable this server block execute 'ngxen ${ServerBlockName}' or use the -e flag" 243 | NeedsReload=1 244 | fi 245 | elif [[ -f "/etc/nginx/sites-available/${ServerBlockName}" ]]; then 246 | echo "!!! Nginx Server Block already exists. Aborting!" 247 | show_usage 248 | fi 249 | 250 | # Create the Server Block config 251 | create_server_block > /etc/nginx/sites-available/${ServerBlockName} 252 | 253 | # Enable the Server Block and reload Nginx 254 | if [[ $EnableServerBlock -eq 1 ]]; then 255 | # Enable Server Block 256 | ngxen -q ${ServerBlockName} 257 | 258 | # Reload Nginx 259 | NeedsReload=1 260 | fi 261 | 262 | [[ $NeedsReload -eq 1 ]] && service nginx reload 263 | -------------------------------------------------------------------------------- /helpers/ngxdis.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ## Show the usage for NGXDIS 4 | function show_usage { 5 | cat <>> Disabled Server Block \"$1\"" 55 | 56 | # Reload nginx configuration 57 | # Reload nginx configuration 58 | if [[ $NoReload -eq 0 ]]; then 59 | service nginx reload 60 | fi 61 | 62 | exit 0 63 | fi 64 | fi -------------------------------------------------------------------------------- /helpers/ngxen.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ## Show the usage for NGXEN 4 | function show_usage { 5 | cat <>> Enabled Server Block \"$1\"" 59 | 60 | # Reload nginx configuration 61 | if [[ $NoReload -eq 0 ]]; then 62 | service nginx reload 63 | fi 64 | 65 | exit 0 66 | fi 67 | fi 68 | fi -------------------------------------------------------------------------------- /helpers/nvm_install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | NVM_DIR="/home/vagrant/.nvm" 4 | 5 | if ! hash git 2>/dev/null; then 6 | echo >&2 "!!! You need to install git" 7 | exit 1 8 | fi 9 | 10 | if [ -d "$NVM_DIR" ]; then 11 | echo ">>> NVM is already installed in $NVM_DIR, trying to update" 12 | echo -ne "\r=> " 13 | cd $NVM_DIR && git pull 14 | else 15 | # Cloning to $NVM_DIR 16 | git clone https://github.com/creationix/nvm.git $NVM_DIR 17 | fi 18 | 19 | PROFILE="/home/vagrant/.profile" 20 | SOURCE_STR="\n# This loads NVM\n[[ -s /home/vagrant/.nvm/nvm.sh ]] && . /home/vagrant/.nvm/nvm.sh" 21 | 22 | # Append NVM script to ~/.profile 23 | if ! grep -qsc 'nvm.sh' $PROFILE; then 24 | echo ">>> Appending source string to $PROFILE" 25 | printf "$SOURCE_STR" >> "$PROFILE" 26 | else 27 | echo ">>> Source string already in $PROFILE" 28 | fi -------------------------------------------------------------------------------- /helpers/vhost.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Run this as sudo! 4 | # I move this file to /usr/local/bin/vhost and run command 'vhost' from anywhere, using sudo. 5 | 6 | # 7 | # Show Usage, Output to STDERR 8 | # 9 | function show_usage { 10 | cat <<- _EOF_ 11 | 12 | Create a new vHost in Ubuntu Server 13 | Assumes /etc/apache2/sites-available and /etc/apache2/sites-enabled setup used 14 | 15 | -d DocumentRoot - i.e. /var/www/yoursite 16 | -h Help - Show this menu. 17 | -s ServerName - i.e. example.com or sub.example.com 18 | -a ServerAlias - i.e. *.example.com or another domain altogether 19 | -p File path to the SSL certificate. Directories only, no file name. 20 | If using an SSL Certificate, also creates a port :443 vhost as well. 21 | This *ASSUMES* a .crt and a .key file exists 22 | at file path /provided-file-path/your-server-or-cert-name.[crt|key]. 23 | Otherwise you can except Apache errors when you reload Apache. 24 | Ensure Apache's mod_ssl is enabled via "sudo a2enmod ssl". 25 | -c Certificate filename. "xip.io" becomes "xip.io.key" and "xip.io.crt". 26 | 27 | Example Usage. Serve files from /var/www/xip.io at http(s)://192.168.33.10.xip.io 28 | using ssl files from /etc/ssl/xip.io/xip.io.[key|crt] 29 | sudo vhost -d /var/www/xip.io -s 192.168.33.10.xip.io -p /etc/ssl/xip.io -c xip.io 30 | 31 | _EOF_ 32 | exit 1 33 | } 34 | 35 | 36 | # 37 | # Output vHost skeleton, fill with userinput 38 | # To be outputted into new file 39 | # 40 | function create_vhost { 41 | cat <<- _EOF_ 42 | 43 | ServerAdmin webmaster@localhost 44 | ServerName $ServerName 45 | $ServerAlias 46 | 47 | DocumentRoot $DocumentRoot 48 | 49 | 50 | 51 | Options -Indexes +FollowSymLinks +MultiViews 52 | AllowOverride All 53 | Require all granted 54 | 55 | 56 | # Change this "proxy:unix:/path/to/fpm.socket" 57 | # if using a Unix socket 58 | SetHandler "proxy:fcgi://127.0.0.1:9000" 59 | 60 | 61 | 62 | ErrorLog \${APACHE_LOG_DIR}/$ServerName-error.log 63 | 64 | # Possible values include: debug, info, notice, warn, error, crit, 65 | # alert, emerg. 66 | LogLevel warn 67 | 68 | CustomLog \${APACHE_LOG_DIR}/$ServerName-access.log combined 69 | 70 | 71 | 72 | _EOF_ 73 | } 74 | 75 | function create_ssl_vhost { 76 | cat <<- _EOF_ 77 | 78 | ServerAdmin webmaster@localhost 79 | ServerName $ServerName 80 | $ServerAlias 81 | 82 | DocumentRoot $DocumentRoot 83 | 84 | 85 | Options -Indexes +FollowSymLinks +MultiViews 86 | AllowOverride All 87 | Require all granted 88 | 89 | 90 | # Change this "proxy:unix:/path/to/fpm.socket" 91 | # if using a Unix socket 92 | SetHandler "proxy:fcgi://127.0.0.1:9000" 93 | 94 | 95 | 96 | ErrorLog \${APACHE_LOG_DIR}/$ServerName-error.log 97 | 98 | # Possible values include: debug, info, notice, warn, error, crit, 99 | # alert, emerg. 100 | LogLevel warn 101 | 102 | CustomLog \${APACHE_LOG_DIR}/$ServerName-access.log combined 103 | 104 | SSLEngine on 105 | 106 | SSLCertificateFile $CertPath/$CertName.crt 107 | SSLCertificateKeyFile $CertPath/$CertName.key 108 | 109 | 110 | SSLOptions +StdEnvVars 111 | 112 | 113 | BrowserMatch "MSIE [2-6]" \\ 114 | nokeepalive ssl-unclean-shutdown \\ 115 | downgrade-1.0 force-response-1.0 116 | # MSIE 7 and newer should be able to use keepalive 117 | BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown 118 | 119 | _EOF_ 120 | } 121 | 122 | #Sanity Check - are there two arguments with 2 values? 123 | if [ "$#" -lt 4 ]; then 124 | show_usage 125 | fi 126 | 127 | CertPath="" 128 | 129 | #Parse flags 130 | while getopts "d:s:a:p:c:h" OPTION; do 131 | case $OPTION in 132 | h) 133 | show_usage 134 | ;; 135 | d) 136 | DocumentRoot=$OPTARG 137 | ;; 138 | s) 139 | ServerName=$OPTARG 140 | ;; 141 | a) 142 | Alias=$OPTARG 143 | ;; 144 | p) 145 | CertPath=$OPTARG 146 | ;; 147 | c) 148 | CertName=$OPTARG 149 | ;; 150 | *) 151 | show_usage 152 | ;; 153 | esac 154 | done 155 | 156 | # If alias is set: 157 | if [ "$Alias" != "" ]; then 158 | ServerAlias="ServerAlias "$Alias 159 | else 160 | ServerAlias="" 161 | fi 162 | 163 | # If CertName doesn't get set, set it to ServerName 164 | if [ "$CertName" == "" ]; then 165 | CertName=$ServerName 166 | fi 167 | 168 | if [ ! -d $DocumentRoot ]; then 169 | mkdir -p $DocumentRoot 170 | #chown USER:USER $DocumentRoot #POSSIBLE IMPLEMENTATION, new flag -u ? 171 | fi 172 | 173 | if [ -f "$DocumentRoot/$ServerName.conf" ]; then 174 | echo 'vHost already exists. Aborting' 175 | show_usage 176 | else 177 | create_vhost > /etc/apache2/sites-available/${ServerName}.conf 178 | 179 | # Add :443 handling 180 | if [ "$CertPath" != "" ]; then 181 | create_ssl_vhost >> /etc/apache2/sites-available/${ServerName}.conf 182 | fi 183 | 184 | # Enable Site 185 | cd /etc/apache2/sites-available/ && a2ensite ${ServerName}.conf 186 | service apache2 reload 187 | fi -------------------------------------------------------------------------------- /helpers/vimrc: -------------------------------------------------------------------------------- 1 | set nocompatible 2 | filetype off 3 | set encoding=utf-8 4 | 5 | set rtp+=~/.vim/bundle/vundle/ 6 | call vundle#rc() 7 | 8 | " let Vundle manage Vundle 9 | Bundle 'gmarik/vundle' 10 | 11 | " Bundles Here 12 | Bundle 'altercation/vim-colors-solarized' 13 | Bundle 'plasticboy/vim-markdown' 14 | Bundle 'othree/html5.vim' 15 | Bundle 'scrooloose/nerdtree' 16 | Bundle 'kien/ctrlp.vim' 17 | Bundle 'bling/vim-airline' 18 | Bundle 'airblade/vim-gitgutter' 19 | Bundle 'tpope/vim-fugitive' 20 | 21 | filetype plugin indent on 22 | " 23 | "" Brief help 24 | " :BundleList - list configured bundles 25 | " " :BundleInstall(!) - install (update) bundles 26 | " " :BundleSearch(!) foo - search (or refresh cache first) for foo 27 | " " :BundleClean(!) - confirm (or auto-approve) removal of unused bundles 28 | " " 29 | " " see :h vundle for more details or wiki for FAQ 30 | " " NOTE: comments after Bundle commands are not allowed. 31 | 32 | 33 | " Settings 34 | set number 35 | syntax enable 36 | set background=dark 37 | colorscheme solarized 38 | 39 | " Yep, spaces 40 | set smartindent 41 | set tabstop=4 42 | set shiftwidth=4 43 | set expandtab 44 | 45 | " No error noise on 46 | " bad key-strokes, etc 47 | set visualbell 48 | set noerrorbells 49 | 50 | " Change backup and swap dirs 51 | " So these files don't appear in 52 | " our project directories 53 | set backupdir=~/.vim/backup// 54 | set directory=~/.vim/swap// 55 | 56 | " Set leader to comma 57 | let mapleader = "," 58 | let g:mapleader = "," 59 | 60 | " Save via ',w' 61 | nmap w :w! 62 | 63 | " Run phpunit via ',t' 64 | map t :!phpunit % 65 | nmap tt :!phpunit 66 | 67 | " Exit insert mode via 'jj' 68 | imap jj 69 | 70 | " Ctrl-n for NERDTree 71 | " Ctrl-ww to switch between NERDTree and panes 72 | map :NERDTreeToggle 73 | 74 | " CtrlP to open CtrlP 75 | " Ctrl-T to open highlighted file in new tab 76 | 77 | " User older-School (more font-friendly) directory 78 | " arrows in directory listings 79 | " Use this if set encoding utf-8 doesn't fix this issue: 80 | " http://superuser.com/questions/401413/cant-open-folders-in-linux-nerdtree-vim 81 | " https://github.com/scrooloose/nerdtree/issues/108 82 | " let NERDTreeDirArrows=0 83 | 84 | " Remove trailing spaces 85 | " Within PHP files 86 | autocmd BufWritePre *.php :%s/\s\+$//e 87 | 88 | " Open composer.json file easily 89 | " within a new tab via ',lc' 90 | nmap lc :tabe composer.json 91 | 92 | " Remove folding of markdown 93 | " as per https://github.com/plasticboy/vim-markdown 94 | let g:vim_markdown_folding_disabled=1 95 | 96 | " Airline on all the time 97 | set laststatus=2 -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Vaprobash 2 | 3 | **Va**​grant **Pro**​visioning **Bash** Scripts 4 | 5 | [View the site and extended docs.](http://fideloper.github.io/Vaprobash/index.html) 6 | 7 | [![Build Status](https://travis-ci.org/fideloper/Vaprobash.png?branch=master)](https://travis-ci.org/fideloper/Vaprobash) 8 | 9 | ## Goal 10 | 11 | The goal of this project is to create easy to use bash scripts in order to provision a Vagrant server. 12 | 13 | 1. This targets Ubuntu LTS releases, currently 14.04.* 14 | 2. This project will give users various popular options such as LAMP, LEMP 15 | 3. This project will attempt some modularity. For example, users might choose to install a Vim setup, or not. 16 | 17 | Some further assumptions and self-imposed restrictions. If you find yourself needing or wanting the following, then other provisioning tool would better suited ([Chef](http://www.getchef.com), [Puppet](http://puppetlabs.com), [Ansible](http://www.ansibleworks.com)). 18 | 19 | * If other OSes need to be used (CentOS, Redhat, Arch, etc). 20 | * If dependency management becomes complex. For example, installing Laravel depends on Composer. Setting a document root for a project will change depending on Nginx or Apache. Currently, these dependencies are accounted for, but more advanced dependencies will likely not be. 21 | 22 | ## Dependencies 23 | 24 | * Vagrant `1.5.0`+ 25 | * Use `vagrant -v` to check your version 26 | * Vitualbox or VMWare Fusion 27 | 28 | ## Instructions 29 | 30 | **First**, Copy the Vagrantfile from this repo. You may wish to use curl or wget to do this instead of cloning the repository. 31 | 32 | ```bash 33 | # curl 34 | $ curl -L http://bit.ly/vaprobash > Vagrantfile 35 | 36 | # wget 37 | $ wget -O Vagrantfile http://bit.ly/vaprobash 38 | ``` 39 | 40 | > The `bit.ly` link will always point to the master branch version of the Vagrantfile. 41 | 42 | **Second**, edit the `Vagrantfile` and uncomment which scripts you'd like to run. You can uncomment them by removing the `#` character before the `config.vm.provision` line. 43 | 44 | > You can indeed have [multiple provisioning](http://docs.vagrantup.com/v2/provisioning/basic_usage.html) scripts when provisioning Vagrant. 45 | 46 | **Third** and finally, run: 47 | 48 | ```bash 49 | $ vagrant up 50 | ``` 51 | 52 | **Screencast** 53 | 54 | Here's a quickstart screencast! 55 | 56 | [Vaprobash Quickstart](http://vimeo.com/fideloper/vaprobash-quickstart) 57 | 58 | > Windows Users: 59 | > 60 | > By default, NFS won't work on Windows. I suggest deleting the NFS block so Vagrant defaults back to its default file sync behavior. 61 | > 62 | > However, you can also try the "vagrant-winnfsd" plugin. Just run `vagrant plugin install vagrant-winnfsd` to try it out! 63 | > 64 | > Vagrant version 1.5 will have [more file sharing options](https://www.vagrantup.com/blog/feature-preview-vagrant-1-5-rsync.html) to explore as well! 65 | 66 | ## Docs 67 | 68 | [View the site and extended docs.](http://fideloper.github.io/Vaprobash/index.html) 69 | 70 | ## What You Can Install 71 | 72 | * Base Packages 73 | * Base Items (Git and more!) 74 | * PHP (php-fpm) 75 | * Vim 76 | * PHP MsSQL (ability to connect to SQL Server) 77 | * Screen 78 | * Docker 79 | * Web Servers 80 | * Apache 81 | * HHVM 82 | * Nginx 83 | * Databases 84 | * Couchbase 85 | * CouchDB 86 | * MariaDB 87 | * MongoDB 88 | * MySQL 89 | * Neo4J 90 | * PostgreSQL 91 | * SQLite 92 | * In-Memory Stores 93 | * Memcached 94 | * Redis 95 | * Search 96 | * ElasticSearch and ElasticHQ 97 | * Utility 98 | * Beanstalkd 99 | * Supervisord 100 | * Kibana 101 | * Additional Languages 102 | * NodeJS via NVM 103 | * Ruby via RVM 104 | * Frameworks / Tooling 105 | * Composer 106 | * Laravel 107 | * Symfony 108 | * PHPUnit 109 | * MailCatcher 110 | * Ansible 111 | * Android 112 | 113 | ## The Vagrantfile 114 | 115 | The vagrant file does three things you should take note of: 116 | 117 | 1. **Gives the virtual machine a static IP address of 192.168.22.10.** This IP address is again hard-coded (for now) into the LAMP, LEMP and Laravel/Symfony installers. This static IP allows us to use [xip.io](http://xip.io) for the virtual host setups while avoiding having to edit our computers' `hosts` file. 118 | 2. **Uses NFS instead of the default file syncing.** NFS is reportedly faster than the default syncing for large files. If, however, you experience issues with the files actually syncing between your host and virtual machine, you can change this to the default syncing by deleting the lines setting up NFS: 119 | 120 | ```ruby 121 | config.vm.synced_folder ".", "/vagrant", 122 | id: "core", 123 | :nfs => true, 124 | :mount_options => ['nolock,vers=3,udp,noatime'] 125 | ``` 126 | 3. **Offers an option to prevent the virtual machine from losing internet connection when running on Ubuntu.** If your virtual machine can't access the internet, you can solve this problem by uncommenting the two lines below: 127 | 128 | ```ruby 129 | #vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] 130 | #vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"] 131 | ``` 132 | 133 | Don't forget to reload your Vagrantfile running `vagrant reload --no-provision`, in case your virtual machine already exists. 134 | 135 | ## Connecting to MySQL from Sequel Pro: 136 | 137 | Change your IP address as needed. The default IP address is now `192.168.22.10` 138 | 139 | ![sequel pro vaprobash](http://fideloper.github.io/Vaprobash/img/sequel_pro.png) 140 | 141 | ## Contribute! 142 | 143 | Do it! Any new install or improvement on existing ones are welcome! Please see the [contributing doc](/contributing.md). 144 | -------------------------------------------------------------------------------- /scripts/android.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing android"; 4 | 5 | ANDROID_SDK_FILENAME=android-sdk_r23.0.2-linux.tgz 6 | ANDROID_SDK=http://dl.google.com/android/$ANDROID_SDK_FILENAME 7 | 8 | # Intall Dependencies (JDK, Ant and expect) 9 | sudo apt-get install -y openjdk-7-jdk ant expect 10 | 11 | # Download Android SDK 12 | curl -O $ANDROID_SDK 13 | tar -xzvf $ANDROID_SDK_FILENAME 14 | 15 | # Add permissions for vagrant user and removing .tgz file 16 | sudo chown -R vagrant android-sdk-linux/ 17 | sudo rm -rf $ANDROID_SDK_FILENAME 18 | 19 | # Add new values of variables environment in .bashrc 20 | echo "" >> /home/vagrant/.bashrc 21 | echo "JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386/jre/bin/java" >> /home/vagrant/.bashrc 22 | echo "ANDROID_HOME=~/android-sdk-linux" >> /home/vagrant/.bashrc 23 | echo "export PATH=\$PATH:~/android-sdk-linux/tools:~/android-sdk-linux/platform-tools" >> /home/vagrant/.bashrc 24 | 25 | expect -c ' 26 | set timeout -1 ; 27 | spawn /home/vagrant/android-sdk-linux/tools/android update sdk -u --all --filter platform-tool,android-19,build-tools-19.1.0 28 | expect { 29 | "Do you accept the license" { exp_send "y\r" ; exp_continue } 30 | eof 31 | } 32 | ' 33 | 34 | sudo /home/vagrant/android-sdk-linux/platform-tools/adb kill-server 35 | sudo /home/vagrant/android-sdk-linux/platform-tools/adb start-server 36 | sudo /home/vagrant/android-sdk-linux/platform-tools/adb devices 37 | -------------------------------------------------------------------------------- /scripts/ansible.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing ansible"; 4 | 5 | # Install software-properties-common 6 | sudo apt-get install -y software-properties-common 7 | 8 | # Add repository 9 | sudo apt-add-repository -y ppa:ansible/ansible 10 | sudo apt-get update 11 | 12 | # Intall ansible 13 | sudo apt-get install -y ansible 14 | -------------------------------------------------------------------------------- /scripts/apache.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Test if PHP is installed 4 | php -v > /dev/null 2>&1 5 | PHP_IS_INSTALLED=$? 6 | 7 | # Test if HHVM is installed 8 | hhvm --version > /dev/null 2>&1 9 | HHVM_IS_INSTALLED=$? 10 | 11 | # If HHVM is installed, assume PHP is *not* 12 | [[ $HHVM_IS_INSTALLED -eq 0 ]] && { PHP_IS_INSTALLED=-1; } 13 | 14 | echo ">>> Installing Apache Server" 15 | 16 | [[ -z $1 ]] && { echo "!!! IP address not set. Check the Vagrant file."; exit 1; } 17 | 18 | if [[ -z $2 ]]; then 19 | public_folder="/vagrant" 20 | else 21 | public_folder="$2" 22 | fi 23 | 24 | if [[ -z $4 ]]; then 25 | github_url="https://raw.githubusercontent.com/fideloper/Vaprobash/master" 26 | else 27 | github_url="$4" 28 | fi 29 | 30 | # Add repo for latest FULL stable Apache 31 | # (Required to remove conflicts with PHP PPA due to partial Apache upgrade within it) 32 | sudo add-apt-repository -y ppa:ondrej/apache2 33 | 34 | 35 | # Update Again 36 | sudo apt-key update 37 | sudo apt-get update 38 | 39 | # Install Apache 40 | # -qq implies -y --force-yes 41 | sudo apt-get install -qq apache2 42 | 43 | echo ">>> Configuring Apache" 44 | 45 | # Add vagrant user to www-data group 46 | sudo usermod -a -G www-data vagrant 47 | 48 | # Apache Config 49 | # On separate lines since some may cause an error 50 | # if not installed 51 | sudo a2dismod mpm_prefork mpm_worker 52 | sudo a2dismod php5 53 | sudo a2enmod rewrite actions ssl 54 | curl --silent -L $github_url/helpers/vhost.sh > vhost 55 | sudo chmod guo+x vhost 56 | sudo mv vhost /usr/local/bin 57 | 58 | # Create a virtualhost to start, with SSL certificate 59 | sudo vhost -s $1.xip.io -d $public_folder -p /etc/ssl/xip.io -c xip.io -a $3 60 | sudo a2dissite 000-default 61 | 62 | # If PHP is installed or HHVM is installed, proxy PHP requests to it 63 | if [[ $PHP_IS_INSTALLED -eq 0 || $HHVM_IS_INSTALLED -eq 0 ]]; then 64 | 65 | # PHP Config for Apache 66 | sudo a2enmod proxy_fcgi 67 | else 68 | # vHost script assumes ProxyPassMatch to PHP 69 | # If PHP is not installed, we'll comment it out 70 | sudo sed -i "s@ProxyPassMatch@#ProxyPassMatch@" /etc/apache2/sites-available/$1.xip.io.conf 71 | fi 72 | 73 | sudo service apache2 restart 74 | -------------------------------------------------------------------------------- /scripts/base.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "Setting Timezone & Locale to $3 & en_US.UTF-8" 4 | 5 | sudo ln -sf /usr/share/zoneinfo/$3 /etc/localtime 6 | sudo apt-get install -qq language-pack-en 7 | sudo locale-gen en_US 8 | sudo update-locale LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 9 | 10 | echo ">>> Installing Base Packages" 11 | 12 | if [[ -z $1 ]]; then 13 | github_url="https://raw.githubusercontent.com/fideloper/Vaprobash/master" 14 | else 15 | github_url="$1" 16 | fi 17 | 18 | # Update 19 | sudo apt-get update 20 | 21 | # Install base packages 22 | # -qq implies -y --force-yes 23 | sudo apt-get install -qq curl unzip git-core ack-grep software-properties-common build-essential cachefilesd 24 | 25 | 26 | echo ">>> Installing *.xip.io self-signed SSL" 27 | 28 | SSL_DIR="/etc/ssl/xip.io" 29 | DOMAIN="*.xip.io" 30 | PASSPHRASE="vaprobash" 31 | 32 | SUBJ=" 33 | C=US 34 | ST=Connecticut 35 | O=Vaprobash 36 | localityName=New Haven 37 | commonName=$DOMAIN 38 | organizationalUnitName= 39 | emailAddress= 40 | " 41 | 42 | sudo mkdir -p "$SSL_DIR" 43 | 44 | sudo openssl genrsa -out "$SSL_DIR/xip.io.key" 1024 45 | sudo openssl req -new -subj "$(echo -n "$SUBJ" | tr "\n" "/")" -key "$SSL_DIR/xip.io.key" -out "$SSL_DIR/xip.io.csr" -passin pass:$PASSPHRASE 46 | sudo openssl x509 -req -days 365 -in "$SSL_DIR/xip.io.csr" -signkey "$SSL_DIR/xip.io.key" -out "$SSL_DIR/xip.io.crt" 47 | 48 | # Setting up Swap 49 | 50 | # Disable case sensitivity 51 | shopt -s nocasematch 52 | 53 | if [[ ! -z $2 && ! $2 =~ false && $2 =~ ^[0-9]*$ ]]; then 54 | 55 | echo ">>> Setting up Swap ($2 MB)" 56 | 57 | # Create the Swap file 58 | fallocate -l $2M /swapfile 59 | 60 | # Set the correct Swap permissions 61 | chmod 600 /swapfile 62 | 63 | # Setup Swap space 64 | mkswap /swapfile 65 | 66 | # Enable Swap space 67 | swapon /swapfile 68 | 69 | # Make the Swap file permanent 70 | echo "/swapfile none swap sw 0 0" | tee -a /etc/fstab 71 | 72 | # Add some swap settings: 73 | # vm.swappiness=10: Means that there wont be a Swap file until memory hits 90% useage 74 | # vm.vfs_cache_pressure=50: read http://rudd-o.com/linux-and-free-software/tales-from-responsivenessland-why-linux-feels-slow-and-how-to-fix-that 75 | printf "vm.swappiness=10\nvm.vfs_cache_pressure=50" | tee -a /etc/sysctl.conf && sysctl -p 76 | 77 | fi 78 | 79 | # Enable case sensitivity 80 | shopt -u nocasematch 81 | 82 | # Enable cachefilesd 83 | echo "RUN=yes" > /etc/default/cachefilesd 84 | -------------------------------------------------------------------------------- /scripts/base_box_optimizations.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # exit script if not run as root 4 | if [[ $EUID -ne 0 ]]; then 5 | cat < true in Vagrantfile 8 | END 9 | 10 | exit 0 11 | fi 12 | 13 | # optimize apt sources to select best mirror 14 | perl -pi -e 's@^\s*(deb(\-src)?)\s+http://us.archive.*?\s+@\1 mirror://mirrors.ubuntu.com/mirrors.txt @g' /etc/apt/sources.list 15 | 16 | # update repositories 17 | apt-get update 18 | -------------------------------------------------------------------------------- /scripts/beanstalkd.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing Beanstalkd" 4 | 5 | # Install Beanstalkd 6 | # -qq implies -y --force-yes 7 | sudo apt-get install -qq beanstalkd 8 | 9 | # Set to start on system start 10 | sudo sed -i "s/#START=yes/START=yes/" /etc/default/beanstalkd 11 | 12 | # Start Beanstalkd 13 | sudo service beanstalkd start 14 | -------------------------------------------------------------------------------- /scripts/composer.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Test if PHP is installed 4 | php -v > /dev/null 2>&1 5 | PHP_IS_INSTALLED=$? 6 | 7 | # Test if HHVM is installed 8 | hhvm --version > /dev/null 2>&1 9 | HHVM_IS_INSTALLED=$? 10 | 11 | [[ $HHVM_IS_INSTALLED -ne 0 && $PHP_IS_INSTALLED -ne 0 ]] && { printf "!!! PHP/HHVM is not installed.\n Installing Composer aborted!\n"; exit 0; } 12 | 13 | # Test if Composer is installed 14 | composer -v > /dev/null 2>&1 15 | COMPOSER_IS_INSTALLED=$? 16 | 17 | # Getting the arguments 18 | GITHUB_OAUTH=$1 19 | COMPOSER_PACKAGES=$2 20 | 21 | # True, if composer is not installed 22 | if [[ $COMPOSER_IS_INSTALLED -ne 0 ]]; then 23 | echo ">>> Installing Composer" 24 | if [[ $HHVM_IS_INSTALLED -eq 0 ]]; then 25 | # Install Composer 26 | sudo wget --quiet https://getcomposer.org/installer 27 | hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 installer 28 | sudo mv composer.phar /usr/local/bin/composer 29 | sudo rm installer 30 | 31 | # Add an alias that will allow us to use composer without timeout's 32 | printf "\n# Add an alias for sudo\n%s\n# Use HHVM when using Composer\n%s" \ 33 | "alias sudo=\"sudo \"" \ 34 | "alias composer=\"hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 -v Eval.Jit=false /usr/local/bin/composer\"" \ 35 | >> "/home/vagrant/.profile" 36 | 37 | # Resource .profile 38 | # Doesn't seem to work do! The alias is only usefull from the moment you log in: vagrant ssh 39 | . /home/vagrant/.profile 40 | else 41 | # Install Composer 42 | curl -sS https://getcomposer.org/installer | php 43 | sudo mv composer.phar /usr/local/bin/composer 44 | fi 45 | else 46 | echo ">>> Updating Composer" 47 | 48 | if [[ $HHVM_IS_INSTALLED -eq 0 ]]; then 49 | sudo hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 -v Eval.Jit=false /usr/local/bin/composer self-update 50 | else 51 | composer self-update 52 | fi 53 | fi 54 | 55 | if [[ $GITHUB_OAUTH != "" ]]; then 56 | if [[ ! $COMPOSER_IS_INSTALLED -eq 1 ]]; then 57 | echo ">>> Setting Github Personal Access Token" 58 | composer config -g github-oauth.github.com $GITHUB_OAUTH 59 | fi 60 | fi 61 | 62 | 63 | # Install Global Composer Packages if any are given 64 | if [[ ! -z $COMPOSER_PACKAGES ]]; then 65 | echo ">>> Installing Global Composer Packages:" 66 | echo " " ${COMPOSER_PACKAGES[@]} 67 | 68 | # Add Composer's Global Bin to ~/.profile path 69 | if [[ -f "/home/vagrant/.profile" ]]; then 70 | if ! grep -qsc 'COMPOSER_HOME=' /home/vagrant/.profile; then 71 | # Ensure COMPOSER_HOME variable is set. This isn't set by Composer automatically 72 | printf "\n\nCOMPOSER_HOME=\"/home/vagrant/.composer\"" >> /home/vagrant/.profile 73 | # Add composer home vendor bin dir to PATH to run globally installed executables 74 | printf "\n# Add Composer Global Bin to PATH\n%s" 'export PATH=$PATH:$COMPOSER_HOME/vendor/bin' >> /home/vagrant/.profile 75 | 76 | # Source the .profile to pick up changes 77 | . /home/vagrant/.profile 78 | fi 79 | fi 80 | 81 | if [[ $HHVM_IS_INSTALLED -eq 0 ]]; then 82 | hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 -v Eval.Jit=false /usr/local/bin/composer global require ${COMPOSER_PACKAGES[@]} 83 | else 84 | composer global require ${COMPOSER_PACKAGES[@]} 85 | fi 86 | fi 87 | -------------------------------------------------------------------------------- /scripts/couchbase.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing Couchbase Server" 4 | 5 | # Set some variables 6 | COUCHBASE_EDITION=community 7 | COUCHBASE_VERSION=2.2.0 # Check http://http://www.couchbase.com/download/ for latest version 8 | COUCHBASE_ARCH=x86_64 9 | 10 | 11 | wget --quiet http://packages.couchbase.com/releases/${COUCHBASE_VERSION}/couchbase-server-${COUCHBASE_EDITION}_${COUCHBASE_VERSION}_${COUCHBASE_ARCH}.deb 12 | sudo dpkg -i couchbase-server-${COUCHBASE_EDITION}_${COUCHBASE_VERSION}_${COUCHBASE_ARCH}.deb 13 | rm couchbase-server-${COUCHBASE_EDITION}_${COUCHBASE_VERSION}_${COUCHBASE_ARCH}.deb 14 | 15 | php -v > /dev/null 2>&1 16 | PHP_IS_INSTALLED=$? 17 | 18 | dpkg -s php-pear 19 | PEAR_IS_INSTALLED=$? 20 | 21 | dpkg -s php5-dev 22 | PHPDEV_IS_INSTALLED=$? 23 | 24 | if [ ${PHP_IS_INSTALLED} -eq 0 ]; then 25 | 26 | if [ ${PEAR_IS_INSTALLED} -eq 1 ]; then 27 | sudo apt-get -qq install php-pear 28 | fi 29 | 30 | if [ ${PHPDEV_IS_INSTALLED} -eq 1 ]; then 31 | sudo apt-get -qq install php5-dev 32 | fi 33 | 34 | sudo wget --quiet -O/etc/apt/sources.list.d/couchbase.list http://packages.couchbase.com/ubuntu/couchbase-ubuntu1204.list 35 | wget --quiet -O- http://packages.couchbase.com/ubuntu/couchbase.key | sudo apt-key add - 36 | sudo apt-get update 37 | sudo apt-get -qq install libcouchbase2-libevent libcouchbase-dev 38 | 39 | sudo pecl install couchbase-1.2.2 40 | sudo cat > /etc/php5/mods-available/couchbase.ini << EOF 41 | ; configuration for php couchbase module 42 | ; priority=30 43 | extension=couchbase.so 44 | EOF 45 | sudo php5enmod couchbase 46 | sudo service php5-fpm restart 47 | fi -------------------------------------------------------------------------------- /scripts/couchdb.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing CouchDB" 4 | 5 | # Install CouchDB 6 | # -qq implies -y --force-yes 7 | sudo apt-get install -qq couchdb 8 | 9 | # Make Futon Available 10 | sudo sed -i 's/;bind_address = 127.0.0.1/bind_address = 0.0.0.0/' /etc/couchdb/local.ini -------------------------------------------------------------------------------- /scripts/docker.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing Docker" 4 | 5 | # Add Key 6 | sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 7 | 8 | # Add Repository 9 | sudo sh -c "echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list" 10 | sudo apt-get update 11 | 12 | # Install Docker 13 | # -qq implies -y --force-yes 14 | sudo apt-get install -qq lxc-docker 15 | 16 | # Make the vagrant user able to interact with docker without sudo 17 | if [ ! -z "$1" ]; then 18 | if [ "$1" == "permissions" ]; then 19 | echo ">>> Adding vagrant user to docker group" 20 | 21 | sudo usermod -a -G docker vagrant 22 | 23 | fi # permissions 24 | fi # arg check 25 | -------------------------------------------------------------------------------- /scripts/elastichq.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing ElasticHQ" 4 | 5 | nginx -v > /dev/null 2>&1 6 | NGINX_IS_INSTALLED=$? 7 | 8 | apache2 -v > /dev/null 2>&1 9 | APACHE_IS_INSTALLED=$? 10 | 11 | cd /usr/share/ 12 | sudo curl --silent -L https://github.com/royrusso/elasticsearch-HQ/tarball/master | sudo tar -xz 13 | sudo mv *elasticsearch-HQ*/ elastichq/ 14 | cd ~ 15 | 16 | # Set and enable configuration for Apache 17 | if [ $APACHE_IS_INSTALLED -eq 0 ]; then 18 | cat << EOF | sudo tee -a /etc/apache2/conf-available/elastichq.conf 19 | Alias /elastichq /usr/share/elastichq 20 | 21 | 22 | 23 | DirectoryIndex index.html 24 | AllowOverride None 25 | 26 | order deny,allow 27 | deny from all 28 | allow from all 29 | 30 | 31 | EOF 32 | sudo a2enconf elastichq 33 | 34 | # Reload Apache to load in configuration 35 | sudo service apache2 reload 36 | fi 37 | 38 | # Set and enable configuration for Nginx 39 | if [ $NGINX_IS_INSTALLED -eq 0 ]; then 40 | sudo ngxdis vagrant 41 | sudo sed -i '$ d' /etc/nginx/sites-available/vagrant 42 | sudo tee -a /etc/nginx/sites-available/vagrant > /dev/null <<'EOF' 43 | 44 | location /elastichq { 45 | root /usr/share/; 46 | index index.html; 47 | location ~ ^/elastichq/(.+\.php)$ { 48 | try_files $uri =404; 49 | root /usr/share/; 50 | fastcgi_pass unix:/var/run/php5-fpm.sock; 51 | fastcgi_index index.php; 52 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 53 | include /etc/nginx/fastcgi_params; 54 | } 55 | location ~* ^/elastichq/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { 56 | root /usr/share/; 57 | } 58 | } 59 | 60 | location /ElasticHQ { 61 | rewrite ^/* /elastichq last; 62 | } 63 | } 64 | EOF 65 | sudo ngxen vagrant 66 | 67 | # Reload Nginx to load in configuration 68 | sudo service nginx reload 69 | fi 70 | -------------------------------------------------------------------------------- /scripts/elasticsearch.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing Elasticsearch" 4 | 5 | # Set some variables 6 | ELASTICSEARCH_VERSION=$1 # Check https://www.elastic.co/downloads/elasticsearch for latest version 7 | 8 | # Install prerequisite: Java 9 | # -qq implies -y --force-yes 10 | sudo apt-get update 11 | sudo apt-get install -qq openjdk-7-jre-headless 12 | 13 | wget --quiet https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-$ELASTICSEARCH_VERSION.deb 14 | sudo dpkg -i elasticsearch-$ELASTICSEARCH_VERSION.deb 15 | rm elasticsearch-$ELASTICSEARCH_VERSION.deb 16 | 17 | # Configure Elasticsearch for development purposes (1 shard/no replicas, don't allow it to swap at all if it can run without swapping) 18 | sudo sed -i "s/# index.number_of_shards: 1/index.number_of_shards: 1/" /etc/elasticsearch/elasticsearch.yml 19 | sudo sed -i "s/# index.number_of_replicas: 0/index.number_of_replicas: 0/" /etc/elasticsearch/elasticsearch.yml 20 | sudo sed -i "s/# bootstrap.mlockall: true/bootstrap.mlockall: true/" /etc/elasticsearch/elasticsearch.yml 21 | sudo service elasticsearch restart 22 | 23 | # Configure to start up Elasticsearch automatically 24 | sudo update-rc.d elasticsearch defaults 95 10 25 | -------------------------------------------------------------------------------- /scripts/git-ftp.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Test if git is installed 4 | git --version > /dev/null 2>&1 5 | GIT_IS_INSTALLED=$? 6 | 7 | if [[ $GIT_IS_INSTALLED -gt 0 ]]; then 8 | echo ">>> ERROR: git-ftp install requires git" 9 | exit 1 10 | fi 11 | 12 | # Test if cURL is installed 13 | curl --version > /dev/null 2>&1 14 | CURL_IS_INSTALLED=$? 15 | 16 | if [ $CURL_IS_INSTALLED -gt 0 ]; then 17 | echo ">>> ERROR: git-ftp install requires cURL" 18 | exit 1 19 | fi 20 | 21 | echo ">>> Installing git-ftp"; 22 | 23 | # Clone git-ftp into .git-ftp folder 24 | git clone https://github.com/git-ftp/git-ftp.git /home/vagrant/.git-ftp 25 | 26 | # Move to the .git-ftp folder 27 | cd /home/vagrant/.git-ftp 28 | 29 | # Install git-ftp 30 | sudo make install 31 | -------------------------------------------------------------------------------- /scripts/go.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # check if a go version is set 4 | if [[ -z $1 ]]; then 5 | GO_VERSION="latest" 6 | else 7 | GO_VERSION=$1 8 | fi 9 | 10 | # Check if gvm is installed 11 | gvm version > /dev/null 2>&1 12 | GVM_IS_INSTALLED=$? 13 | 14 | if [ $GVM_IS_INSTALLED -eq 0 ]; then 15 | echo "Gvm Already Installed" 16 | else 17 | # Installing dependencies 18 | echo "Installing Go version manager" 19 | sudo apt-get install -qq curl git mercurial make binutils bison build-essential 20 | bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) 21 | source /home/vagrant/.gvm/scripts/gvm 22 | 23 | if [[ $GO_VERSION -eq "latest" ]]; then 24 | GO_VERSION=`curl -L 'https://golang.org/' | grep 'Build version' | awk '{print $3}' | awk -F\< '{ print $1 }' | rev | cut -c 2- | rev` 25 | fi 26 | echo "Installing Go version "$GO_VERSION 27 | echo "This will also be the default version" 28 | 29 | gvm install $GO_VERSION --prefer-binary 30 | gvm use $GO_VERSION --default 31 | fi 32 | -------------------------------------------------------------------------------- /scripts/kibana.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing Kibana" 4 | 5 | # Set some variables 6 | KIBANA_VERSION=4.1.1 # Check https://www.elastic.co/downloads/kibana for latest version 7 | 8 | sudo mkdir -p /opt/kibana 9 | wget --quiet https://download.elastic.co/kibana/kibana/kibana-$KIBANA_VERSION-linux-x64.tar.gz 10 | sudo tar xvf kibana-$KIBANA_VERSION-linux-x64.tar.gz -C /opt/kibana --strip-components=1 11 | rm kibana-$KIBANA_VERSION-linux-x64.tar.gz 12 | 13 | # Configure to start up Kibana automatically 14 | cd /etc/init.d && sudo wget --quiet https://gist.githubusercontent.com/thisismitch/8b15ac909aed214ad04a/raw/bce61d85643c2dcdfbc2728c55a41dab444dca20/kibana4 15 | 16 | sudo chmod +x /etc/init.d/kibana4 17 | sudo update-rc.d kibana4 defaults 95 10 18 | sudo service kibana4 start 19 | -------------------------------------------------------------------------------- /scripts/laravel.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing Laravel" 4 | 5 | # Test if PHP is installed 6 | php -v > /dev/null 2>&1 7 | PHP_IS_INSTALLED=$? 8 | 9 | # Test if HHVM is installed 10 | hhvm --version > /dev/null 2>&1 11 | HHVM_IS_INSTALLED=$? 12 | 13 | [[ $HHVM_IS_INSTALLED -ne 0 && $PHP_IS_INSTALLED -ne 0 ]] && { printf "!!! PHP/HHVM is not installed.\n Installing Laravel aborted!\n"; exit 0; } 14 | 15 | # Test if Composer is installed 16 | composer -v > /dev/null 2>&1 || { printf "!!! Composer is not installed.\n Installing Laravel aborted!"; exit 0; } 17 | 18 | # Test if Server IP is set in Vagrantfile 19 | [[ -z "$1" ]] && { printf "!!! IP address not set. Check the Vagrantfile.\n Installing Laravel aborted!\n"; exit 0; } 20 | 21 | # Check if Laravel root is set. If not set use default 22 | if [[ -z $2 ]]; then 23 | laravel_root_folder="/vagrant/laravel" 24 | else 25 | laravel_root_folder="$2" 26 | fi 27 | 28 | laravel_public_folder="$laravel_root_folder/public" 29 | 30 | # Test if Apache or Nginx is installed 31 | nginx -v > /dev/null 2>&1 32 | NGINX_IS_INSTALLED=$? 33 | 34 | apache2 -v > /dev/null 2>&1 35 | APACHE_IS_INSTALLED=$? 36 | 37 | # Create Laravel folder if needed 38 | if [[ ! -d $laravel_root_folder ]]; then 39 | mkdir -p $laravel_root_folder 40 | fi 41 | 42 | if [[ ! -f "$laravel_root_folder/composer.json" ]]; then 43 | if [[ $HHVM_IS_INSTALLED -eq 0 ]]; then 44 | # Create Laravel 45 | if [[ "$4" == 'latest-stable' ]]; then 46 | hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 -v Eval.Jit=false /usr/local/bin/composer \ 47 | create-project --prefer-dist laravel/laravel $laravel_root_folder 48 | else 49 | hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 -v Eval.Jit=false /usr/local/bin/composer \ 50 | create-project laravel/laravel:$4 $laravel_root_folder 51 | fi 52 | else 53 | # Create Laravel 54 | if [[ "$4" == 'latest-stable' ]]; then 55 | composer create-project --prefer-dist laravel/laravel $laravel_root_folder 56 | else 57 | composer create-project laravel/laravel:$4 $laravel_root_folder 58 | fi 59 | fi 60 | else 61 | # Go to vagrant folder 62 | cd $laravel_root_folder 63 | 64 | if [[ $HHVM_IS_INSTALLED -eq 0 ]]; then 65 | hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 -v Eval.Jit=false /usr/local/bin/composer \ 66 | install --prefer-dist 67 | else 68 | composer install --prefer-dist 69 | fi 70 | 71 | # Go to the previous folder 72 | cd - 73 | fi 74 | 75 | if [[ $NGINX_IS_INSTALLED -eq 0 ]]; then 76 | # Change default vhost created 77 | sudo sed -i "s@root /vagrant@root $laravel_public_folder@" /etc/nginx/sites-available/vagrant 78 | sudo service nginx reload 79 | fi 80 | 81 | if [[ $APACHE_IS_INSTALLED -eq 0 ]]; then 82 | # Find and replace to find public_folder and replace with laravel_public_folder 83 | # Change DocumentRoot 84 | # Change ProxyPassMatch fcgi path 85 | # Change path 86 | sudo sed -i "s@$3@$laravel_public_folder@" /etc/apache2/sites-available/$1.xip.io.conf 87 | 88 | 89 | sudo service apache2 reload 90 | fi 91 | -------------------------------------------------------------------------------- /scripts/mailcatcher.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | PHP_VERSION=$1 4 | 5 | echo ">>> Installing Mailcatcher" 6 | 7 | # Test if PHP is installed 8 | php -v > /dev/null 2>&1 9 | PHP_IS_INSTALLED=$1 10 | 11 | # Test if Apache is installed 12 | apache2 -v > /dev/null 2>&1 13 | APACHE_IS_INSTALLED=$? 14 | 15 | # Installing dependency 16 | # -qq implies -y --force-yes 17 | sudo apt-get install -qq libsqlite3-dev ruby1.9.1-dev 18 | 19 | if $(which rvm) -v > /dev/null 2>&1; then 20 | echo ">>>>Installing with RVM" 21 | $(which rvm) default@mailcatcher --create do gem install --no-rdoc --no-ri mailcatcher 22 | $(which rvm) wrapper default@mailcatcher --no-prefix mailcatcher catchmail 23 | else 24 | # Gem check 25 | if ! gem -v > /dev/null 2>&1; then sudo aptitude install -y libgemplugin-ruby; fi 26 | 27 | # Install 28 | gem install --no-rdoc --no-ri mailcatcher 29 | fi 30 | 31 | # Make it start on boot 32 | sudo tee /etc/init/mailcatcher.conf <>> Installing MariaDB" 4 | 5 | [[ -z $1 ]] && { echo "!!! MariaDB root password not set. Check the Vagrant file."; exit 1; } 6 | 7 | # default version 8 | MARIADB_VERSION='10.1' 9 | 10 | # Import repo key 11 | sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db 12 | 13 | # Add repo for MariaDB 14 | sudo add-apt-repository "deb [arch=amd64,i386] http://mirrors.accretive-networks.net/mariadb/repo/$MARIADB_VERSION/ubuntu trusty main" 15 | 16 | # Update 17 | sudo apt-get update 18 | 19 | # Install MariaDB without password prompt 20 | # Set username to 'root' and password to 'mariadb_root_password' (see Vagrantfile) 21 | sudo debconf-set-selections <<< "maria-db-$MARIADB_VERSION mysql-server/root_password password $1" 22 | sudo debconf-set-selections <<< "maria-db-$MARIADB_VERSION mysql-server/root_password_again password $1" 23 | 24 | # Install MariaDB 25 | # -qq implies -y --force-yes 26 | sudo apt-get install -qq mariadb-server 27 | 28 | # Make Maria connectable from outside world without SSH tunnel 29 | if [ $2 == "true" ]; then 30 | # enable remote access 31 | # setting the mysql bind-address to allow connections from everywhere 32 | sed -i "s/bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/my.cnf 33 | 34 | # adding grant privileges to mysql root user from everywhere 35 | # thx to http://stackoverflow.com/questions/7528967/how-to-grant-mysql-privileges-in-a-bash-script for this 36 | MYSQL=`which mysql` 37 | 38 | Q1="GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY '$1' WITH GRANT OPTION;" 39 | Q2="FLUSH PRIVILEGES;" 40 | SQL="${Q1}${Q2}" 41 | 42 | $MYSQL -uroot -p$1 -e "$SQL" 43 | 44 | service mysql restart 45 | fi 46 | -------------------------------------------------------------------------------- /scripts/memcached.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Install Memcached 4 | # -qq implies -y --force-yes 5 | sudo apt-get install -qq memcached 6 | -------------------------------------------------------------------------------- /scripts/mongodb.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing MongoDB" 4 | 5 | # Get key and add to sources 6 | sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 7 | 8 | # Make MongoDB connectable from outside world without SSH tunnel 9 | if [ $2 == "3.0" ]; then 10 | echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list 11 | else 12 | echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list 13 | fi 14 | 15 | 16 | # Update 17 | sudo apt-get update 18 | 19 | # Install MongoDB 20 | # -qq implies -y --force-yes 21 | sudo apt-get install -qq mongodb-org 22 | 23 | # Make MongoDB connectable from outside world without SSH tunnel 24 | if [ $1 == "true" ]; then 25 | # enable remote access 26 | # setting the mongodb bind_ip to allow connections from everywhere 27 | sed -i "s/bind_ip = .*/bind_ip = 0.0.0.0/" /etc/mongod.conf 28 | fi 29 | 30 | # Test if PHP is installed 31 | php -v > /dev/null 2>&1 32 | PHP_IS_INSTALLED=$? 33 | 34 | if [ $PHP_IS_INSTALLED -eq 0 ]; then 35 | # install dependencies 36 | sudo apt-get -y install php-pear php5-dev 37 | 38 | # install php extension 39 | echo "no" > answers.txt 40 | sudo pecl install mongo < answers.txt 41 | rm answers.txt 42 | 43 | # add extension file and restart service 44 | echo 'extension=mongo.so' | sudo tee /etc/php5/mods-available/mongo.ini 45 | 46 | ln -s /etc/php5/mods-available/mongo.ini /etc/php5/fpm/conf.d/mongo.ini 47 | ln -s /etc/php5/mods-available/mongo.ini /etc/php5/cli/conf.d/mongo.ini 48 | sudo service php5-fpm restart 49 | fi 50 | -------------------------------------------------------------------------------- /scripts/mssql.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing PHP MSSQL" 4 | 5 | # Test if PHP is installed 6 | php -v > /dev/null 2>&1 || { printf "!!! PHP is not installed.\n Installing PHP MSSQL aborted!\n"; exit 0; } 7 | 8 | sudo apt-get update 9 | 10 | # Install PHP MSSQL 11 | # -qq implies -y --force-yes 12 | sudo apt-get install -qq php5-mssql 13 | 14 | echo ">>> Installing freeTDS for MSSQL" 15 | 16 | # Install freetds 17 | sudo apt-get install -qq freetds-dev freetds-bin tdsodbc 18 | 19 | echo ">>> Installing UnixODBC for MSSQL" 20 | 21 | # Install unixodbc 22 | sudo apt-get install -qq unixodbc unixodbc-dev 23 | 24 | # Restart php5-fpm 25 | sudo service php5-fpm restart -------------------------------------------------------------------------------- /scripts/mysql.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing MySQL Server $2" 4 | 5 | [[ -z "$1" ]] && { echo "!!! MySQL root password not set. Check the Vagrant file."; exit 1; } 6 | 7 | mysql_package=mysql-server 8 | 9 | if [ $2 == "5.6" ]; then 10 | # Add repo for MySQL 5.6 11 | sudo add-apt-repository -y ppa:ondrej/mysql-5.6 12 | 13 | # Update Again 14 | sudo apt-get update 15 | 16 | # Change package 17 | mysql_package=mysql-server-5.6 18 | fi 19 | 20 | # Install MySQL without password prompt 21 | # Set username and password to 'root' 22 | sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password $1" 23 | sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $1" 24 | 25 | # Install MySQL Server 26 | # -qq implies -y --force-yes 27 | sudo apt-get install -qq $mysql_package 28 | 29 | # Make MySQL connectable from outside world without SSH tunnel 30 | if [ $3 == "true" ]; then 31 | # enable remote access 32 | # setting the mysql bind-address to allow connections from everywhere 33 | if [ $2 == "5.6" ]; then 34 | sed -i "s/bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/mysql.conf.d/mysqld.cnf 35 | else 36 | sed -i "s/bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/my.cnf 37 | fi 38 | 39 | # adding grant privileges to mysql root user from everywhere 40 | # thx to http://stackoverflow.com/questions/7528967/how-to-grant-mysql-privileges-in-a-bash-script for this 41 | MYSQL=`which mysql` 42 | 43 | Q1="GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY '$1' WITH GRANT OPTION;" 44 | Q2="FLUSH PRIVILEGES;" 45 | SQL="${Q1}${Q2}" 46 | 47 | $MYSQL -uroot -p$1 -e "$SQL" 48 | 49 | service mysql restart 50 | fi 51 | -------------------------------------------------------------------------------- /scripts/neo4j.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing Neo4J" 4 | 5 | # Install prerequisite: Java 6 | # -qq implies -y --force-yes 7 | sudo apt-get update 8 | sudo apt-get install -qq openjdk-7-jre-headless 9 | 10 | # Add the Neo4J key into the apt package manager: 11 | wget -O - http://debian.neo4j.org/neotechnology.gpg.key | apt-key add - 12 | 13 | # Add Neo4J to the Apt sources list: 14 | echo 'deb http://debian.neo4j.org/repo stable/' > /etc/apt/sources.list.d/neo4j.list 15 | 16 | # Update the package manager: 17 | apt-get update 18 | 19 | # Install Neo4J: 20 | apt-get install -qq neo4j 21 | 22 | # Start the server 23 | service neo4j-service restart -------------------------------------------------------------------------------- /scripts/nginx.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Test if PHP is installed 4 | php -v > /dev/null 2>&1 5 | PHP_IS_INSTALLED=$? 6 | 7 | # Test if HHVM is installed 8 | hhvm --version > /dev/null 2>&1 9 | HHVM_IS_INSTALLED=$? 10 | 11 | # If HHVM is installed, assume PHP is *not* 12 | [[ $HHVM_IS_INSTALLED -eq 0 ]] && { PHP_IS_INSTALLED=-1; } 13 | 14 | echo ">>> Installing Nginx" 15 | 16 | [[ -z $1 ]] && { echo "!!! IP address not set. Check the Vagrant file."; exit 1; } 17 | 18 | if [[ -z $2 ]]; then 19 | public_folder="/vagrant" 20 | else 21 | public_folder="$2" 22 | fi 23 | 24 | if [[ -z $3 ]]; then 25 | hostname="" 26 | else 27 | # There is a space, because this will be suffixed 28 | hostname=" $3" 29 | fi 30 | 31 | if [[ -z $4 ]]; then 32 | github_url="https://raw.githubusercontent.com/fideloper/Vaprobash/master" 33 | else 34 | github_url="$4" 35 | fi 36 | 37 | PHP_VERSION=$5 38 | 39 | # Add repo for latest stable nginx 40 | sudo add-apt-repository -y ppa:nginx/stable 41 | 42 | # Update Again 43 | sudo apt-get update 44 | 45 | # Install Nginx 46 | # -qq implies -y --force-yes 47 | sudo apt-get install -qq nginx 48 | 49 | # Turn off sendfile to be more compatible with Windows, which can't use NFS 50 | sed -i 's/sendfile on;/sendfile off;/' /etc/nginx/nginx.conf 51 | 52 | # Set run-as user for PHP5-FPM processes to user/group "vagrant" 53 | # to avoid permission errors from apps writing to files 54 | sed -i "s/user www-data;/user vagrant;/" /etc/nginx/nginx.conf 55 | sed -i "s/# server_names_hash_bucket_size.*/server_names_hash_bucket_size 64;/" /etc/nginx/nginx.conf 56 | 57 | # Add vagrant user to www-data group 58 | usermod -a -G www-data vagrant 59 | 60 | # Nginx enabling and disabling virtual hosts 61 | curl --silent -L $github_url/helpers/ngxen.sh > ngxen 62 | curl --silent -L $github_url/helpers/ngxdis.sh > ngxdis 63 | curl --silent -L $github_url/helpers/ngxcb.sh > ngxcb 64 | sudo chmod guo+x ngxen ngxdis ngxcb 65 | sudo mv ngxen ngxdis ngxcb /usr/local/bin 66 | 67 | # Create Nginx Server Block named "vagrant" and enable it 68 | sudo ngxcb -d $public_folder -s "$1.xip.io$hostname" -e 69 | 70 | # Disable "default" 71 | sudo ngxdis default 72 | 73 | if [[ $HHVM_IS_INSTALLED -ne 0 && $PHP_IS_INSTALLED -eq 0 ]]; then 74 | # PHP-FPM Config for Nginx 75 | sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/${PHP_VERSION}/fpm/php.ini 76 | 77 | sudo service php${PHP_VERSION}-fpm restart 78 | fi 79 | 80 | sudo service nginx restart 81 | -------------------------------------------------------------------------------- /scripts/nodejs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Test if NodeJS is installed 4 | node -v > /dev/null 2>&1 5 | NODE_IS_INSTALLED=$? 6 | 7 | # Contains all arguments that are passed 8 | NODE_ARG=($@) 9 | 10 | # Number of arguments that are given 11 | NUMBER_OF_ARG=${#NODE_ARG[@]} 12 | 13 | # Prepare the variables for installing specific Nodejs version and Global Node Packages 14 | if [[ $NUMBER_OF_ARG -gt 2 ]]; then 15 | # Nodejs version, github url and Global Node Packages are given 16 | NODEJS_VERSION=${NODE_ARG[0]} 17 | GITHUB_URL=${NODE_ARG[1]} 18 | NODE_PACKAGES=${NODE_ARG[@]:2} 19 | elif [[ $NUMBER_OF_ARG -eq 2 ]]; then 20 | # Only Nodejs version and github url are given 21 | NODEJS_VERSION=${NODE_ARG[0]} 22 | GITHUB_URL=${NODE_ARG[1]} 23 | else 24 | # Default Nodejs version when nothing is given 25 | NODEJS_VERSION=latest 26 | GITHUB_URL="https://raw.githubusercontent.com/fideloper/Vaprobash/master" 27 | fi 28 | 29 | # True, if Node is not installed 30 | if [[ $NODE_IS_INSTALLED -ne 0 ]]; then 31 | 32 | echo ">>> Installing Node Version Manager" 33 | 34 | # Install NVM 35 | curl --silent -L $GITHUB_URL/helpers/nvm_install.sh | sh 36 | 37 | # Re-source user profiles 38 | # if they exist 39 | if [[ -f "/home/vagrant/.profile" ]]; then 40 | . /home/vagrant/.profile 41 | fi 42 | 43 | echo ">>> Installing Node.js version $NODEJS_VERSION" 44 | echo " This will also be set as the default node version" 45 | 46 | # If set to latest, get the current node version from the home page 47 | if [[ $NODEJS_VERSION -eq "latest" ]]; then 48 | NODEJS_VERSION="node" 49 | fi 50 | 51 | # Install Node 52 | nvm install $NODEJS_VERSION 53 | 54 | # Set a default node version and start using it 55 | nvm alias default $NODEJS_VERSION 56 | 57 | nvm use default 58 | 59 | fi 60 | 61 | # Install (optional) Global Node Packages 62 | if [[ ! -z $NODE_PACKAGES ]]; then 63 | echo ">>> Start installing Global Node Packages" 64 | 65 | npm install -g ${NODE_PACKAGES[@]} 66 | fi 67 | -------------------------------------------------------------------------------- /scripts/pgsql.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing PostgreSQL" 4 | 5 | [[ -z "$1" ]] && { echo "!!! PostgreSQL root password not set. Check the Vagrant file."; exit 1; } 6 | 7 | # Set some variables 8 | POSTGRE_VERSION=9.4 9 | 10 | # Add PostgreSQL GPG public key 11 | # to get latest stable 12 | wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - 13 | 14 | # Add PostgreSQL Apt repository 15 | # to get latest stable 16 | sudo touch /etc/apt/sources.list.d/pgdg.list 17 | sudo echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list 18 | 19 | # Update Apt repos 20 | sudo apt-get update 21 | 22 | # Install PostgreSQL 23 | # -qq implies -y --force-yes 24 | sudo apt-get install -qq postgresql postgresql-contrib 25 | 26 | 27 | # Configure PostgreSQL 28 | 29 | # Listen for localhost connections 30 | sudo sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" /etc/postgresql/$POSTGRE_VERSION/main/postgresql.conf 31 | 32 | # Identify users via "md5", rather than "ident", allowing us 33 | # to make PG users separate from system users. "md5" lets us 34 | # simply use a password 35 | echo "host all all 0.0.0.0/0 md5" | sudo tee -a /etc/postgresql/$POSTGRE_VERSION/main/pg_hba.conf 36 | sudo service postgresql start 37 | 38 | # Create new superuser "vagrant" 39 | sudo -u postgres createuser -s vagrant 40 | 41 | # Create new user "root" w/ defined password 42 | # Not a superuser, just tied to new db "vagrant" 43 | sudo -u postgres psql -c "CREATE ROLE root LOGIN UNENCRYPTED PASSWORD '$1' NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;" 44 | 45 | # Make sure changes are reflected by restarting 46 | sudo service postgresql restart 47 | -------------------------------------------------------------------------------- /scripts/php.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export LANG=C.UTF-8 4 | 5 | PHP_TIMEZONE=$1 6 | HHVM=$2 7 | PHP_VERSION=$3 8 | 9 | if [[ $HHVM == "true" ]]; then 10 | 11 | echo ">>> Installing HHVM" 12 | 13 | # Get key and add to sources 14 | wget --quiet -O - http://dl.hhvm.com/conf/hhvm.gpg.key | sudo apt-key add - 15 | echo deb http://dl.hhvm.com/ubuntu trusty main | sudo tee /etc/apt/sources.list.d/hhvm.list 16 | 17 | # Update 18 | sudo apt-get update 19 | 20 | # Install HHVM 21 | # -qq implies -y --force-yes 22 | sudo apt-get install -qq hhvm 23 | 24 | # Start on system boot 25 | sudo update-rc.d hhvm defaults 26 | 27 | # Replace PHP with HHVM via symlinking 28 | sudo /usr/bin/update-alternatives --install /usr/bin/php php /usr/bin/hhvm 60 29 | 30 | sudo service hhvm restart 31 | else 32 | echo ">>> Installing PHP $PHP_VERSION" 33 | 34 | sudo add-apt-repository -y ppa:ondrej/php 35 | 36 | sudo apt-key update 37 | sudo apt-get update 38 | 39 | # Install PHP 40 | # -qq implies -y --force-yes 41 | 42 | sudo apt-get install -qq php${PHP_VERSION}-cli php${PHP_VERSION}-fpm php${PHP_VERSION}-mysql php${PHP_VERSION}-pgsql php${PHP_VERSION}-sqlite php${PHP_VERSION}-curl php${PHP_VERSION}-gd php${PHP_VERSION}-gmp php${PHP_VERSION}-mcrypt php${PHP_VERSION}-memcached php${PHP_VERSION}-imagick php${PHP_VERSION}-intl php${PHP_VERSION}-mbstring php${PHP_VERSION}-xml php-xdebug 43 | 44 | # Set PHP FPM to listen on TCP instead of Socket 45 | sudo sed -i "s/listen =.*/listen = 127.0.0.1:9000/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf 46 | 47 | # Set PHP FPM allowed clients IP address 48 | sudo sed -i "s/;listen.allowed_clients/listen.allowed_clients/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf 49 | 50 | # Set run-as user for PHP5-FPM processes to user/group "vagrant" 51 | # to avoid permission errors from apps writing to files 52 | sudo sed -i "s/user = www-data/user = vagrant/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf 53 | sudo sed -i "s/group = www-data/group = vagrant/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf 54 | 55 | sudo sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf 56 | sudo sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf 57 | sudo sed -i "s/listen\.mode.*/listen.mode = 0666/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf 58 | 59 | 60 | # xdebug Config 61 | cat > /etc/php/${PHP_VERSION}/mods-available/xdebug.ini << EOF 62 | zend_extension=xdebug.so 63 | xdebug.remote_enable = 1 64 | xdebug.remote_connect_back = 1 65 | xdebug.remote_port = 9000 66 | xdebug.scream=0 67 | xdebug.cli_color=1 68 | xdebug.show_local_vars=1 69 | 70 | ; var_dump display 71 | xdebug.var_display_max_depth = 5 72 | xdebug.var_display_max_children = 256 73 | xdebug.var_display_max_data = 1024 74 | EOF 75 | 76 | # PHP Error Reporting Config 77 | sudo sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/${PHP_VERSION}/fpm/php.ini 78 | sudo sed -i "s/display_errors = .*/display_errors = On/" /etc/php/${PHP_VERSION}/fpm/php.ini 79 | 80 | # PHP Date Timezone 81 | sudo sed -i "s/;date.timezone =.*/date.timezone = ${PHP_TIMEZONE/\//\\/}/" /etc/php/${PHP_VERSION}/fpm/php.ini 82 | sudo sed -i "s/;date.timezone =.*/date.timezone = ${PHP_TIMEZONE/\//\\/}/" /etc/php/${PHP_VERSION}/cli/php.ini 83 | 84 | sudo service php${PHP_VERSION}-fpm restart 85 | fi 86 | -------------------------------------------------------------------------------- /scripts/rabbitmq.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing RabbitMQ" 4 | 5 | apt-get -y install erlang-nox 6 | wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc 7 | apt-key add rabbitmq-signing-key-public.asc 8 | echo "deb http://www.rabbitmq.com/debian/ testing main" > /etc/apt/sources.list.d/rabbitmq.list 9 | apt-get update 10 | apt-get install -y rabbitmq-server 11 | 12 | rabbitmqctl add_user $1 $2 13 | rabbitmqctl set_permissions -p / $1 ".*" ".*" ".*" 14 | -------------------------------------------------------------------------------- /scripts/redis.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing Redis" 4 | 5 | # Add repository 6 | sudo apt-add-repository ppa:rwky/redis -y 7 | 8 | # Install Redis 9 | # -qq implies -y --force-yes 10 | sudo apt-get install -qq redis-server 11 | 12 | # Redis Configuration 13 | sudo mkdir -p /etc/redis/conf.d 14 | 15 | # transaction journaling - config is written, only enabled if persistence is requested 16 | cat << EOF | sudo tee /etc/redis/conf.d/journaling.conf 17 | appendonly yes 18 | appendfsync everysec 19 | EOF 20 | 21 | # Persistence 22 | if [ ! -z "$1" ]; then 23 | if [ "$1" == "persistent" ]; then 24 | echo ">>> Enabling Redis Persistence" 25 | 26 | # add the config to the redis config includes 27 | if ! cat /etc/redis/redis.conf | grep -q "journaling.conf"; then 28 | sudo echo "include /etc/redis/conf.d/journaling.conf" >> /etc/redis/redis.conf 29 | fi 30 | 31 | # schedule background append rewriting 32 | if ! crontab -l | grep -q "redis-cli bgrewriteaof"; then 33 | line="*/5 * * * * /usr/bin/redis-cli bgrewriteaof > /dev/null 2>&1" 34 | (sudo crontab -l; echo "$line" ) | sudo crontab - 35 | fi 36 | fi # persistent 37 | fi # arg check 38 | 39 | sudo service redis-server restart 40 | -------------------------------------------------------------------------------- /scripts/rethinkdb.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing RethinkDB" 4 | 5 | # Add PPA to server 6 | sudo add-apt-repository -y ppa:rethinkdb/ppa 7 | 8 | # Update 9 | sudo apt-get update 10 | 11 | # Install 12 | # -qq implies -y --force-yes 13 | sudo apt-get install -qq rethinkdb 14 | -------------------------------------------------------------------------------- /scripts/rvm.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Check if RVM is installed 4 | RVM -v > /dev/null 2>&1 5 | RVM_IS_INSTALLED=$? 6 | 7 | # Contains all arguments that are passed 8 | RUBY_ARG=($@) 9 | 10 | # Number of arguments that are given 11 | NUMBER_OF_ARG=${#RUBY_ARG[@]} 12 | 13 | # Prepare the variables for installing specific Ruby version and Gems 14 | if [[ $NUMBER_OF_ARG -gt 1 ]]; then 15 | # Both Ruby version and Gems are given 16 | RUBY_VERSION=${RUBY_ARG[0]} #RUBY_VERSION 17 | RUBY_GEMS=${RUBY_ARG[@]:1} 18 | elif [[ $NUMBER_OF_ARG -eq 1 ]]; then 19 | # Only Ruby version is given 20 | RUBY_VERSION=$RUBY_ARG 21 | else 22 | # Default Ruby version when nothing is given 23 | RUBY_VERSION=latest 24 | fi 25 | 26 | if [[ $RVM_IS_INSTALLED -eq 0 ]]; then 27 | echo ">>> Updating Ruby Version Manager" 28 | rvm get stable --ignore-dotfiles 29 | else 30 | # Import Michal Papis' key to be able to verify the installation 31 | echo ">>> Importing rvm public key" 32 | gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3 33 | 34 | # Install RVM and install Ruby 35 | if [[ $RUBY_VERSION =~ "latest" ]]; then 36 | echo ">>> Installing Ruby Version Manager and installing latest stable Ruby version" 37 | 38 | # Install RVM and install latest stable Ruby version 39 | \curl -sSL https://get.rvm.io | bash -s stable --ruby 40 | else 41 | echo ">>> Installing Ruby Version Manager and installing Ruby version: $1" 42 | 43 | # Install RVM and install selected Ruby version 44 | \curl -sSL https://get.rvm.io | bash -s stable --ruby=$RUBY_VERSION 45 | fi 46 | 47 | # Re-source RVM 48 | . /home/vagrant/.rvm/scripts/rvm 49 | 50 | # Re-source .profile if exists 51 | if [[ -f "/home/vagrant/.profile" ]]; then 52 | . /home/vagrant/.profile 53 | fi 54 | fi 55 | 56 | # Install (optional) Ruby Gems 57 | if [[ ! -z $RUBY_GEMS ]]; then 58 | echo ">>> Start installing Ruby Gems" 59 | 60 | gem install ${RUBY_GEMS[@]} 61 | fi 62 | -------------------------------------------------------------------------------- /scripts/screen.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing Screen" 4 | 5 | # Screen 6 | # -qq implies -y --force-yes 7 | sudo apt-get install -qq screen 8 | sudo touch /home/vagrant/.screenrc 9 | sudo echo -e "startup_message off\ncaption always '%{= dg} %H %{G}%=%?%{d}%-w%?%{r}(%{d}%n %t%? {%u} %?%{r})%{d}%?%+w%?%=%{G} %{B}%M %d %c:%s '" >> /home/vagrant/.screenrc 10 | -------------------------------------------------------------------------------- /scripts/sphinxsearch.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing Sphinx" 4 | 5 | if [[ -z $1 ]]; then 6 | sphinxsearch_version="stable" 7 | else 8 | sphinxsearch_version="$1" 9 | fi 10 | 11 | # Add sphinxsearch repo 12 | sudo add-apt-repository -y ppa:builds/sphinxsearch-$sphinxsearch_version 13 | 14 | # The usual updates 15 | sudo apt-get update 16 | 17 | # Install SphinxSearch 18 | sudo apt-get install -qq sphinxsearch 19 | 20 | # Create a base conf file (Altho we can't make any assumptions about its use) 21 | 22 | # Stop searchd so we can change the config file 23 | searchd --stop 24 | 25 | # Move pid file since searchd will fail to start after reboot 26 | sudo sed -i 's/sphinxsearch\/searchd.pid/searchd.pid/' /etc/sphinxsearch/sphinx.conf 27 | 28 | # Start searchd 29 | searchd -------------------------------------------------------------------------------- /scripts/sqlite.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing SQLite Server" 4 | 5 | # Install SQLite Server 6 | # -qq implies -y --force-yes 7 | sudo apt-get install -qq sqlite 8 | -------------------------------------------------------------------------------- /scripts/supervisord.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing Supervisord" 4 | 5 | # Supervisord 6 | # -qq implies -y --force-yes 7 | sudo apt-get install -qq supervisor 8 | -------------------------------------------------------------------------------- /scripts/symfony.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Installing Symfony" 4 | 5 | # Test if PHP is installed 6 | php -v > /dev/null 2>&1 || { printf "!!! PHP is not installed.\n Installing Symfony aborted!\n"; exit 0; } 7 | 8 | # Test if Composer is installed 9 | composer -v > /dev/null 2>&1 || { printf "!!! Composer is not installed.\n Installing Symfony aborted!\n"; exit 0; } 10 | 11 | # Test if Server IP is set in Vagrantfile 12 | [[ -z "$1" ]] && { printf "!!! IP address not set. Check the Vagrantfile.\n Installing Symfony aborted!\n"; exit 0; } 13 | 14 | # Check if Symfony root is set. If not set use default 15 | if [ -z "$2" ]; then 16 | symfony_root_folder="/vagrant/symfony" 17 | else 18 | symfony_root_folder="$2" 19 | fi 20 | 21 | symfony_public_folder="$symfony_root_folder/web" 22 | 23 | # The host ip is same as guest ip with last octet equal to 1 24 | host_ip=`echo $1 | sed 's/\.[0-9]*$/.1/'` 25 | 26 | # Test if HHVM is installed 27 | hhvm --version > /dev/null 2>&1 28 | HHVM_IS_INSTALLED=$? 29 | 30 | # Test if Apache or Nginx is installed 31 | nginx -v > /dev/null 2>&1 32 | NGINX_IS_INSTALLED=$? 33 | 34 | apache2 -v > /dev/null 2>&1 35 | APACHE_IS_INSTALLED=$? 36 | 37 | # Create Symfony folder if needed 38 | if [ ! -d $symfony_root_folder ]; then 39 | mkdir -p $symfony_root_folder 40 | fi 41 | 42 | if [ ! -f "$symfony_root_folder/composer.json" ]; then 43 | # Create Symfony 44 | if [ $HHVM_IS_INSTALLED -eq 0 ]; then 45 | hhvm /usr/local/bin/composer create-project --prefer-dist symfony/framework-standard-edition $symfony_root_folder 46 | else 47 | composer create-project --prefer-dist symfony/framework-standard-edition $symfony_root_folder 48 | fi 49 | else 50 | # Go to vagrant folder 51 | cd $symfony_root_folder 52 | 53 | # Install Symfony 54 | if [ $HHVM_IS_INSTALLED -eq 0 ]; then 55 | hhvm /usr/local/bin/composer install --prefer-dist 56 | else 57 | composer install --prefer-dist 58 | fi 59 | 60 | # Go to the previous folder 61 | cd - 62 | fi 63 | 64 | sudo chmod -R 775 $symfony_root_folder/app/cache 65 | sudo chmod -R 775 $symfony_root_folder/app/logs 66 | sudo chmod -R 775 $symfony_root_folder/app/console 67 | 68 | sed -i "s/('127.0.0.1', 'fe80::1'/('127.0.0.1', '$host_ip', 'fe80::1'/" $symfony_public_folder/app_dev.php 69 | sed -i "s/'127.0.0.1',$/'127.0.0.1', '$host_ip',/" $symfony_public_folder/config.php 70 | 71 | if [ $NGINX_IS_INSTALLED -eq 0 ]; then 72 | # Change default vhost created 73 | sudo sed -i "s@root /vagrant@root $symfony_public_folder@" /etc/nginx/sites-available/vagrant 74 | sudo service nginx reload 75 | fi 76 | 77 | if [ $APACHE_IS_INSTALLED -eq 0 ]; then 78 | # Find and replace to find public_folder and replace with laravel_public_folder 79 | # Change DocumentRoot 80 | # Change ProxyPassMatch fcgi path 81 | # Change path 82 | sudo sed -i "s@$3@$symfony_public_folder@" /etc/apache2/sites-available/$1.xip.io.conf 83 | 84 | sudo service apache2 reload 85 | fi 86 | -------------------------------------------------------------------------------- /scripts/vim.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ">>> Setting up Vim" 4 | 5 | if [[ -z $1 ]]; then 6 | github_url="https://raw.githubusercontent.com/fideloper/Vaprobash/master" 7 | else 8 | github_url="$1" 9 | fi 10 | 11 | # Create directories needed for some .vimrc settings 12 | mkdir -p /home/vagrant/.vim/backup 13 | mkdir -p /home/vagrant/.vim/swap 14 | 15 | # Install Vundle and set owner of .vim files 16 | git clone https://github.com/gmarik/vundle.git /home/vagrant/.vim/bundle/vundle 17 | sudo chown -R vagrant:vagrant /home/vagrant/.vim 18 | 19 | # Grab .vimrc and set owner 20 | curl --silent -L $github_url/helpers/vimrc > /home/vagrant/.vimrc 21 | sudo chown vagrant:vagrant /home/vagrant/.vimrc 22 | 23 | # Install Vundle Bundles 24 | sudo su - vagrant -c 'vim +BundleInstall +qall' 25 | -------------------------------------------------------------------------------- /scripts/zeromq.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | PHP_VERSION=$1 4 | 5 | # Test if PHP is installed 6 | php -v > /dev/null 2>&1 7 | PHP_IS_INSTALLED=$? 8 | 9 | [[ $PHP_IS_INSTALLED -ne 0 ]] && { printf "!!! PHP is not installed.\n Installing ØMQ aborted!\n"; exit 0; } 10 | 11 | echo ">>> Installing ØMQ" 12 | 13 | sudo add-apt-repository -qq pp:chris-lea/zeromq 14 | sudo apt-get update -qq 15 | sudo apt-get install -qq libtool autoconf automake uuid uuid-dev uuid-runtime build-essential php5-dev pkg-config libzmq3-dbg libzmq3-dev libzmq3 16 | 17 | echo "" | sudo pecl install zmq-beta > /dev/null 18 | 19 | sudo echo "extension=zmq.so" >> /etc/php/${PHP_VERSION}/mods-available/zmq.ini 20 | sudo phpenmod zmq > /dev/null 21 | sudo service php${PHP_VERSION}-fpm restart > /dev/null 22 | 23 | -------------------------------------------------------------------------------- /test.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | for file in $(find ./scripts -name '*.sh'); do 4 | bash -n $file 5 | done 6 | 7 | --------------------------------------------------------------------------------