From ffffee3ae1695e3907e0699d979eeb6ff68edd64 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 18 Dec 2013 16:46:37 +1100 Subject: [PATCH] IMPORTANT - removed all sample files This is very likely to cause merge conflict, it is for the greater good Discuss at: http://meta.discourse.org/t/enough-with-the-sample-files/10351 From now on we use ENV to customise if needed --- .gitignore | 3 -- ...se.yml.development-sample => database.yml} | 28 +++++++------ config/database.yml.production-sample | 27 ------------ .../{production.rb.sample => production.rb} | 41 +++++-------------- config/{redis.yml.sample => redis.yml} | 0 5 files changed, 26 insertions(+), 73 deletions(-) rename config/{database.yml.development-sample => database.yml} (67%) delete mode 100644 config/database.yml.production-sample rename config/environments/{production.rb.sample => production.rb} (67%) rename config/{redis.yml.sample => redis.yml} (100%) diff --git a/.gitignore b/.gitignore index e543785c0..b06ef0f02 100644 --- a/.gitignore +++ b/.gitignore @@ -23,10 +23,7 @@ public/plugins/* /public/assets/* -config/database.yml -config/redis.yml config/discourse.pill -config/environments/production.rb # Ignore the default SQLite database and db dumps /db/*.sqlite3 diff --git a/config/database.yml.development-sample b/config/database.yml similarity index 67% rename from config/database.yml.development-sample rename to config/database.yml index 5f4c18eaa..427a00094 100644 --- a/config/database.yml.development-sample +++ b/config/database.yml @@ -25,19 +25,7 @@ test: host_names: - test.localhost -# using the test db, so jenkins can run this config -# we need it to be in production so it minifies assets -production: - adapter: postgresql - database: discourse_development - pool: 5 - timeout: 5000 - host_names: - ### If you change this setting you will need to - ### - restart sidekiq if you change this setting - ### - rebake all to posts using: `RAILS_ENV=production bundle exec rake posts:rebake` - - production.localhost # Update this to be the domain of your production site - +# profile db is used for benchamarking using the script/bench.rb script profile: adapter: postgresql database: discourse_profile @@ -47,3 +35,17 @@ profile: timeout: 5000 host_names: - "localhost" + +production: + pool: <%= ENV['POSTGRES_CONNECTION_POOL'] || 5 %> + timeout: 5000 + adapter: postgresql + uri: <%= uri = URI.parse(ENV['POSTGRES_URL']) %> + socket: <%= ENV['POSTGRES_SOCKET'] %> + host: <%= uri.host %> + port: <%= uri.port || 5432 %> + database: <%= ENV['POSTGRES_DB'] %> + username: <%= uri.user %> + password: <%= uri.password %> + host_names: + - <%= ENV["DISCOURSE_HOSTNAME"] || raise "env var for DISCOURSE_HOSTNAME must be set" %> # Update this to be the domain of your production site diff --git a/config/database.yml.production-sample b/config/database.yml.production-sample deleted file mode 100644 index ea0af3e8a..000000000 --- a/config/database.yml.production-sample +++ /dev/null @@ -1,27 +0,0 @@ -production: - adapter: postgresql - database: discourse_prod - # username: discourse_prod # if using username/password auth - # password: itisagooddaytovi # if using username/password auth - # host: dbhost # if not localhost - pool: 5 # size of DB connection pool *per process* - timeout: 5000 - # db_id: 0 # database ID if hosting multiple sites - host_names: - ### Don't include the port number here. Change the "port" site setting instead, at /admin/site_settings. - ### If you change this setting you will need to - ### - restart sidekiq if you change this setting - ### - rebake all to posts using: `RAILS_ENV=production bundle exec rake posts:rebake` - - <%= ENV["DISCOURSE_HOSTNAME"] || "production.localhost" %> # Update this to be the domain of your production site - -test: - adapter: postgresql - database: discourse_test - # username: discourse_test - # password: 123123123123 - min_messages: warning - host: localhost - pool: 5 - timeout: 5000 - host_names: - - test.localhost diff --git a/config/environments/production.rb.sample b/config/environments/production.rb similarity index 67% rename from config/environments/production.rb.sample rename to config/environments/production.rb index 2855e6b46..4c47e32d7 100644 --- a/config/environments/production.rb.sample +++ b/config/environments/production.rb @@ -3,7 +3,6 @@ Discourse::Application.configure do # Code is not reloaded between requests config.cache_classes = true - config.eager_load = true # Full error reports are disabled and caching is turned on @@ -13,12 +12,12 @@ Discourse::Application.configure do # Disable Rails's static asset server (Apache or nginx will already do this) config.serve_static_assets = false - # Compress JavaScripts and CSS - config.assets.compress = true - - # rails 4 - config.assets.js_compressor = :uglifier - config.assets.css_compressor = :sass + if rails4? + config.assets.js_compressor = :uglifier + config.assets.css_compressor = :sass + else + config.assets.compress = true + end # stuff should be pre-compiled config.assets.compile = false @@ -33,30 +32,19 @@ Discourse::Application.configure do # the I18n.default_locale when a translation can not be found) config.i18n.fallbacks = true - - # you may use other configuration here for mail eg: sendgrid - - # config.action_mailer.delivery_method = :smtp - # config.action_mailer.smtp_settings = { - # :address => "smtp.sendgrid.net", - # :port => 587, - # :domain => 'YOUR DOMAIN', - # :user_name => 'YOUR_USER', - # :password => 'YOUR_PASSWORD', - # :authentication => 'plain', - # :enable_starttls_auto => true } - + # specify your smtp url using the SMTP_URL env var eg: + # SMTP_URL=smtp://user:password@myhost.com if ENV.key?('SMTP_URL') config.action_mailer.smtp_settings = begin uri = URI.parse(ENV['SMTP_URL']) params = { :address => uri.host, - :port => uri.port, + :port => uri.port || 25, :domain => (uri.path || "").split("/")[1], :user_name => uri.user, :password => uri.password, :authentication => 'plain', - :enable_starttls_auto => true + :enable_starttls_auto => !ENV['SMTP_DISABLE_TLS'] } CGI.parse(uri.query || "").each {|k,v| params[k.to_sym] = v.first} params @@ -75,14 +63,7 @@ Discourse::Application.configure do config.handlebars.precompile = true # allows admins to use mini profiler - config.enable_mini_profiler = true - - # allows Cross-origin resource sharing (CORS) for API access in JavaScript (default to false for security). - # See the initializer and https://github.com/cyu/rack-cors for configuration documentation. - # - # config.enable_rack_cors = false - # config.rack_cors_origins = ['*'] - # config.rack_cors_resource = ['*', { :headers => :any, :methods => [:get, :post, :options] }] + config.enable_mini_profiler = !ENV["DISABLE_MINI_PROFILER"] # Discourse strongly recommend you use a CDN. # For origin pull cdns all you need to do is register an account and configure diff --git a/config/redis.yml.sample b/config/redis.yml similarity index 100% rename from config/redis.yml.sample rename to config/redis.yml