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
@@ -0,0 +1 @@
.DS_Store
4 changes: 3 additions & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@

# Email settings
default["sentry"]["settings"]["email"] = {
"backend" => 'django.core.mail.backends.smtp.EmailBackend',
"backend" => 'django_mailgun.MailgunBackend',
"host" => "localhost",
"password" => '',
"user" => '',
"port" => 25,
"use_tls" => 'False',
}
default["sentry"]["settings"]["mailgun_access_key"] = ""
default["sentry"]["settings"]["mailgun_server_name"] = ""

# Social settings
default["sentry"]["settings"]["social"] = {
Expand Down
25 changes: 24 additions & 1 deletion definitions/sentry_conf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ class Chef::Recipe
:settings => {} do

Chef::Log.info("Making sentry config for: #{params[:name]}")

package "python-dev" do
action :install
end

include_recipe "python::virtualenv"
include_recipe "python::pip"
include_recipe "sentry::default"
Expand All @@ -36,7 +41,8 @@ class Chef::Recipe

settings_variables = params[:settings]
config = params[:config] || node["sentry"]["config"]
settings_variables["config"] = config
# settings_variables.set["config"] = config


Chef::Log.info("Making directory for virtualenv: #{virtualenv_dir}")
# Making application virtualenv directory
Expand Down Expand Up @@ -66,6 +72,19 @@ class Chef::Recipe
variables(settings_variables.to_hash)
end

deps = ["setproctitle", "python-openid", "oauth2", "six", "kombu", "billiard", "pytz", "django-mailgun"]

deps.each do |dep|
Chef::Log.info("Install #{dep} dependency")
python_pip dep do
user params[:user]
group params[:group]
provider Chef::Provider::PythonPip
virtualenv virtualenv_dir
action :install
end
end

# Intstall sentry via pip
python_pip "sentry" do
provider Chef::Provider::PythonPip
Expand All @@ -78,13 +97,17 @@ class Chef::Recipe

# Install database drivers
node['sentry']['settings']['databases'].each do |key, db_options|
Chef::Log.info("DB: #{key}: #{db_options}")

driver_name = nil
if db_options['ENGINE'] == 'django.db.backends.postgresql_psycopg2'
driver_name = 'psycopg2'
elsif db_options['ENGINE'] == 'django.db.backends.mysql'
driver_name = 'MySQLdb'
elsif db_options['ENGINE'] == 'django.db.backends.oracle'
driver_name = 'cx_Oracle'
elsif db_options['ENGINE'] == 'django.db.backends.sqlite3'
driver_name = nil
else
raise "You need specify database ENGINE"
end
Expand Down
14 changes: 9 additions & 5 deletions templates/default/sentry.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@ SENTRY_KEY = "<%= @private_key %>"

EMAIL_BACKEND = "<%= @email['backend'] %>"

EMAIL_HOST = "<%= @email['host'] %>"
EMAIL_HOST_PASSWORD = "<%= @email['password'] %>"
EMAIL_HOST_USER = "<%= @email['user'] %>"
EMAIL_PORT = <%= @email['port'] %>
EMAIL_USE_TLS = <%= @email['use_tls'] || "False" %>
#EMAIL_HOST = "<%= @email['host'] %>"
#EMAIL_HOST_PASSWORD = "<%= @email['password'] %>"
#EMAIL_HOST_USER = "<%= @email['user'] %>"
#EMAIL_PORT = <%= @email['port'] %>
#EMAIL_USE_TLS = <%= @email['use_tls'] || "False" %>

# MailGun
MAILGUN_ACCESS_KEY = "<%= @mailgun_access_key %>"
MAILGUN_SERVER_NAME = "<%= @mailgun_server_name %>"


<% for network, params in @social %>
Expand Down