Advertisement
Guest User

Untitled

a guest
Feb 5th, 2018
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.95 KB | None | 0 0
  1. # -*- mode: ruby -*-
  2. # vi: set ft=ruby :
  3.  
  4. # Config Github Settings
  5. github_username = "whatwedo"
  6. github_repo = "Vaprobash"
  7. github_branch = "develop"
  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 = "3bc505abbc3c69a1167e8b849b37a75773192640"
  13.  
  14. # Server Configuration
  15. hostname = "test.dev"
  16. start_dir = "/vagrant"
  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.  
  26. # Calculate system resources
  27. # Default: all CPU cores, an eighth of available RAM as memory and swap size
  28. host = RbConfig::CONFIG['host_os']
  29. if host =~ /darwin/
  30. server_cpus = `sysctl -n hw.ncpu`.to_i
  31. server_memory = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 8
  32. elsif host =~ /linux/
  33. server_cpus = `nproc`.to_i
  34. server_memory = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 8
  35. else # sorry Windows folks, I can't help you
  36. server_cpus = 1
  37. server_memory = 512
  38. end
  39. server_swap = server_memory
  40.  
  41. # Manual resource setting
  42. # Overrides calculation
  43. # server_cpus = "1" # Cores
  44. # server_memory = "384" # MB
  45. # server_swap = "768" # Options: false | int (MB) - Guideline: Between one or two times the server_memory
  46.  
  47. # UTC for Universal Coordinated Time
  48. # EST for Eastern Standard Time
  49. # CET for Central European Time
  50. # US/Central for American Central
  51. # US/Eastern for American Eastern
  52. server_timezone = "Europe/Zurich"
  53.  
  54. # Database Configuration
  55. mysql_root_password = "root" # We'll assume user "root"
  56. mysql_version = "5.6" # Options: 5.5 | 5.6
  57. mysql_enable_remote = "true" # remote access enabled when true
  58. pgsql_root_password = "root" # We'll assume user "root"
  59. mongo_version = "2.6" # Options: 2.6 | 3.0
  60. mongo_enable_remote = "false" # remote access enabled when true
  61.  
  62. # Languages and Packages
  63. php_timezone = server_timezone # http://php.net/manual/en/timezones.php
  64. php_version = "7.0" # Options: 5.5 | 5.6 | 7.0
  65. ruby_version = "2.4" # Choose what ruby version should be installed (will also be the default version)
  66. ruby_gems = [ # List any Ruby Gems that you want to install
  67. #"jekyll",
  68. #"sass",
  69. #"compass",
  70. ]
  71.  
  72. go_version = "latest" # Example: go1.4 (latest equals the latest stable version)
  73.  
  74. # To install HHVM instead of PHP, set this to "true"
  75. hhvm = "false"
  76.  
  77. # PHP Options
  78. composer_packages = [ # List any global Composer packages that you want to install
  79. #"phpunit/phpunit:4.0.*",
  80. #"codeception/codeception=*",
  81. #"phpspec/phpspec:2.0.*@dev",
  82. #"squizlabs/php_codesniffer:1.5.*",
  83. ]
  84.  
  85. # Default web server document root
  86. # Symfony's public directory is assumed "web"
  87. # Laravel's public directory is assumed "public"
  88. public_folder = "/vagrant/web"
  89.  
  90. laravel_root_folder = "/vagrant/laravel" # Where to install Laravel. Will `composer install` if a composer.json file exists
  91. laravel_version = "latest-stable" # If you need a specific version of Laravel, set it here
  92. symfony_root_folder = "/vagrant/symfony" # Where to install Symfony.
  93.  
  94. nodejs_version = "6.5" # By default "latest" will equal the latest stable version
  95. nodejs_packages = [ # List any global NodeJS packages that you want to install
  96. #"grunt-cli",
  97. #"gulp",
  98. #"bower",
  99. #"yo",
  100. ]
  101.  
  102. # RabbitMQ settings
  103. rabbitmq_user = "user"
  104. rabbitmq_password = "password"
  105.  
  106. sphinxsearch_version = "rel22" # rel20, rel21, rel22, beta, daily, stable
  107.  
  108. elasticsearch_version = "1.7.4" # 2.1.1, 2.0.2, 1.7.4
  109.  
  110. # SSH public key
  111. ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_rsa.pub").first.strip
  112.  
  113. Vagrant.configure("2") do |config|
  114.  
  115. # Set server to Ubuntu 14.04
  116. config.vm.box = "ubuntu/trusty64"
  117.  
  118. config.vm.define "Vaprobash" do |vapro|
  119. end
  120.  
  121. if Vagrant.has_plugin?("vagrant-hostmanager")
  122. config.hostmanager.enabled = true
  123. config.hostmanager.manage_host = true
  124. config.hostmanager.ignore_private_ip = false
  125. config.hostmanager.include_offline = false
  126. else
  127. warn "The recommeded plugin 'vagrant-hostmanager' is currently not installed. You can install it by executing: 'vagrant plugin install vagrant-hostmanager'"
  128. end
  129.  
  130. # Create a hostname, don't forget to put it to the `hosts` file
  131. # This will point to the server's default virtual host
  132. # TO DO: Make this work with virtualhost along-side xip.io URL
  133. config.vm.hostname = hostname
  134.  
  135. # Configure network
  136. if Vagrant.has_plugin?("vagrant-auto_network")
  137. config.vm.network :private_network, :ip => "0.0.0.0", :auto_network => true
  138. else
  139. warn "The recommeded plugin 'vagrant-auto_network' is currently not installed. You can install it by executing: 'vagrant plugin install vagrant-auto_network'"
  140. config.vm.network :private_network, ip: server_ip
  141. end
  142.  
  143. # Create a forwarded port mapping which allows access to a specific port
  144. # within the machine from a port on the host machine. In the example below,
  145. # accessing "localhost:8080" will access port 80 on the guest machine.
  146. # config.vm.network "forwarded_port", guest: 80, host: 8080
  147.  
  148. # Enable agent forwarding over SSH connections
  149. config.ssh.forward_agent = true
  150.  
  151. # Use NFS for the shared folder
  152. config.vm.synced_folder ".", "/vagrant",
  153. id: "core",
  154. :nfs => true,
  155. :mount_options => ['nolock,vers=3,udp,noatime,actimeo=2,fsc']
  156.  
  157. # Replicate local .gitconfig file if it exists
  158. if File.file?(File.expand_path("~/.gitconfig"))
  159. config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig"
  160. end
  161.  
  162. # Add SSH public key to authorized_keys
  163. config.vm.provision "shell" do |s|
  164. s.inline = <<-SHELL
  165. echo #{ssh_pub_key} >> /home/vagrant/.ssh/authorized_keys
  166. echo #{ssh_pub_key} >> /root/.ssh/authorized_keys
  167. SHELL
  168. end
  169.  
  170. # If using VirtualBox
  171. config.vm.provider :virtualbox do |vb|
  172.  
  173. vb.name = hostname
  174.  
  175. # Set server cpus
  176. vb.customize ["modifyvm", :id, "--cpus", server_cpus]
  177.  
  178. # Set server memory
  179. vb.customize ["modifyvm", :id, "--memory", server_memory]
  180.  
  181. # Set the timesync threshold to 10 seconds, instead of the default 20 minutes.
  182. # If the clock gets more than 15 minutes out of sync (due to your laptop going
  183. # to sleep for instance, then some 3rd party services will reject requests.
  184. vb.customize ["guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000]
  185.  
  186. # Allow symlinks inside shared folders
  187. vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
  188.  
  189. # Prevent VMs running on Ubuntu to lose internet connection
  190. # vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
  191. # vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
  192.  
  193. # Share VPN connection from host to guest
  194. # vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
  195.  
  196. # Automatically update VirtualBox Guest Additions
  197. if Vagrant.has_plugin?("vagrant-vbguest")
  198. # set auto_update to false, if you do NOT want to check the correct
  199. # additions version when booting this machine
  200. config.vbguest.auto_update = true
  201. else
  202. warn "The recommeded plugin 'vagrant-vbguest' is currently not installed. You can install it by executing: 'vagrant plugin install vagrant-vbguest'"
  203. end
  204.  
  205. end
  206.  
  207. # If using VMWare Fusion
  208. config.vm.provider "vmware_fusion" do |vb, override|
  209. override.vm.box_url = "http://files.vagrantup.com/precise64_vmware.box"
  210.  
  211. # Set server memory
  212. vb.vmx["memsize"] = server_memory
  213.  
  214. end
  215.  
  216. # Adding vagrant-digitalocean provider - https://github.com/smdahlen/vagrant-digitalocean
  217. # Needs to ensure that the vagrant plugin is installed
  218. config.vm.provider :digital_ocean do |provider, override|
  219. override.ssh.private_key_path = '~/.ssh/id_rsa'
  220. override.ssh.username = 'vagrant'
  221. override.vm.box = 'digital_ocean'
  222. override.vm.box_url = "https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box"
  223.  
  224. provider.token = 'YOUR TOKEN'
  225. provider.image = 'ubuntu-14-04-x64'
  226. provider.region = 'nyc2'
  227. provider.size = '512mb'
  228. end
  229.  
  230. ####
  231. # Base Items
  232. ##########
  233.  
  234. # Provision Base Packages
  235. config.vm.provision "shell", path: "#{github_url}/scripts/base.sh", args: [github_url, server_swap, server_timezone, start_dir]
  236.  
  237. # optimize base box
  238. config.vm.provision "shell", path: "#{github_url}/scripts/base_box_optimizations.sh", privileged: true
  239.  
  240. # Provision PHP
  241. config.vm.provision "shell", path: "#{github_url}/scripts/php.sh", args: [php_timezone, hhvm, php_version]
  242.  
  243. # Enable MSSQL for PHP
  244. # config.vm.provision "shell", path: "#{github_url}/scripts/mssql.sh"
  245.  
  246. # Provision Vim
  247. # config.vm.provision "shell", path: "#{github_url}/scripts/vim.sh", args: github_url
  248.  
  249. # Provision Docker
  250. config.vm.provision "shell", path: "#{github_url}/scripts/docker.sh", args: "permissions"
  251.  
  252. # Provision docker-compose
  253. config.vm.provision "shell", path: "#{github_url}/scripts/docker-compose.sh"
  254.  
  255.  
  256. ####
  257. # Web Servers
  258. ##########
  259.  
  260. # Provision Apache Base
  261. config.vm.provision "shell", path: "#{github_url}/scripts/apache.sh", args: [server_ip, public_folder, hostname, github_url]
  262.  
  263. # Provision Nginx Base
  264. # config.vm.provision "shell", path: "#{github_url}/scripts/nginx.sh", args: [server_ip, public_folder, hostname, github_url]
  265.  
  266.  
  267. ####
  268. # Databases
  269. ##########
  270.  
  271. # Provision MySQL
  272. # config.vm.provision "shell", path: "#{github_url}/scripts/mysql.sh", args: [mysql_root_password, mysql_version, mysql_enable_remote]
  273.  
  274. # Provision PostgreSQL
  275. # config.vm.provision "shell", path: "#{github_url}/scripts/pgsql.sh", args: pgsql_root_password
  276.  
  277. # Provision SQLite
  278. # config.vm.provision "shell", path: "#{github_url}/scripts/sqlite.sh"
  279.  
  280. # Provision RethinkDB
  281. # config.vm.provision "shell", path: "#{github_url}/scripts/rethinkdb.sh", args: pgsql_root_password
  282.  
  283. # Provision Couchbase
  284. # config.vm.provision "shell", path: "#{github_url}/scripts/couchbase.sh"
  285.  
  286. # Provision CouchDB
  287. # config.vm.provision "shell", path: "#{github_url}/scripts/couchdb.sh"
  288.  
  289. # Provision MongoDB
  290. # config.vm.provision "shell", path: "#{github_url}/scripts/mongodb.sh", args: [mongo_enable_remote, mongo_version]
  291.  
  292. # Provision MariaDB
  293. config.vm.provision "shell", path: "#{github_url}/scripts/mariadb.sh", args: [mysql_root_password, mysql_enable_remote]
  294.  
  295. # Provision Neo4J
  296. # config.vm.provision "shell", path: "#{github_url}/scripts/neo4j.sh"
  297.  
  298.  
  299. ####
  300. # Search Servers
  301. ##########
  302.  
  303. # Install Elasticsearch
  304. config.vm.provision "shell", path: "#{github_url}/scripts/elasticsearch.sh", args: [elasticsearch_version]
  305.  
  306. # Install SphinxSearch
  307. # config.vm.provision "shell", path: "#{github_url}/scripts/sphinxsearch.sh", args: [sphinxsearch_version]
  308.  
  309. ####
  310. # Search Server Administration (web-based)
  311. ##########
  312.  
  313. # Install ElasticHQ
  314. # Admin for: Elasticsearch
  315. # Works on: Apache2, Nginx
  316. # config.vm.provision "shell", path: "#{github_url}/scripts/elastichq.sh"
  317.  
  318.  
  319. ####
  320. # In-Memory Stores
  321. ##########
  322.  
  323. # Install Memcached
  324. config.vm.provision "shell", path: "#{github_url}/scripts/memcached.sh"
  325.  
  326. # Provision Redis (without journaling and persistence)
  327. # config.vm.provision "shell", path: "#{github_url}/scripts/redis.sh"
  328.  
  329. # Provision Redis (with journaling and persistence)
  330. config.vm.provision "shell", path: "#{github_url}/scripts/redis.sh", args: "persistent"
  331. # NOTE: It is safe to run this to add persistence even if originally provisioned without persistence
  332.  
  333.  
  334. ####
  335. # Utility (queue)
  336. ##########
  337.  
  338. # Install Beanstalkd
  339. # config.vm.provision "shell", path: "#{github_url}/scripts/beanstalkd.sh"
  340.  
  341. # Install Heroku Toolbelt
  342. # config.vm.provision "shell", path: "https://toolbelt.heroku.com/install-ubuntu.sh"
  343.  
  344. # Install Supervisord
  345. # config.vm.provision "shell", path: "#{github_url}/scripts/supervisord.sh"
  346.  
  347. # Install Kibana
  348. # config.vm.provision "shell", path: "#{github_url}/scripts/kibana.sh"
  349.  
  350. # Install ØMQ
  351. # config.vm.provision "shell", path: "#{github_url}/scripts/zeromq.sh"
  352.  
  353. # Install RabbitMQ
  354. # config.vm.provision "shell", path: "#{github_url}/scripts/rabbitmq.sh", args: [rabbitmq_user, rabbitmq_password]
  355.  
  356.  
  357. ####
  358. # Additional Languages
  359. ##########
  360.  
  361. # Install Nodejs
  362. config.vm.provision "shell", path: "#{github_url}/scripts/nodejs.sh", privileged: false, args: nodejs_packages.unshift(nodejs_version, github_url)
  363.  
  364. # Install Ruby Version Manager (RVM)
  365. config.vm.provision "shell", path: "#{github_url}/scripts/rvm.sh", privileged: false, args: ruby_gems.unshift(ruby_version)
  366.  
  367. # Install Go Version Manager (GVM)
  368. # config.vm.provision "shell", path: "#{github_url}/scripts/go.sh", privileged: false, args: [go_version]
  369.  
  370. # Install Oracle Java 8
  371. # config.vm.provision "shell", path: "#{github_url}/scripts/oracle-java.sh"
  372.  
  373.  
  374. ####
  375. # Frameworks and Tooling
  376. ##########
  377.  
  378. # Provision Composer
  379. # You may pass a github auth token as the first argument
  380. config.vm.provision "shell", path: "#{github_url}/scripts/composer.sh", privileged: false, args: [github_pat, composer_packages.join(" ")]
  381.  
  382. # Provision Laravel
  383. # config.vm.provision "shell", path: "#{github_url}/scripts/laravel.sh", privileged: false, args: [server_ip, laravel_root_folder, public_folder, laravel_version]
  384.  
  385. # Provision Symfony
  386. # config.vm.provision "shell", path: "#{github_url}/scripts/symfony.sh", privileged: false, args: [server_ip, symfony_root_folder, public_folder]
  387.  
  388. # Install Screen
  389. # config.vm.provision "shell", path: "#{github_url}/scripts/screen.sh"
  390.  
  391. # Install Mailcatcher
  392. config.vm.provision "shell", path: "#{github_url}/scripts/mailcatcher.sh"
  393.  
  394. # Install git-ftp
  395. # config.vm.provision "shell", path: "#{github_url}/scripts/git-ftp.sh", privileged: false
  396.  
  397. # Install Ansible
  398. # config.vm.provision "shell", path: "#{github_url}/scripts/ansible.sh"
  399.  
  400. # Install Android
  401. # config.vm.provision "shell", path: "#{github_url}/scripts/android.sh"
  402.  
  403. # Install Maven
  404. # config.vm.provision "shell", path: "#{github_url}/scripts/maven.sh"
  405.  
  406. # Install M4
  407. # config.vm.provision "shell", path: "#{github_url}/scripts/m4.sh"
  408.  
  409. # Install Puppet Client
  410. # config.vm.provision "shell", path: "#{github_url}/scripts/puppet-client.sh"
  411.  
  412. # Install wkhtml2pdf
  413. config.vm.provision "shell", path: "#{github_url}/scripts/wkhtmltopdf.sh"
  414.  
  415. # Install tutum-cli
  416. # config.vm.provision "shell", path: "#{github_url}/scripts/tutum-cli.sh"
  417.  
  418. # Install phpMyAdmin
  419. # config.vm.provision "shell", path: "#{github_url}/scripts/phpmyadmin.sh", args: [mysql_root_password]
  420.  
  421. # Install docker-nuke
  422. # config.vm.provision "shell", path: "#{github_url}/scripts/docker-nuke.sh"
  423.  
  424.  
  425. ####
  426. # Customization
  427. ##########
  428.  
  429. # Corporate settings
  430. config.vm.provision "shell", path: "#{github_url}/scripts/whatwedo.sh"
  431.  
  432.  
  433. ####
  434. # Local Scripts
  435. # Any local scripts you may want to run post-provisioning.
  436. # Add these to the same directory as the Vagrantfile.
  437. ##########
  438. config.vm.provision "shell", path: "./vm-init.sh"
  439.  
  440.  
  441. ####
  442. # System restart
  443. # Restart VM after provisioning
  444. ##########
  445. if Vagrant.has_plugin?("vagrant-reload")
  446. config.vm.provision :reload
  447. else
  448. warn "The recommeded plugin 'vagrant-reload' is currently not installed. You can install it by executing: 'vagrant plugin install vagrant-reload'"
  449. end
  450.  
  451.  
  452. ####
  453. # Cleaning up
  454. ##########
  455.  
  456. # Basic cleaning up task
  457. config.vm.provision "shell", path: "#{github_url}/scripts/cleanup.sh"
  458.  
  459.  
  460. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement