This repository has been archived by the owner on Jul 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 237
Adding Vagrant support #41
Open
jb11211
wants to merge
1
commit into
google:master
Choose a base branch
from
jb11211:Vagrant
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
bin/* | ||
*.pb.* | ||
!*.pb.go | ||
.vagrant | ||
*.swp |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Vagrant.configure("2") do |config| | ||
config.vm.box = "ubuntu/precise64" | ||
|
||
config.vm.provider "virtualbox" do |v| | ||
v.memory = 1024 | ||
v.cpus = 2 | ||
end | ||
|
||
config.vm.synced_folder ".", "/home/vagrant/lmctfy" | ||
config.vm.provision :shell, :privileged => false, :path => "scripts/install-lmctfy.sh" | ||
|
||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
#!/bin/bash | ||
|
||
# install the necessary dependencies and | ||
# tools on ubuntu 12.04 | ||
|
||
# produce verbose output and exit on error | ||
set -xe | ||
|
||
# setup ubuntu package installs to not ask any questions. | ||
export DEBIAN_FRONTEND=noninteractive | ||
|
||
### dependency variables to install | ||
|
||
re2_version=20140304 | ||
protobuf_version=2.6.1 | ||
compile_threads="$(lscpu | awk '/^CPU\(s\)/ {print $2}')" | ||
|
||
#### change nothing below | ||
alias make="/usr/bin/make -j ${compile_threads}" | ||
alias wget="/usr/bin/wget -q" | ||
|
||
# update list of ubuntu packages. | ||
sudo apt-get update | ||
|
||
# install latest supported trusty (3.13) kernel | ||
# FIXME: using untested kernel version to get around issue #38: | ||
# https://github.com/google/lmctfy/issues/38 | ||
sudo apt-get install -y linux-image-generic-lts-trusty | ||
|
||
# install general build tooling | ||
sudo apt-get install -y git zip autoconf libtool python-software-properties pkg-config cmake | ||
|
||
# setup g++ version 4.7 dependency | ||
# based on : http://charette.no-ip.com:81/programming/2011-12-24_GCCv47/ | ||
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test | ||
sudo apt-get update | ||
sudo apt-get install -y gcc-4.7 g++-4.7 | ||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6 | ||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7 | ||
sudo update-alternatives --set gcc /usr/bin/gcc-4.7 | ||
|
||
# setup protobuf dependency | ||
if ! [ -e protobuf-${protobuf_version} ]; then | ||
wget https://github.com/google/protobuf/releases/download/v${protobuf_version}/protobuf-${protobuf_version}.tar.gz | ||
tar zxvf protobuf-${protobuf_version}.tar.gz | ||
fi | ||
pushd protobuf-${protobuf_version} | ||
./autogen.sh | ||
./configure | ||
make | ||
#make check | ||
sudo make install | ||
popd | ||
|
||
# setup gflags dependency | ||
[ -e gflags ] || git clone https://github.com/schuhschuh/gflags.git | ||
pushd gflags | ||
[ -e build ] || mkdir build | ||
pushd build | ||
cmake .. | ||
make | ||
sudo make install | ||
popd | ||
popd | ||
|
||
# setup re2 dependencies | ||
if ! [ -e re2 ] ; then | ||
wget https://re2.googlecode.com/files/re2-${re2_version}.tgz | ||
tar zxvf re2-${re2_version}.tgz | ||
fi | ||
pushd re2 | ||
make | ||
sudo make install | ||
popd | ||
|
||
# setup apparmor dependency | ||
sudo apt-get install -y apparmor libapparmor-dev | ||
|
||
# setup go dependency | ||
# HACK. stop this package from asking about upstream reporting and breaking the unattended install process (bad google) | ||
echo "golang-go golang-go/dashboard boolean false" | sudo debconf-set-selections | ||
sudo apt-get install -y --force-yes golang | ||
|
||
# add /usr/local/lib to the list of places to look for libraries | ||
echo "/usr/local/lib" |sudo tee /etc/ld.so.conf.d/usrlocal.conf | ||
sudo ldconfig | ||
|
||
# setup lmctfy | ||
pushd lmctfy | ||
make | ||
make check | ||
sudo make install | ||
popd | ||
|
||
# setup /sys/fs/cgroup mount | ||
printf "tmpfs\t/sys/fs/cgroup\ttmpfs\tdefaults\t0\t0" | sudo tee -a /etc/fstab | ||
|
||
# run lmctfy init on reboot | ||
cat << 'EOF' | sudo tee /etc/rc.local | ||
#!/bin/sh -e | ||
|
||
/usr/local/bin/lmctfy init " | ||
cgroup_mount:{ | ||
mount_path:'/sys/fs/cgroup/cpu' | ||
hierarchy:CGROUP_CPU hierarchy:CGROUP_CPUACCT | ||
} | ||
cgroup_mount:{ | ||
mount_path:'/sys/fs/cgroup/cpuset' hierarchy:CGROUP_CPUSET | ||
} | ||
cgroup_mount:{ | ||
mount_path:'/sys/fs/cgroup/freezer' hierarchy:CGROUP_FREEZER | ||
} | ||
cgroup_mount:{ | ||
mount_path:'/sys/fs/cgroup/memory' hierarchy:CGROUP_MEMORY | ||
}" | ||
|
||
exit 0 | ||
EOF | ||
|
||
# reboot | ||
sudo reboot |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On my os/arch/machine:
I have problem with awk below pattern:
My solution it's:
Maybe you should correct this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another simple way to get CPUs: