Chef project used to configure and update ubuntu server.
- Change hostname to match default site name (one site/one server)
- Update server packages
-
Install packages required by project(s) environment.
- build-essential: Package necessary to install Ruby and most of necessary elements.
- vim-nox: Prefered version of vim to replace default installed on Ubuntu server.
- bash-completion: Better completion for bash.
- multitail: Package allowing to “tail” multiple files at the same time.
- htop: Better service monitoring.
- multitee: Send multiple inputs to multiple outputs (Is it useful?).
- nmap: Network Mapper (Useful but is it used?).
- cURL: Command line tool for getting or sending files using URL syntax.
- tree: Package allowing to display directory tree view.
- telnet: Command used for interactive communication with another host using the TELNET protocol.
- unzip: Package allowing to decompress zip files.
- wget: Network utility to retrieve files from the Web using http(s) and ftp, the two most widely used Internet protocols.
- ack-grep: Tool allowing to search information into files.
- default-jre: Java open package.
- libxml2: Library allowing to manage XML files.
- libxml2-dev: Development library for libxml2.
- libjpeg-turbo8: IJG JPEG compliant runtime library
- libjpeg-turbo8-dev: Development library for libjpeg-turbo8.
- libpng12-0: PNG library - runtime.
- libpng12-dev: Development library for libpng12-0.
- libjasper1: JasPer JPEG-2000 runtime library.
- libjasper-dev: Development library for libjasper1.
- libltdl7-dev: A system independent dlopen wrapper for GNU libtool.
- libssl-dev: OpenSSL library.
- libcurl4-openssl-dev: Development files and documentation for libcurl (OpenSSL).
- libexpat1-dev: Development library for XML parsing C library.
- libfreeimage-dev: Support library for graphics image formats (development files).
- gettext: GNU Internationalization utilities.
- ruby-dev: Header files for compiling extension modules for Ruby (default version - Ruby 1.9.3-p194)
- ghostscript: interpreter for the PostScript language and for PDF.
-
Install ImageMagick from source, library allowing to create and manipulate images.
- bashrc: Configuration file for bash.
- vimrc: Configuration file for Vim.
- irbrc: Configuration file for IRB.
- gemrc: Configuration file for Gem.
- gitconfig: Default Git configuration file.
- environment: Default environment settings file (/etc/environment).
- Install Ntpdate package.
- Set Ntpdate cronjob
- Install Postfix package.
- Configure Postfix settings
- Install ProFTPd.
- Configure ProFTPd.
- Setup Git.
- Install Fail2Ban from package.
- Setup configuration files.
- Install Memcache from package.
- Setup memcache configuration file.
- Install Redis from package.
- Install MySQL database from package.
- Configure MySQL database.
- Install Apache2 from package.
- Install needed Apache2 modules:
- mod_xsendfile (xsendfile): A small Apache2 module that processes X-SENDFILE headers registered by the original output handler.
- proxy_http: Apache2 http proxy module.
- mod_rewrite (rewrite): Apache2 module allowing to rewrite URL.
- mod_proxy (proxy): Apache2 proxy module.
- expires
- headers
- proxy_balancer
- Prepare Vagrant VM by uploading necessary elements (Chef version and cookbooks)
- knife solo prepare -N <node_name> -i ~/.vagrant.d/insecure_private_key -p 2222 vagrant@127.0.0.1
- Vagrant must be downloaded from official website
- Vagrant must be downloaded from official website
- The project is using Berkshelf to manage it’s dependencies (cookbooks) and directories so the Berkshelf ruby gem must be installed on the machine by following the indication of the official website
- Boxes can be downloaded from Vagrant list of availables boxes http://www.vagrantbox.es/ or created using tools allowing to create boxes from original ISO file (ex: bento, packer, vanilla-boxes, veewee, etc…).
-
Used to manage virtual machine default settings and can be used to bootstrap project (unless user wants the project to be managed manually the way a real server could be.).
-
Due to some trouble loading VM Guest Additions with Ubuntu some lines could be added to the Vagrantfile:
# Custom for Virtualbox Guest Additions
class HackyGuestAdditionsInstaller < VagrantVbguest::Installers::Ubuntu
def install(opts=nil, &block)
super
super_garbage_hack = <<-EOF
if [ ! -e /usr/lib/VBoxGuestAdditions ]; then
sudo ln -s /opt/VBoxGuestAdditions-4.3.12/lib/VBoxGuestAdditions \
/usr/lib/VBoxGuestAdditions || true
fi
EOF
communicate.sudo(super_garbage_hack)
end
end
# Custom
-
And a vagrant plugin should be installed by using the following command:
vagrant plugin install <plugin_name>
- vagrant-vbguest
-
If project must managed by Vagrant some more settings should be done:
- Installing some useful Vagrant plugins:
- chef
- vagrant-omnibus
- Configuring Chef project settings in the Vagrantfile by adding:
-
This block before the Vagrant configuration block.
# Custom Chef Node management Chef::Config.from_file(File.join(File.dirname(__FILE__), '.chef', 'knife.rb')) vagrant_json = JSON.parse(Pathname(__FILE__).dirname.join('nodes', (ENV['NODE'] || 'kn_deployer.json')).read) # Custom
-
Uncomment and fill chef_solo block inside the Vagrant one (following the commented lines could be useful :D):
config.vm.provision "chef_solo" do |chef| # Chef configuration chef.cookbooks_path = Chef::Config[:cookbook_path] chef.roles_path = Chef::Config[:role_path] chef.data_bags_path = Chef::Config[:data_bag_path] chef.environments_path = Chef::Config[:environment_path] # Chef node run_list chef.run_list = vagrant_json.delete('run_list') chef.json = vagrant_json end
-
Because of the new setting some requirements must be added (at the top of the file of course):
require 'chef' require 'json'
-
- Installing some useful Vagrant plugins:
- Used to version ruby gem used in the project