Skip to content

Commit

Permalink
First configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaudioCorridore committed Nov 2, 2014
1 parent 7a08ddd commit 26b9c0e
Show file tree
Hide file tree
Showing 19 changed files with 760 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
223 changes: 223 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

dir = Dir.pwd
vagrant_dir = File.expand_path(File.dirname(__FILE__))

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.

# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "ubuntu/trusty64"
config.vm.hostname = "teslabox.dev"

# Local Machine Hosts
#
# If the Vagrant plugin hostsupdater (https://github.com/cogitatio/vagrant-hostsupdater) is
# installed, the following will automatically configure your local machine's hosts file to
# be aware of the domains specified below. Watch the provisioning script as you may be
# required to enter a password for Vagrant to access your hosts file.

if defined? VagrantPlugins::HostsUpdater

# Capture the paths to all vvv-hosts files under the www/ directory.
paths = []
Dir.glob(vagrant_dir + '/www/**/tesla-hosts').each do |path|
paths << path
end

# Parse through the vvv-hosts files in each of the found paths and put the hosts
# that are found into a single array.
hosts = []
paths.each do |path|
new_hosts = []
file_hosts = IO.read(path).split( "\n" )
file_hosts.each do |line|
if line[0..0] != "#"
new_hosts << line
end
end
hosts.concat new_hosts
end

# Pass the final hosts array to the hostsupdate plugin so it can perform magic.
config.hostsupdater.aliases = hosts

end

# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false

# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
config.vm.network "forwarded_port", guest: 80, host: 4280

# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network "private_network", ip: "192.168.33.10"

# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"

# If true, then any SSH connections made will enable agent forwarding.
# Default value: false
# config.ssh.forward_agent = true

# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
config.vm.synced_folder "config/", "/srv/config"
config.vm.synced_folder "log/", "/srv/log", :owner => "www-data"
config.vm.synced_folder "www/", "/srv/www/", :owner => "www-data", :mount_options => [ "dmode=775", "fmode=774" ]


# Provisioning
#
# Process one or more provisioning scripts depending on the existence of custom files.
#
# provison-pre.sh acts as a pre-hook to our default provisioning script. Anything that
# should run before the shell commands laid out in provision.sh (or your provision-custom.sh
# file) should go in this script. If it does not exist, no extra provisioning will run.
if File.exists?(File.join(vagrant_dir,'provision','provision-pre.sh')) then
config.vm.provision :shell, :path => File.join( "provision", "provision-pre.sh" )
end

# provision.sh or provision-custom.sh
#
# By default, Vagrantfile is set to use the provision.sh bash script located in the
# provision directory. If it is detected that a provision-custom.sh script has been
# created, that is run as a replacement. This is an opportunity to replace the entirety
# of the provisioning provided by default.
if File.exists?(File.join(vagrant_dir,'provision','provision-custom.sh')) then
config.vm.provision :shell, :path => File.join( "provision", "provision-custom.sh" )
else
config.vm.provision :shell, :path => File.join( "provision", "provision.sh" )
end

# provision-post.sh acts as a post-hook to the default provisioning. Anything that should
# run after the shell commands laid out in provision.sh or provision-custom.sh should be
# put into this file. This provides a good opportunity to install additional packages
# without having to replace the entire default provisioning script.
if File.exists?(File.join(vagrant_dir,'provision','provision-post.sh')) then
config.vm.provision :shell, :path => File.join( "provision", "provision-post.sh" )
end

# Always start MySQL on boot, even when not running the full provisioner
# (run: "always" support added in 1.6.0)
# if vagrant_version >= "1.6.0"
# config.vm.provision :shell, inline: "sudo service mysql restart", run: "always"
# end

# Vagrant Triggers
#
# If the vagrant-triggers plugin is installed, we can run various scripts on Vagrant
# state changes like `vagrant up`, `vagrant halt`, `vagrant suspend`, and `vagrant destroy`
#
# These scripts are run on the host machine, so we use `vagrant ssh` to tunnel back
# into the VM and execute things. By default, each of these scripts calls db_backup
# to create backups of all current databases. This can be overridden with custom
# scripting. See the individual files in config/homebin/ for details.

# if defined? VagrantPlugins::Triggers
# config.trigger.before :halt, :stdout => true do
# run "vagrant ssh -c 'vagrant_halt'"
# end
# config.trigger.before :suspend, :stdout => true do
# run "vagrant ssh -c 'vagrant_suspend'"
# end
# config.trigger.before :destroy, :stdout => true do
# run "vagrant ssh -c 'vagrant_destroy'"
# end
# end

# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Don't boot with headless mode
# vb.gui = true
#
# # Use VBoxManage to customize the VM. For example to change memory:
# vb.customize ["modifyvm", :id, "--memory", "1024"]
# end
#
# View the documentation for the provider you're using for more
# information on available options.

# Enable provisioning with CFEngine. CFEngine Community packages are
# automatically installed. For example, configure the host as a
# policy server and optionally a policy file to run:
#
# config.vm.provision "cfengine" do |cf|
# cf.am_policy_hub = true
# # cf.run_file = "motd.cf"
# end
#
# You can also configure and bootstrap a client to an existing
# policy server:
#
# config.vm.provision "cfengine" do |cf|
# cf.policy_server_address = "10.0.2.15"
# end

# Enable provisioning with Puppet stand alone. Puppet manifests
# are contained in a directory path relative to this Vagrantfile.
# You will need to create the manifests directory and a manifest in
# the file default.pp in the manifests_path directory.
#
# config.vm.provision "puppet" do |puppet|
# puppet.manifests_path = "manifests"
# puppet.manifest_file = "site.pp"
# end

# Enable provisioning with chef solo, specifying a cookbooks path, roles
# path, and data_bags path (all relative to this Vagrantfile), and adding
# some recipes and/or roles.
#
# config.vm.provision "chef_solo" do |chef|
# chef.cookbooks_path = "../my-recipes/cookbooks"
# chef.roles_path = "../my-recipes/roles"
# chef.data_bags_path = "../my-recipes/data_bags"
# chef.add_recipe "mysql"
# chef.add_role "web"
#
# # You may also specify custom JSON attributes:
# chef.json = { :mysql_password => "foo" }
# end

# Enable provisioning with chef server, specifying the chef server URL,
# and the path to the validation key (relative to this Vagrantfile).
#
# The Opscode Platform uses HTTPS. Substitute your organization for
# ORGNAME in the URL and validation key.
#
# If you have your own Chef Server, use the appropriate URL, which may be
# HTTP instead of HTTPS depending on your configuration. Also change the
# validation key to validation.pem.
#
# config.vm.provision "chef_client" do |chef|
# chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
# chef.validation_key_path = "ORGNAME-validator.pem"
# end
#
# If you're using the Opscode platform, your validator client is
# ORGNAME-validator, replacing ORGNAME with your organization name.
#
# If you have your own Chef Server, the default validation client name is
# chef-validator, unless you changed the configuration.
#
# chef.validation_client_name = "ORGNAME-validator"
end
Binary file added config/.DS_Store
Binary file not shown.
6 changes: 6 additions & 0 deletions config/apt-source-append.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Additional sources will be added here to help control the
# versions of various packages that are installed

# Provides Nginx stable
deb http://nginx.org/packages/ubuntu/ trusty nginx
deb-src http://nginx.org/packages/ubuntu/ trusty nginx
Binary file added config/homebin/.DS_Store
Binary file not shown.
14 changes: 14 additions & 0 deletions config/homebin/vagrant_destroy
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
#
# This script is run whenever `vagrant destroy` is used to destroy
# the virtual machine. To customize this behavior, include a file
# in your local VVV/config/homebin directory: vagrant_destroy_custom
#
# Look for a custom trigger file. If this exists, we'll assume that
# all trigger actions should be handled by this custom script. If
# it does not exist, then we'll handle some basic tasks.
if [[ -f /home/vagrant/bin/vagrant_destroy_custom ]]; then
vagrant_destroy_custom
else
echo "Vagrant destory"
fi
14 changes: 14 additions & 0 deletions config/homebin/vagrant_halt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
#
# This script is run whenever `vagrant halt` is used to power off
# the virtual machine. To customize this behavior, include a file
# in your local VVV/config/homebin directory: vagrant_halt_custom
#
# Look for a custom trigger file. If this exists, we'll assume that
# all trigger actions should be handled by this custom script. If
# it does not exist, then we'll handle some basic tasks.
if [[ -f /home/vagrant/bin/vagrant_halt_custom ]]; then
vagrant_halt_custom
else
"Vagrant halt"
fi
14 changes: 14 additions & 0 deletions config/homebin/vagrant_suspend
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
#
# This script is run whenever `vagrant suspend` is used to suspend
# the virtual machine. To customize this behavior, include a file
# in your local VVV/config/homebin directory: vagrant_suspend_custom
#
# Look for a custom trigger file. If this exists, we'll assume that
# all trigger actions should be handled by this custom script. If
# it does not exist, then we'll handle some basic tasks.
if [[ -f /home/vagrant/bin/vagrant_suspend_custom ]]; then
vagrant_suspend_custom
else
"Vagrant suspend"
fi
Binary file added config/init/.DS_Store
Binary file not shown.
10 changes: 10 additions & 0 deletions config/init/tesla-start.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# varying-vagrant-vagrants - necessary services at start

description "necessary services for Varying Vagrant Vagrants"

start on runlevel [2345]

script
service nginx start
service memcached start
end script
49 changes: 49 additions & 0 deletions config/memcached-config/memcached.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# memcached.conf
#
# Varying Vagrant Vagrant's modification of the default memcached config
#
# Original config - 2003 - Jay Bonci <jaybonci@debian.org>
# This configuration file is read by the start-memcached script provided as
# part of the Debian GNU/Linux distribution.

# Run memcached as a daemon. This command is implied, and is not needed for the
# daemon to run. See the README.Debian that comes with this package for more
# information.
-d

# Log memcached's output to /var/log/memcached
logfile /var/log/memcached.log

# Be verbose
# -v

# Be even more verbose (print client commands as well)
# -vv

# Memcached starts with a 64M cap by default. We replace with 128M to aid in testing
# large sites that like the space.
-m 128

# Default connection port is 11211
-p 11211

# Run the daemon as root. The start-memcached will default to running as root if no
# -u command is present in this config file
-u memcache

# Specify which IP address to listen on. The default is to listen on all IP addresses
# This parameter is one of the only security measures that memcached has, so make sure
# it's listening on a firewalled interface.
-l 127.0.0.1

# Limit the number of simultaneous incoming connections. The daemon default is 1024
# -c 1024

# Lock down all paged memory. Consult with the README and homepage before you do this
# -k

# Return error when memory is exhausted (rather than removing items)
# -M

# Maximize core file limit
# -r
Binary file added config/nginx-config/.DS_Store
Binary file not shown.
Loading

0 comments on commit 26b9c0e

Please sign in to comment.