Skip to content

Commit 30562ae

Browse files
committed
Merge pull request #211 from just3ws/master
Vagrant upgrade with a little bit of email noise [ci skip]
2 parents 8de6e3f + dd6708d commit 30562ae

File tree

12 files changed

+251
-107
lines changed

12 files changed

+251
-107
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ GEM
254254
fog-softlayer (0.3.15)
255255
fog-core
256256
fog-json
257-
foreman (0.74.0)
257+
foreman (0.75.0)
258258
dotenv (~> 0.11.1)
259259
thor (~> 0.19.1)
260260
formatador (0.2.5)

Vagrantfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ puts custom_settings.inspect
1010

1111
VAGRANTFILE_API_VERSION = "2"
1212

13-
$box = 'coderwall'
14-
$box_url = 'https://s3.amazonaws.com/coderwall-assets-0/vagrant/coderwall.box' # The box is 1GB. Prepare your
13+
$box = 'coderwall_v2'
14+
$box_url = 'https://s3.amazonaws.com/coderwall-assets-0/vagrant/coderwall_v2.box' # The box is 1.4GB.
1515
$provision = 'vagrant/bootstrap.sh'
1616

1717
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

app/assets/images/relic-tee.png

71.3 KB
Loading

run.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vagrant ssh -c ". /home/vagrant/web/vagrant/run"

run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vagrant ssh -c ". /home/vagrant/web/vagrant/run"

vagrant/bootstrap.sh

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
#!/bin/bash -x
22
export DEBIAN_FRONTEND=noninteractive
3-
cd /home/vagrant
4-
echo Who am I? You are `whoami`.
5-
echo Where am I? You are in `pwd`
6-
echo I think my home is $HOME
7-
echo export EDITOR=vim >> $HOME/.bashrc
8-
# Enable accessing Postgres from the host machine
9-
apt-get -y install libcurl3 libcurl3-dev libcurl3-gnutls libcurl4-openssl-dev
10-
apt-get -y install libpq-dev
11-
apt-get -y install libxml2 libxml2-dev libxslt1-dev
12-
echo "listen_addresses = '*'" | tee -a /var/pgsql/data/postgresql.conf
13-
echo host all all 0.0.0.0/0 trust | tee -a /var/pgsql/data/pg_hba.conf
14-
sudo su postgres -c 'pg_ctl stop -D /var/pgsql/data 2>&1'
15-
sudo su postgres -c 'pg_ctl start -D /var/pgsql/data 2>&1 &'
16-
su -c "ln -s /vagrant /home/vagrant/web" vagrant
17-
su -c "source /home/vagrant/web/vagrant/user-config.sh" vagrant
3+
4+
# Ensure the database is started
5+
su -c '/usr/bin/pg_ctl start -l /var/pgsql/data/log/logfile -D /var/pgsql/data' postgres
6+
7+
sudo su - vagrant <<-'EOF'
8+
cd ~/web
9+
bundle check || bundle install
10+
# Force the app to use the internal Postgres port number and ignore .env
11+
DEV_POSTGRES_PORT=5432 bundle exec rake db:migrate
12+
DEV_POSTGRES_PORT=5432 bundle exec rake db:test:prepare
13+
EOF

vagrant/coderwall-box/rebuild.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
cd ~/assemblymade/coderwall
2+
vagrant halt
3+
vagrant destroy -f
4+
vagrant box remove coderwall
5+
cd vagrant/coderwall-box
6+
rm -rf output-virtualbox-iso
7+
rm -rf packer_virtualbox-iso_virtualbox.box
8+
rm -rf packer_cache
9+
packer validate template.json
10+
packer build template.json
11+
vagrant box add coderwall ./packer_virtualbox-iso_virtualbox.box

vagrant/coderwall-box/scripts/postinstall.sh

Lines changed: 196 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,61 @@
11
# postinstall.sh created from Mitchell's official lucid32/64 baseboxes
22
# and then further defaced by just3ws to create the Coderwall devenv
33

4+
echo "Have you set the ENV keys?"
5+
echo "Have you set the ENV keys?"
6+
echo "Have you set the ENV keys?"
7+
echo "Have you set the ENV keys?"
8+
echo "Have you set the ENV keys?"
9+
echo "Have you set the ENV keys?"
10+
echo "Have you set the ENV keys?"
11+
echo "Have you set the ENV keys?"
12+
echo "Have you set the ENV keys?"
13+
echo "Have you set the ENV keys?"
14+
echo "Have you set the ENV keys?"
15+
echo "Have you set the ENV keys?"
16+
echo "Have you set the ENV keys?"
17+
echo "Have you set the ENV keys?"
18+
echo "Have you set the ENV keys?"
19+
echo "Have you set the ENV keys?"
20+
echo "Have you set the ENV keys?"
21+
echo "Have you set the ENV keys?"
22+
echo "Have you set the ENV keys?"
23+
echo "Have you set the ENV keys?"
24+
echo "Have you set the ENV keys?"
25+
echo "Have you set the ENV keys?"
26+
echo "Have you set the ENV keys?"
27+
echo "Have you set the ENV keys?"
28+
echo "Have you set the ENV keys?"
29+
echo "Have you set the ENV keys?"
30+
echo "Have you set the ENV keys?"
31+
echo "Have you set the ENV keys?"
32+
echo "Have you set the ENV keys?"
33+
echo "Have you set the ENV keys?"
34+
echo "Have you set the ENV keys?"
35+
echo "Have you set the ENV keys?"
36+
echo "Have you set the ENV keys?"
37+
echo "Have you set the ENV keys?"
38+
echo "Have you set the ENV keys?"
39+
echo "Have you set the ENV keys?"
40+
echo "Have you set the ENV keys?"
41+
echo "Have you set the ENV keys?"
42+
echo "Have you set the ENV keys?"
43+
echo "Have you set the ENV keys?"
44+
echo "Have you set the ENV keys?"
45+
echo "Have you set the ENV keys?"
46+
echo "Have you set the ENV keys?"
47+
echo "Have you set the ENV keys?"
48+
echo "Have you set the ENV keys?"
49+
echo "Have you set the ENV keys?"
50+
echo "Have you set the ENV keys?"
51+
echo "Have you set the ENV keys?"
52+
echo "Have you set the ENV keys?"
53+
echo "Have you set the ENV keys?"
54+
echo "Have you set the ENV keys?"
55+
echo "Have you set the ENV keys?"
56+
sleep 30
57+
58+
459
set -x
560

661
date > /etc/vagrant_box_build_time
@@ -13,24 +68,87 @@ dpkg-reconfigure --frontend noninteractive tzdata
1368
# etc., and remove optional things to trim down the machine.
1469
apt-get -y update
1570
apt-get -y upgrade
16-
apt-get -y install linux-headers-$(uname -r) build-essential
71+
apt-get -y install linux-headers-$(uname -r)
72+
apt-get -y install build-essential
1773

1874
# General dependencies and tools just... mashed, just mashed all together.
19-
apt-get -y install ack-grep autoconf automake bison ca-certificates \
20-
curl g++ gcc git-core htop iotop libc6-dev libffi-dev \
21-
libgdbm-dev libncurses5-dev libopenssl-ruby libreadline6 \
22-
libreadline6-dev libsqlite3-0 libsqlite3-dev libssl-dev \
23-
libtool libxml2-dev libxslt-dev libyaml-dev make openssl \
24-
patch pkg-config sqlite3 tmux vim zlib1g zlib1g-dev gawk \
25-
libxml2-dev curl libcurl4-openssl-dev \
26-
imagemagick libmagickcore-dev libmagickwand-dev tcl8.5
27-
28-
# Install NFS client
29-
apt-get -y install nfs-common portmap
30-
3175
# Apt-install python tools and libraries
76+
# Install NFS client
3277
# libpq-dev lets us compile psycopg for Postgres
33-
apt-get -y install python-setuptools python-dev libpq-dev pep8
78+
apt-get -y install ack-grep
79+
apt-get -y install autoconf
80+
apt-get -y install automake
81+
apt-get -y install bash
82+
apt-get -y install bison
83+
apt-get -y install bzip2
84+
apt-get -y install ca-certificates
85+
apt-get -y install curl
86+
apt-get -y install g++
87+
apt-get -y install gawk
88+
apt-get -y install gcc
89+
apt-get -y install git-core
90+
apt-get -y install htop
91+
apt-get -y install imagemagick
92+
apt-get -y install iotop
93+
apt-get -y install libc6-dev
94+
apt-get -y install libcurl3
95+
apt-get -y install libcurl3-dev
96+
apt-get -y install libcurl3-gnutls
97+
apt-get -y install libcurl4-openssl-dev
98+
apt-get -y install libffi-dev
99+
apt-get -y install libgdbm-dev
100+
apt-get -y install libmagickcore-dev
101+
apt-get -y install libmagickwand-dev
102+
apt-get -y install libncurses5-dev
103+
apt-get -y install libopenssl-ruby
104+
apt-get -y install libpq-dev
105+
apt-get -y install libpq-dev
106+
apt-get -y install libreadline6
107+
apt-get -y install libreadline6-dev
108+
apt-get -y install libsqlite3-0
109+
apt-get -y install libsqlite3-dev
110+
apt-get -y install libssl-dev
111+
apt-get -y install libtool
112+
apt-get -y install libxml2
113+
apt-get -y install libxml2-dev
114+
apt-get -y install libxslt-dev
115+
apt-get -y install libxslt1-dev
116+
apt-get -y install libyaml-dev
117+
apt-get -y install make
118+
apt-get -y install nfs-common
119+
apt-get -y install openssl
120+
apt-get -y install patch
121+
apt-get -y install pep8
122+
apt-get -y install pkg-config
123+
apt-get -y install portmap
124+
apt-get -y install python-dev
125+
apt-get -y install python-setuptools
126+
apt-get -y install sqlite3
127+
apt-get -y install tcl8.5
128+
apt-get -y install tmux
129+
apt-get -y install vim
130+
apt-get -y install zlib1g
131+
apt-get -y install zlib1g-dev
132+
133+
RUBY_VERSION="2.1.3"
134+
wget http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-$RUBY_VERSION.tar.bz2
135+
tar jxf ruby-$RUBY_VERSION.tar.bz2
136+
cd ruby-$RUBY_VERSION
137+
./configure --prefix=/opt/ruby
138+
make
139+
make install
140+
cd ..
141+
rm -rf ruby-$RUBY_VERSION*
142+
chown -R root:admin /opt/ruby
143+
chmod -R g+w /opt/ruby
144+
145+
RUBYGEMS_VERSION="2.4.1"
146+
wget http://production.cf.rubygems.org/rubygems/rubygems-$RUBYGEMS_VERSION.tgz
147+
tar xzf rubygems-$RUBYGEMS_VERSION.tgz
148+
cd rubygems-$RUBYGEMS_VERSION
149+
/opt/ruby/bin/ruby setup.rb
150+
cd ..
151+
rm -rf rubygems-$RUBYGEMS_VERSION*
34152

35153
# Setup sudo to allow no-password sudo for "admin"
36154
cp /etc/sudoers /etc/sudoers.orig
@@ -61,25 +179,6 @@ make install
61179
cd ..
62180
rm -rf node*
63181

64-
RUBY_VERSION="2.1.2"
65-
wget http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-$RUBY_VERSION.tar.bz2
66-
tar jxf ruby-$RUBY_VERSION.tar.bz2
67-
cd ruby-$RUBY_VERSION
68-
./configure --prefix=/opt/ruby
69-
make
70-
make install
71-
cd ..
72-
rm -rf ruby-$RUBY_VERSION*
73-
chown -R root:admin /opt/ruby
74-
chmod -R g+w /opt/ruby
75-
76-
RUBYGEMS_VERSION="2.4.1"
77-
wget http://production.cf.rubygems.org/rubygems/rubygems-$RUBYGEMS_VERSION.tgz
78-
tar xzf rubygems-$RUBYGEMS_VERSION.tgz
79-
cd rubygems-$RUBYGEMS_VERSION
80-
/opt/ruby/bin/ruby setup.rb
81-
cd ..
82-
rm -rf rubygems-$RUBYGEMS_VERSION*
83182

84183
# Installing chef & Puppet
85184
/opt/ruby/bin/gem install chef --no-ri --no-rdoc
@@ -103,7 +202,8 @@ cd ..
103202
rm -rf postgresql-$POSTGRES_VERSION*
104203

105204
# Add 'vagrant' role
106-
su -c 'createuser vagrant -s' postgres
205+
su -c 'createuser -s vagrant' postgres
206+
su -c 'createuser -s coderwall' postgres
107207

108208
# Initialize postgres DB
109209
useradd -p postgres postgres
@@ -113,6 +213,10 @@ su -c "/usr/bin/initdb -D /var/pgsql/data --locale=en_US.UTF-8 --encoding=UNICOD
113213
mkdir /var/pgsql/data/log
114214
chown postgres /var/pgsql/data/log
115215

216+
# Set the PG instance to listen and accept connections from anywhere
217+
echo "listen_addresses = '*'" | tee -a /var/pgsql/data/postgresql.conf
218+
echo host all all 0.0.0.0/0 trust | tee -a /var/pgsql/data/pg_hba.conf
219+
116220
# Start postgres
117221
su -c '/usr/bin/pg_ctl start -l /var/pgsql/data/log/logfile -D /var/pgsql/data' postgres
118222

@@ -183,14 +287,66 @@ rm /lib/udev/rules.d/75-persistent-net-generator.rules
183287
# Install Heroku toolbelt
184288
wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
185289

290+
# Set locale
291+
echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale
292+
293+
# Configure the user.
294+
su postgres -c 'createuser -s vagrant'
295+
su postgres -c 'createuser -s coderwall'
296+
297+
su postgres -c 'pg_ctl stop -D /var/pgsql/data 2>&1'
298+
su -c '/usr/bin/pg_ctl start -l /var/pgsql/data/log/logfile -D /var/pgsql/data' postgres
299+
300+
sudo su - vagrant <<-'EOF'
301+
echo export EDITOR=vim >> $HOME/.bashrc
302+
echo insecure > $HOME/.curlrc
303+
echo progress-bar >> $HOME/.curlrc
304+
305+
echo rvm_install_on_use_flag=1 >> $HOME/.rvmrc
306+
echo rvm_project_rvmrc=1 >> $HOME/.rvmrc
307+
echo rvm_trust_rvmrcs_flag=1 >> $HOME/.rvmrc
308+
309+
curl -k -L https://get.rvm.io | bash -s stable --autolibs=install-packages
310+
source "$HOME/.rvm/scripts/rvm"
311+
[[ -s "$rvm_path/hooks/after_cd_bundle" ]] && chmod +x $rvm_path/hooks/after_cd_bundle
312+
rvm autolibs enable
313+
rvm requirements
314+
rvm reload
315+
316+
_RUBY_VERSION=ruby-2.1.3
317+
rvm install $_RUBY_VERSION
318+
rvm gemset create coderwall
319+
rvm use $_RUBY_VERSION --default
320+
rvm use $_RUBY_VERSION@coderwall
321+
gem update --system && gem update bundler
322+
gem install curb -v '0.8.6'
323+
324+
mkdir -p ~/tmp
325+
326+
git clone https://github.com/assemblymade/coderwall.git ~/bootstrap/coderwall
327+
cd ~/bootstrap/coderwall
328+
rvm current
329+
330+
bundle config --global jobs 3
331+
bundle install
332+
333+
echo "IMPORTANT: Set the ENV Keys!!!
334+
export ENV_KEYS=somevalue
335+
336+
bundle exec rake db:drop:all
337+
bundle exec rake db:create:all
338+
RAILS_ENV=test bundle exec rake db:create
339+
bundle exec rake db:schema:load
340+
bundle exec rake db:migrate
341+
bundle exec rake db:seed
342+
bundle exec rake db:test:prepare
343+
EOF
344+
186345
# Install some libraries
187346
apt-get -y clean
188347
apt-get -y autoclean
189348
apt-get -y autoremove
190349

191-
# Set locale
192-
echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale
193-
194350
echo "==> Installed packages before cleanup"
195351
dpkg --get-selections | grep -v deinstall
196352

@@ -200,12 +356,12 @@ dpkg --list | awk '{ print $2 }' | grep 'linux-image-3.*-generic' | grep -v $(un
200356
echo "==> Removing linux source"
201357
dpkg --list | awk '{ print $2 }' | grep linux-source | xargs apt-get -y purge
202358
echo "==> Removing development packages"
203-
dpkg --list | awk '{ print $2 }' | grep -- '-dev$' | xargs apt-get -y purge
359+
#dpkg --list | awk '{ print $2 }' | grep -- '-dev$' | xargs apt-get -y purge
204360
echo "==> Removing documentation"
205361
dpkg --list | awk '{ print $2 }' | grep -- '-doc$' | xargs apt-get -y purge
206362
echo "==> Removing development tools"
207-
#dpkg --list | grep -i compiler | awk '{ print $2 }' | xargs apt-get -y purge
208-
#apt-get -y purge cpp gcc g++
363+
dpkg --list | grep -i compiler | awk '{ print $2 }' | xargs apt-get -y purge
364+
apt-get -y purge cpp gcc g++
209365
apt-get -y purge build-essential
210366
echo "==> Removing default system Ruby"
211367
apt-get -y purge ruby ri doc
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
sudo su - vagrant <<-'EOF'
2+
cd ~/web
3+
rvm requirements
4+
bundle check && bundle install
5+
cd
6+
rm -rf ~/bootstrap
7+
EOF

0 commit comments

Comments
 (0)