Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Gemfile.lock
*.un~
/cookbooks
.chef
.rvmrc
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
source :rubygems
source 'http://rubygems.org'

gem 'berkshelf'
gem 'thor-foodcritic'
gem 'vagrant', '~> 1.0.5'
gem 'vagrant-wrapper'
gem 'test-kitchen', :group => :integration
gem 'kitchen-vagrant', :group => :integration
10 changes: 6 additions & 4 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ Vagrant.configure("2") do |config|

config.vm.hostname = "errbit-berkshelf"
config.vm.box = "Opscode-12-04"
config.vm.network :private_network, ip: "33.33.33.20"
config.vm.network :private_network, ip: "33.33.33.10"

config.vm.box_url = "https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box"

# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
Expand All @@ -16,7 +18,7 @@ Vagrant.configure("2") do |config|

# Forward a port from the guest to the host, which allows for outside
# computers to access the VM, whereas host only networking does not.
# config.vm.forward_port 80, 8080
config.vm.network :forwarded_port, guest: 80, host: 8080

# Share an additional folder to the guest VM. The first argument is
# an identifier, the second is the path on the guest to mount the
Expand All @@ -26,8 +28,8 @@ Vagrant.configure("2") do |config|
# Peepcode chef
#config.vm.share_folder "v-cookbooks", "/cookbooks", "."

config.ssh.max_tries = 40
config.ssh.timeout = 120
config.omnibus.chef_version = :latest
config.vm.boot_timeout = 120

# The path to the Berksfile to use with Vagrant Berkshelf
# config.berkshelf.berksfile_path = "./Berksfile"
Expand Down
21 changes: 14 additions & 7 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@

# errbit config.yml
default['errbit']['config']['host'] = "errbit.example.com"
default['errbit']['config']['port'] = 80
default['errbit']['config']['https'] = false
default['errbit']['config']['enforce_ssl'] = false
default['errbit']['config']['email_from'] = "[email protected]"
default['errbit']['config']['per_app_email_at_notices'] = false
default['errbit']['config']['email_at_notices'] = [1, 10, 100]
default['errbit']['config']['confirm_resolve_err'] = true
default['errbit']['config']['per_app_notify_at_notices'] = false
default['errbit']['config']['notify_at_notices'] = [0]
default['errbit']['config']['confirm_err_actions'] = true
default['errbit']['config']['user_has_username'] = false
default['errbit']['config']['allow_comments_with_issue_tracker'] = true
default['errbit']['config']['display_internal_errors'] = true
default['errbit']['config']['use_gravatar'] = true
default['errbit']['config']['gravatar_default'] = "identicon"

Expand All @@ -35,14 +40,16 @@
default['errbit']['config']['github_access_scope'] = ['repo']

# mongodb creds
default['errbit']['db']['host'] = "localhost"
default['errbit']['db']['port'] = "27017"
default['errbit']['db']['database'] = "errbit"
default['errbit']['db']['username'] = ""
default['errbit']['db']['password'] = ""
default['errbit']['db']['host'] = "localhost"
default['errbit']['db']['port'] = "27017"
default['errbit']['db']['database'] = "errbit"
default['errbit']['db']['username'] = ""
default['errbit']['db']['password'] = ""
default['errbit']['db']['identity_map_enabled'] = true
default['errbit']['db']['use_utc'] = true

# app server (Optional: More info in README)
default['errbit']['server'] = "unicorn" # or use others like puma

default['errbit']['secret_token'] = 'b9e131c733a2672c79af5699f26e0bc5fba23a40ec51d76c9271c00097f35aa4c0993e1150f08048f0b66bd141cbcb58ab28814e35eb281c3cb2374aac160203'
default['errbit']['secret_token'] = '1505bf435970a11dc892d434eb69bc07190ff42e6f3fe4db8b158f56d5f7c6c1861dfd018e499a4ca120c9881684ad985f98cb1f48f3b76cbea9c85d5465bbce'

2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
license "All rights reserved"
description "Installs/Configures errbit"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.4.0"
version "0.4.1"

depends "mongodb"
depends "git"
Expand Down
37 changes: 30 additions & 7 deletions recipes/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#

include_recipe "mongodb::10gen_repo"
mongodb_instance "mongodb" do
port node['errbit']['db']['port']
host node['errbit']['db']['host']
end

node.set['build_essential']['compiletime'] = true
include_recipe "build-essential"
Expand Down Expand Up @@ -103,13 +107,18 @@
mode 00644
variables(params: {
host: node['errbit']['config']['host'],
port: node['errbit']['config']['port'],
https: node['errbit']['config']['https'],
enforce_ssl: node['errbit']['config']['enforce_ssl'],
email_from: node['errbit']['config']['email_from'],
per_app_email_at_notices: node['errbit']['config']['per_app_email_at_notices'],
email_at_notices: node['errbit']['config']['email_at_notices'],
confirm_resolve_err: node['errbit']['config']['confirm_resolve_err'],
per_app_notify_at_notices: node['errbit']['config']['per_app_notify_at_notices'],
notify_at_notices: node['errbit']['config']['notify_at_notices'],
confirm_err_actions: node['errbit']['config']['confirm_err_actions'],
user_has_username: node['errbit']['config']['user_has_username'],
allow_comments_with_issue_tracker: node['errbit']['config']['allow_comments_with_issue_tracker'],
display_internal_errors: node['errbit']['config']['display_internal_errors'],
use_gravatar: node['errbit']['config']['use_gravatar'],
gravatar_default: node['errbit']['config']['gravatar_default'],
github_authentication: node['errbit']['config']['github_authentication'],
Expand All @@ -119,6 +128,17 @@
})
end

# errbit config.yml
template "#{node['errbit']['deploy_to']}/shared/config/initializers/__secret_token.rb" do
source "secret_token.rb.erb"
owner node['errbit']['user']
group node['errbit']['group']
mode 00644
variables(params: {
secret_token: node['errbit']['secret_token']
})
end

template "#{node['errbit']['deploy_to']}/shared/config/mongoid.yml" do
source "mongoid.yml.erb"
owner node['errbit']['user']
Expand All @@ -128,9 +148,11 @@
environment: node['errbit']['environment'],
host: node['errbit']['db']['host'],
port: node['errbit']['db']['port'],
database: node['errbit']['db']['database']
# username: node['errbit']['db']['username'],
# password: node['errbit']['db']['password']
database: node['errbit']['db']['database'],
username: node['errbit']['db']['username'],
password: node['errbit']['db']['password'],
identity_map_enabled: node['errbit']['db']['identity_map_enabled'],
use_utc: node['errbit']['db']['use_utc']
})
end

Expand All @@ -142,9 +164,9 @@
enable_submodules false
migrate false
before_migrate do
link "#{release_path}/vendor/bundle" do
to "#{node['errbit']['deploy_to']}/shared/vendor_bundle"
end
# link "#{release_path}/vendor/bundle" do
# to "#{node['errbit']['deploy_to']}/shared/vendor_bundle"
# end
common_groups = %w{development test cucumber staging production}
execute "bundle install --deployment --without #{(common_groups - ([node['errbit']['environment']])).join(' ')}" do
ignore_failure true
Expand All @@ -154,6 +176,7 @@

symlink_before_migrate nil
symlinks(
"config/initializers/__secret_token.rb" => "config/initializers/__secret_token.rb",
"config/config.yml" => "config/config.yml",
"config/mongoid.yml" => "config/mongoid.yml"
)
Expand Down
61 changes: 49 additions & 12 deletions templates/default/config.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,26 @@
# Errbit Config
# =============
#
# Copy this file to config/config.yml and
# modify it accordingly. This file will automatically
# be copied to shared/config on the server when
# `cap deploy:setup` is ran the first time. Be sure
# to place production specific settings there
# You will need to restart the server after changing any settings.

# The host of your errbit server
host: <%= @params[:host] %>

# The port for your errbit server.
# Only set this if it isn't the default for the protocol (i.e.. 80 for HTTP, 443 for HTTPS)
port: <%= @params[:port] %>

# The protocol for your errbit server.
# Only set if not running default HTTP
<% if @params[:https] %>
protocol: https
<% end %>

# Enforce SSL connections
enforce_ssl: <%= @params[:enforce_ssl] %>

Expand All @@ -22,8 +38,17 @@ per_app_email_at_notices: <%= @params[:per_app_email_at_notices] %>
# an email notification.
email_at_notices: <%= @params[:email_at_notices] %>

# Configure whether or not the user should be prompted before resolving an error.
confirm_resolve_err: <%= @params[:confirm_resolve_err] %>
# If you turn on this option, notify_at_notices can be
# configured on a per app basis, at the App edit page
per_app_notify_at_notices: <%= @params[:per_app_notify_at_notices] %>

# Configure when emails are sent for an error.
# [1,3,7] = 1st, 3rd, and 7th occurence triggers
# [0] for all notices, provided notification service is configured
notify_at_notices: <%= @params[:notify_at_notices] %>

# Configure whether or not the user should be prompted before resolving/deleting/merging/etc an error.
confirm_err_actions: <%= @params[:confirm_err_actions] %>

# Add an optional 'username' field to Users.
# Helpful when you need to plug in a custom authentication strategy, such as LDAP.
Expand All @@ -34,22 +59,29 @@ user_has_username: <%= @params[:user_has_username] %>
# but you want to leave a short comment.
allow_comments_with_issue_tracker: <%= @params[:allow_comments_with_issue_tracker] %>

# Display internal errors in production
# Since this is an internal application, you might like to see what caused Errbit to crash.
# Pull requests are always welcome!
# However, you might be more comfortable setting this to false if your server can be accessed by anyone.
display_internal_errors: <%= @params[:allow_comments_with_issue_tracker] %>

# Enable Gravatar.
use_gravatar: <%= @params[:use_gravatar] %>
# Default Gravatar image, can be: mm, identicon, monsterid, wavatar, retro.
gravatar_default: <%= @params[:gravatar_default] %>

# Setup your deploy options for capistrano.
deployment:
hosts:
web: errbit.example.com
app: errbit.example.com
db: errbit.example.com
repository: http://github.com/errbit/errbit.git
user: deploy
deploy_to: /var/www/apps/errbit
# setup path to unicorn pids folder (or deploy_to/shared/pids will be used)
# pids: /var/www/apps/errbit/shared/pids
# deployment:
# hosts:
# web: errbit.example.com
# app: errbit.example.com
# db: errbit.example.com
# repository: https://github.com/errbit/errbit.git
# branch: master
# user: deploy
# deploy_to: /var/www/apps/errbit
# # setup path to unicorn pids folder (or deploy_to/shared/pids will be used)
# # pids: /var/www/apps/errbit/shared/pids

# GitHub OAuth configuration
# If you want to allow authentication via GitHub, you will need to register
Expand Down Expand Up @@ -81,3 +113,8 @@ github_access_scope: <%= @params[:github_access_scope] %>
# :user_name: USERNAME
# :password: PASSWORD


# If you want send your email by your sendmail
# sendmail_settings:
# :location: '/usr/sbin/sendmail'
# :arguments: '-i -t'
24 changes: 22 additions & 2 deletions templates/default/mongoid.yml.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# Mongoid Configuration
# =====================
#
# Copy this file to config/mongoid.yml and
# modify it accordingly. This file will automatically
# be copied to shared/config on the server when
# `cap deploy:setup` is ran the first time. Be sure
# to place production specific settings there

# set these environment variables on your server
<%= @params[:environment] %>:
host: localhost
database: <%= @params[:database] %>
sessions:
default:
database: <%= @params[:database] %>
hosts:
- '<%= @params[:host] %>:<%= @params[:port] %>'
<% unless @params[:username].empty? || @params[:password].empty? %>
username: <%= @params[:username] %>
password: <%= @params[:password] %>
<% end %>
options:
identity_map_enabled: <%= @params[:identity_map_enabled] %>
use_utc: <%= @params[:use_utc] %>
4 changes: 2 additions & 2 deletions templates/default/nginx.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ upstream <%= node['errbit']['name'] %> {
# }

server {
listen 80 deferred;
listen <%= node['errbit']['config']['port'] %> deferred;
<% if @server_names %>
server_name <%= @server_names.join(" ") %>;
<% else %>
server_name <%= node['ipaddress'] %>
server_name <%= node['errbit']['config']['host'] %>;
<% end %>
client_max_body_size 4G;
keepalive_timeout 5;
Expand Down
1 change: 1 addition & 0 deletions templates/default/secret_token.rb.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Errbit::Application.config.secret_token = '<%= @params[:secret_token] %>'
1 change: 0 additions & 1 deletion templates/default/unicorn.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ working_directory "<%= node['errbit']['deploy_to']%>/current"
# use a shorter backlog for quicker failover when busy

listen "<%= node['errbit']['deploy_to']%>/shared/sockets/unicorn.sock", :backlog => <%= node[:unicorn][:backlog] %>
listen 8080, :tcp_nopush => true

timeout <%= node[:unicorn][:worker_timeout] %>

Expand Down