This repository has been archived by the owner on Feb 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Vagrantfile
104 lines (75 loc) · 3.29 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# -*- mode: ruby -*-
# vi: set ft=ruby :
MESSAGE = <<-MESSAGE
WELCOME to
###### ####### # # # # #
# # # # # # # # #
# # # # # # # # #
###### ##### # # # # #
# # # ####### # # #
# # # # # # # #
###### ####### # # # #
#----------------------------------------------------#
# #
# If you need any help, feel free to chat us up at #
# #
# https://gitter.im/beavyHQ/beavy #
# #
#----------------------------------------------------#
You can now log into your development enviroment via
vagrant ssh
and in there start all processes in a tmux session via
./start.sh
----
Glad to have you on board, champ!
Have fun!
MESSAGE
# The list of packages we want to install
INSTALL = <<-INSTALL
sudo apt-get update
sudo apt-get install -y postgresql-9.4 postgresql-client-9.4 postgresql-server-dev-9.4 redis-server python3 python3-pip python3-virtualenv virtualenv nodejs npm zsh git tmux libffi-dev libncurses5-dev xvfb chromedriver chromium build-essential libssl-dev curl git-core
INSTALL
# Provising on the system and user level
SETUP = <<-SETUP
# prepare database
sudo -u postgres createuser vagrant
sudo -u postgres createdb -O vagrant beavy-dev
# fix postgres config
sudo cp /vagrant/.infrastructure/vagrant/pg_hba.conf /etc/postgresql/9.4/main/pg_hba.conf
sudo /etc/init.d/postgresql reload
# make sure chrome & chromedriver are accessible
sudo ln -s /usr/bin/chromium /usr/bin/chrome
sudo ln -s /usr/lib/chromium/chromedriver /usr/bin/chromedriver
# install latest nvm to vagrant
git clone git://github.com/creationix/nvm.git /home/vagrant/.nvm
. /home/vagrant/.nvm/nvm.sh
# install latest stable node
nvm install stable
nvm alias default stable
# make sure npm is up to date
sudo npm install -g npm
# set user bash to zsh
sudo chsh -s /bin/zsh vagrant
# create the virualenv for vagrant
sudo -u vagrant virtualenv -p python3 /home/vagrant/venv
# keep node modules on vagrant instance only
# releases stress on webpack watch, keeps stuff smoothly separated
sudo -u vagrant mkdir -p /home/vagrant/node_modules
sudo -u vagrant mkdir -p /vagrant/node_modules
sudo mount --bind /home/vagrant/node_modules /vagrant/node_modules
SETUP
Vagrant.configure(2) do |config|
config.vm.box = "debian/jessie64"
config.vm.post_up_message = MESSAGE
config.vm.network "forwarded_port", guest: 2992, host: 2992
config.vm.network "private_network", ip: "10.1.1.10"
# tuned options for best webpack watch performance, see
# https://blog.inovex.de/doh-my-vagrant-nfs-is-slow/
config.vm.synced_folder ".", "/vagrant", type: 'nfs', mount_options: ['rw', 'vers=3', 'tcp', 'fsc' ,'actimeo=1']
config.vm.provision "shell", inline: INSTALL
config.vm.provision "shell", path: ".infrastructure/install_icu.sh"
config.vm.provision "shell", inline: SETUP
# add local git and zsh config
config.vm.provision "file", source: "~/.gitconfig", destination: "~/.gitconfig"
config.vm.provision "file", source: ".infrastructure/vagrant/zshrc", destination: "~/.zshrc"
end