diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/attributes/default.rb b/attributes/default.rb index 60fc1a5..3abf5a1 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -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"] = { diff --git a/definitions/sentry_conf.rb b/definitions/sentry_conf.rb index dddaf24..6561fd3 100644 --- a/definitions/sentry_conf.rb +++ b/definitions/sentry_conf.rb @@ -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" @@ -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 @@ -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 @@ -78,6 +97,8 @@ 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' @@ -85,6 +106,8 @@ class Chef::Recipe 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 diff --git a/templates/default/sentry.conf.erb b/templates/default/sentry.conf.erb index b691636..9e69525 100644 --- a/templates/default/sentry.conf.erb +++ b/templates/default/sentry.conf.erb @@ -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 %>