Permalink
Browse files

Gitlab v0.3.0

* Missing bracket
* Change single-quote variable to symbol notation
* install python and symlink redis-cli so hooks work
* HTTPS options for nginx
* Ubuntu/Debian platform compatibility fixes
* [FC035](http://acrmp.github.com/foodcritic/#FC035): Template uses node attribute directly

Signed-off-by: Eric G. Wolfe <wolfe21@marshall.edu>
  • Loading branch information...
1 parent 1afbc93 commit f94251261941041cd4588006e0f1ac33b84b3c15 Eric G. Wolfe committed Aug 26, 2012
View
@@ -0,0 +1 @@
+metadata.json
View
@@ -1,3 +1,12 @@
+## v0.3.0
+
+* Missing bracket
+* Change single-quote variable to symbol notation
+* install python and symlink redis-cli so hooks work
+* HTTPS options for nginx
+* Ubuntu/Debian platform compatibility fixes
+* [FC035](http://acrmp.github.com/foodcritic/#FC035): Template uses node attribute directly
+
## v0.2.1
Thanks to Fletcher Nichol for the feedback and fixes :)
View
@@ -54,7 +54,6 @@ Much kudos to everyone who added indirectly to the epicness of this cookbook.
* Opscode, Inc cookbooks
- [git](http://ckbk.it/git)
- - [sqlite](http://ckbk.it/sqlite)
- [build-essential](http://ckbk.it/build-essential)
- [python::pip](http://ckbk.it/python)
- [sudo](http://ckbk.it/sudo)
View
@@ -1,27 +1,19 @@
#!/usr/bin/env rake
+require 'rake/testtask'
+
+Rake::TestTask.new do |t|
+ t.libs.push "lib"
+ t.test_files = FileList['test/**/*_spec.rb']
+ t.verbose = true
+end
desc "Runs foodcritic linter"
task :foodcritic do
if Gem::Version.new("1.9.2") <= Gem::Version.new(RUBY_VERSION.dup)
- sandbox = File.join(File.dirname(__FILE__), %w{tmp foodcritic cookbook})
- prepare_foodcritic_sandbox(sandbox)
-
- sh "foodcritic --epic-fail any #{File.dirname(sandbox)}"
+ sh "foodcritic --epic-fail any ."
else
puts "WARN: foodcritic run is skipped as Ruby #{RUBY_VERSION} is < 1.9.2."
end
end
-task :default => 'foodcritic'
-
-private
-
-def prepare_foodcritic_sandbox(sandbox)
- files = %w{*.md *.rb attributes definitions files providers
- recipes resources templates}
-
- rm_rf sandbox
- mkdir_p sandbox
- cp_r Dir.glob("{#{files.join(',')}}"), sandbox
- puts "\n\n"
-end
+task :default => [ 'test', 'foodcritic' ]
View
@@ -0,0 +1,14 @@
+# Put files/directories that should be ignored in this file.
+# Lines that start with '# ' are comments.
+
+# gitignore
+\.gitignore
+
+# emacs
+*~
+
+# vim
+*.sw[a-z]
+
+# subversion
+*/.svn/*
View
@@ -3,11 +3,11 @@
license "Apache 2.0"
description "Installs/Configures gitlab"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version "0.2.1"
+version "0.3.0"
%w{ gitolite nginx }.each do |cb_conflict|
conflicts cb_conflict
end
-%w{ ruby_build chef_gem git sqlite redisio build-essential python readline sudo openssh perl xml zlib}.each do |cb_depend|
+%w{ ruby_build git redisio build-essential python readline sudo openssh perl xml zlib}.each do |cb_depend|
depends cb_depend
end
%w{ redhat centos scientific amazon debian ubuntu }.each do |os|
View
@@ -21,7 +21,7 @@
# Include cookbook dependencies
%w{ ruby_build gitlab::gitolite build-essential
readline sudo openssh xml zlib python::package python::pip
- redisio::install redisio::enable sqlite }.each do |requirement|
+ redisio::install redisio::enable }.each do |requirement|
include_recipe requirement
end
@@ -40,6 +40,10 @@
owner "root"
group "root"
mode 0755
+ variables(
+ :fqdn => node['fqdn'],
+ :install_ruby => node['gitlab']['install_ruby']
+ )
end
# Set PATH for remainder of recipe.
@@ -126,6 +130,9 @@
owner node['gitlab']['user']
group node['gitlab']['group']
mode 0644
+ variables(
+ :public_key => node['gitlab']['public_key']
+ )
end
# Render public key template for gitolite user
@@ -142,6 +149,10 @@
owner node['gitlab']['user']
group node['gitlab']['group']
mode 0644
+ variables(
+ :fqdn => node['fqdn'],
+ :trust_local_sshkeys => node['gitlab']['trust_local_sshkeys']
+ )
end
# Sorry for this ugliness.
@@ -175,6 +186,12 @@
owner node['gitlab']['user']
group node['gitlab']['group']
mode 0644
+ variables(
+ :fqdn => node['fqdn'],
+ :https_boolean => node['gitlab']['https'],
+ :git_user => node['gitlab']['git_user'],
+ :git_home => node['gitlab']['git_home']
+ )
end
# Link sqlite example config file to database.yml
@@ -209,6 +226,10 @@
owner node['gitlab']['user']
group node['gitlab']['group']
mode 0644
+ variables(
+ :fqdn => node['fqdn'],
+ :gitlab_app_home => node['gitlab']['app_home']
+ )
end
# Render unicorn_rails init script
@@ -217,6 +238,10 @@
group "root"
mode 0755
source "unicorn_rails.init.erb"
+ variables(
+ :fqdn => node['fqdn'],
+ :gitlab_app_home => node['gitlab']['app_home']
+ )
end
# Start unicorn_rails and nginx service
@@ -248,4 +273,11 @@
mode 0644
source "nginx.default.conf.erb"
notifies :restart, "service[nginx]"
+ variables(
+ :hostname => node['hostname'],
+ :gitlab_app_home => node['gitlab']['app_home'],
+ :https_boolean => node['gitlab']['https'],
+ :ssl_certificate => node['gitlab']['ssl_certificate'],
+ :ssl_certificate_key => node['gitlab']['ssl_certificate_key']
+ )
end
View
@@ -73,5 +73,8 @@
source "gitolite.rc.erb"
owner node['gitlab']['git_user']
group node['gitlab']['git_group']
- mode 0644
+ mode 0644
+ variables(
+ :gitolite_umask => node['gitlab']['gitolite_umask']
+ )
end
@@ -1,7 +1,7 @@
#!/bin/bash
-# Generated by Chef for <%= node["fqdn"] %>
+# Generated by Chef for <%= @fqdn %>
# Local modifications will be overwritten.
-RUBY_DIR="/usr/local/ruby/<%= node['gitlab']['install_ruby'] %>"
+RUBY_DIR="/usr/local/ruby/<%= @install_ruby %>"
if ! echo ${PATH} | /bin/grep -q $RUBY_DIR/bin ; then
PATH=$RUBY_DIR/bin:${PATH}
fi
@@ -1,23 +1,23 @@
-# Generated by Chef for <%= node['fqdn'] %>
+# Generated by Chef for <%= @fqdn %>
# Local modifications will be overwritten.
# Gitlab application config file
# Web application specific settings
web:
- host: <%= node['fqdn'] %>
- port: <%= node['gitlab']['https'] ? 443 : 80 %>
- https: <%= node['gitlab']['https'] %>
+ host: <%= @fqdn %>
+ port: <%= @https_boolean ? 443 : 80 %>
+ https: <%= @https_boolean %>
# Email used for notification
# about new issues, comments
email:
- from: gitlab@<%= node['fqdn'] %>
- host: <%= node['fqdn'] %>
+ from: gitlab@<%= @fqdn %>
+ host: <%= @fqdn %>
# Protocol used for links in email letters
# Value can be http or https
- protocol: <%= node['gitlab']['https'] ? "https" : "http" %>
+ protocol: <%= @https_boolean ? "https" : "http" %>
# Application specific settings
# Like default project limit for user etc
@@ -29,10 +29,10 @@ app:
# Git Hosting congiguration
git_host:
system: gitolite
- admin_uri: <%= node['gitlab']['git_user'] %>@localhost:gitolite-admin
- base_path: <%= node['gitlab']['git_home'] %>/repositories
- host: <%= node['fqdn'] %>
- git_user: <%= node['gitlab']['git_user'] %>
+ admin_uri: <%= @git_user %>@localhost:gitolite-admin
+ base_path: <%= @git_home %>/repositories
+ host: <%= @fqdn %>
+ git_user: <%= @git_user %>
# port: 22
# Git settings
@@ -1,5 +1,5 @@
%RC = (
- UMASK => <%= node['gitlab']['gitolite_umask'] -%>,
+ UMASK => <%= @gitolite_umask -%>,
GIT_CONFIG_KEYS => '',
LOG_EXTRA => 1,
ROLES =>
@@ -1 +1 @@
-<%= node['gitlab']['public_key'] %>
+<%= @public_key %>
@@ -4,7 +4,7 @@ upstream unicorn_rails {
# single worker for timing out).
# for UNIX domain socket setups:
- server unix:<%= node['gitlab']['app_home'] %>/tmp/sockets/gitlab.socket fail_timeout=0;
+ server unix:<%= @gitlab_app_home %>/tmp/sockets/gitlab.socket fail_timeout=0;
# for TCP setups, point these to your backend servers
# server 192.168.0.7:8080 fail_timeout=0;
@@ -13,20 +13,20 @@ upstream unicorn_rails {
}
server {
- listen <%= node['gitlab']['https'] ? 443 : 80 %>;
+ listen <%= @https_boolean ? 443 : 80 %>;
client_max_body_size 4G;
server_name _;
- <% if node['gitlab']['https'] %>
+ <% if @https_boolean %>
ssl on;
- ssl_certificate <%= node['gitlab']['ssl_certificate'] %>;
- ssl_certificate_key <%= node['gitlab']['ssl_certificate_key'] %>;
+ ssl_certificate <%= @ssl_certificate %>;
+ ssl_certificate_key <%= @ssl_certificate_key %>;
<% end %>
- access_log /var/log/nginx/<%= node['hostname'] %>.access.log combined;
+ access_log /var/log/nginx/<%= @hostname %>.access.log combined;
# path for static files
- root <%= node['gitlab']['app_home'] %>/public;
+ root <%= @gitlab_app_home %>/public;
# Prefer to serve static files directly from nginx to avoid unnecessary
# data copies from the application server.
@@ -39,7 +39,7 @@ server {
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto <%= node['gitlab']['https'] ? "https" : "http" %>;
+ proxy_set_header X-Forwarded-Proto <%= @https_boolean ? "https" : "http" %>;
proxy_set_header Host $http_host;
proxy_redirect off;
@@ -52,7 +52,7 @@ server {
# Rails error pages
error_page 500 502 503 504 /500.html;
location = /500.html {
- root <%= node['gitlab']['app_home'] %>/public;
+ root <%= @gitlab_app_home %>/public;
}
}
@@ -1,3 +1,3 @@
-# Generated by Chef for <%= node['fqdn'] %>
+# Generated by Chef for <%= @fqdn %>
# Local modifications will be overwritten.
-NoHostAuthenticationForLocalhost <%= node['gitlab']['trust_local_sshkeys'] -%>
+NoHostAuthenticationForLocalhost <%= @trust_local_sshkeys -%>
@@ -1,6 +1,6 @@
-# Generated by Chef for <%= node['fqdn'] %>
+# Generated by Chef for <%= @fqdn %>
# Local modifications will be overwritten.
-app_dir = "<%= node['gitlab']['app_home'] %>"
+app_dir = "<%= @gitlab_app_home %>"
worker_processes 2
working_directory app_dir
@@ -1,6 +1,6 @@
#! /bin/bash
-# Generated by Chef for <%= node['fqdn'] %>
+# Generated by Chef for <%= @fqdn %>
# Local modifications will be overwritten.
# unicorn_rails init script for Linux
@@ -19,16 +19,16 @@
# Description: unicorn_rails init script as shipped with gitlab cookbook
### END INIT INFO
-DAEMON_OPTS="-c <%= node['gitlab']['app_home'] %>/config/unicorn.rb -E production -D"
+DAEMON_OPTS="-c <%= @gitlab_app_home %>/config/unicorn.rb -E production -D"
NAME=unicorn_rails
DESC=gitlab
-PID=<%= node['gitlab']['app_home'] %>/tmp/pids/unicorn.pid
-RESQUE_PID=<%= node['gitlab']['app_home'] %>/tmp/pids/resque_worker.pid
+PID=<%= @gitlab_app_home %>/tmp/pids/unicorn.pid
+RESQUE_PID=<%= @gitlab_app_home %>/tmp/pids/resque_worker.pid
case "$1" in
start)
. /etc/profile.d/gitlab.sh || exit 1
- CD_TO_APP_DIR="cd <%= node['gitlab']['app_home'] %>"
+ CD_TO_APP_DIR="cd <%= @gitlab_app_home %>"
START_DAEMON_PROCESS="bundle exec unicorn_rails $DAEMON_OPTS"
START_RESQUE_PROCESS="./resque.sh"
View
@@ -1,4 +1,4 @@
source "https://rubygems.org"
gem 'rake'
-gem 'foodcritic', :platforms => :ruby_19
+gem 'foodcritic'

0 comments on commit f942512

Please sign in to comment.