Skip to content

Instantly share code, notes, and snippets.

@moqada
Last active December 11, 2015 11:58
Show Gist options
  • Save moqada/4597441 to your computer and use it in GitHub Desktop.
Save moqada/4597441 to your computer and use it in GitHub Desktop.
setup for coookbook-omnigollum-site
{
"run_list": [
"recipe[htpasswd]",
"recipe[omnigollum_site]"
],
"omnigollum_site": {
"base_path": "/home/gollum/wiki",
"wiki_source": "",
"repository": "git://github.com/moqada/omnigollum-site.git",
"ldap": {
"host": "127.0.0.1",
"port": "388",
"method": "plain",
"base": "hoge",
"uid": "fuga",
"bind_dn": "bind",
"password": "test"
},
"htpasswd": {
"user": "foo",
"password": "password"
},
"nginx": {
"allow_ips": ["127.0.0.1"]
}
}
}
#!/usr/bin/env sh
# clone or fetch master Git repository
clone_or_fetch_git() {
if [ ! -d $1 ]; then
git clone $2 $1
else
cd $1
git fetch
git reset origin/master --hard
fi
}
echo -e "\nInstalling dependency libraries..." \
"\n================================================================================"
yum install -y make
yum install -y gcc-c++
yum install -y patch
yum install -y readline-devel
yum install -y zlib-devel
yum install -y libyaml-devel
yum install -y libffi-devel
yum install -y openssl-devel
yum install -y libxml2-devel
yum install -y libxslt-devel
yum install -y git
echo -e "\nInstalling rbenv..." \
"\n================================================================================"
cd ~
clone_or_fetch_git ~/.rbenv "git://github.com/sstephenson/rbenv.git"
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
mkdir -p ~/.rbenv/plugins
cd ~/.rbenv/plugins/
clone_or_fetch_git ~/.rbenv/plugins/ruby-build "git://github.com/sstephenson/ruby-build.git"
cd ~
source ~/.bashrc
echo -e "\nInstalling Ruby..." \
"\n================================================================================"
rbenv versions | grep -sq '1.9.2-p320' || rbenv install 1.9.2-p320
rbenv global 1.9.2-p320
rbenv rehash
echo -e "\nInstalling chef..." \
"\n================================================================================"
gem install chef --no-rdoc --no-ri
gem install knife-solo --no-rdoc --no-ri
rbenv rehash
echo -e "\nDownloading cookbooks..." \
"\n================================================================================"
mkdir -p /var/chef-solo/site-cookbooks
mkdir -p /var/chef-solo/cookbooks
test -d /var/chef-solo/cookbooks/nginx || curl -# -L -k http://community.opscode.com/cookbooks/nginx/versions/1_1_4/downloads | tar xz -C /var/chef-solo/cookbooks/
test -d /var/chef-solo/cookbooks/yum || curl -# -L -k http://community.opscode.com/cookbooks/yumrepo/versions/0_16_5/downloads | tar xz -C /var/chef-solo/cookbooks/
test -d /var/chef-solo/cookbooks/htpasswd || curl -# -L -k http://community.opscode.com/cookbooks/htpasswd/versions/0_0_1/downloads | tar xz -C /var/chef-solo/cookbooks/
clone_or_fetch_git /var/chef-solo/site-cookbooks/omnigollum_site "git://github.com/moqada/cookbook-omnigollum-site.git"
test -f /tmp/node-example.json || curl -# -L -k https://gist.github.com/raw/4597441/node-example.json -o /tmp/node-example.json
test -f /tmp/solo.rb || curl -# -L -k https://gist.github.com/raw/4597441/solo.rb -o /tmp/solo.rb
file_cache_path "/var/chef-solo"
cookbook_path ["/var/chef-solo/cookbooks/", '/var/chef-solo/site-cookbooks/']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment