Last active
May 28, 2020 12:27
-
-
Save danigosa/c2ac2d349c4fcf823cb7 to your computer and use it in GitHub Desktop.
Vagrant Configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# CHEF CLIENT | |
apt-get update | |
apt-get install chef | |
# Set up remote chef-solo | |
mkdir -p /srv/chef-solo | |
install -d -o vagrant -g vagrant /srv/chef-solo | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias python=python3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source /home/vagrant/devenvpy3k/bin/activate | |
export DJANGO_SETTINGS_MODULE="settings" | |
cd /vagrant/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package "python-pip" | |
package "python-setuptools" | |
package "python-dev" | |
package "python3-dev" | |
package "git" | |
package "python-pip" | |
script "extend_bashrc" do | |
user "vagrant" | |
cwd "/home/vagrant/" | |
interpreter "bash" | |
code <<-EOH | |
echo "if [ -f ~/.bash_vagrant ]; then\n . ~/.bash_vagrant\nfi" >> .bashrc | |
touch provisioned.lock | |
EOH | |
not_if do FileTest.file?("/home/vagrant/provisioned.lock") end | |
end | |
cookbook_file "/home/vagrant/.bash_aliases" do | |
user "vagrant" | |
group "vagrant" | |
mode "0770" | |
source "bash_aliases" | |
end | |
cookbook_file "/home/vagrant/.bash_vagrant" do | |
user "vagrant" | |
group "vagrant" | |
mode "0770" | |
source "bash_vagrant" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Target OS Ubuntu Server 14.04 Trusty | |
# Chef 11.8.2 | |
# Author: danigosa | |
# Date: 17/04/2014 | |
# | |
# | |
include_recipe "provision::common" | |
########################################################## | |
# INSTALL VIRTUALENV | |
########################################################## | |
execute "install-virtualenv" do | |
user "root" | |
cwd "root" | |
command "pip install virtualenv" | |
action :run | |
end | |
execute "create-virtualenv-py2k" do | |
user "vagrant" | |
cwd "/home/vagrant" | |
command "virtualenv devenv" | |
action :run | |
end | |
execute "create-virtualenv-py3k" do | |
user "vagrant" | |
cwd "/home/vagrant" | |
command "virtualenv -p /usr/bin/python3 devenvpy3k" | |
action :run | |
end | |
########################################################## | |
# DJANGO SETUP | |
########################################################## | |
script "django-installation-py2k" do | |
user "vagrant" | |
cwd "/vagrant/" | |
interpreter "bash" | |
code <<-EOH | |
source /home/vagrant/devenv/bin/activate | |
pip install -r /vagrant/requirements/dev.txt | |
deactivate | |
EOH | |
end | |
script "django-installation-py3k" do | |
user "vagrant" | |
cwd "/vagrant/" | |
interpreter "bash" | |
code <<-EOH | |
source /home/vagrant/devenvpy3k/bin/activate | |
pip install -r /vagrant/requirements/dev.txt | |
deactivate | |
EOH | |
end | |
script "django-app-setup" do | |
user "root" | |
cwd "/vagrant/" | |
interpreter "bash" | |
code <<-EOH | |
find . -name '*.pyc' -delete | |
mkdir -p logs | |
chmod +x logs | |
touch logs/django.log | |
touch logs/django_request.log | |
EOH | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# 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 = "django-simple-seo" | |
config.vm.provision :shell, :path => "./vagrant/bootstrap.sh" | |
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box" | |
config.vm.network "forwarded_port", guest: 8000, host: 8000 | |
config.vm.network "forwarded_port", guest: 8888, host: 8888 | |
config.vm.provision :chef_solo do |chef| | |
chef.cookbooks_path = "./vagrant/cookbooks" | |
chef.add_recipe "provision::simple-seo" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment