Commit Graph

47 Commits

Author SHA1 Message Date
Daniel Waterworth
897be75941 FIX: Don't set smtp authentication type when there's no user or password
... otherwise net-smtp, starting with 0.5.0, complains.
2024-03-27 14:20:29 -05:00
Alan Guo Xiang Tan
5cfe323445
PERF: Strict loading for SidebarSection queries (#21717)
What is this change required?

I noticed that actions in `SidebarSectionsController` resulted in
lots of N+1 queries problem and I wanted a solution to
prevent such problems without having to write N+1 queries tests. I have
also used strict loading for `SidebarSection` queries in performance
sensitive spots.

Note that in this commit, I have also set `config.active_record.action_on_strict_loading_violation = :log`
for the production environment so that we have more visibility of
potential N+1 queries problem in the logs. In development and test
environment, we're sticking with the default of raising an error.
2023-05-25 09:10:32 +08:00
Benno Fünfstück
24188beaaf
FEATURE: log to STDOUT using Rails 5 env var (#18880)
Rails introduced a environment variables RAILS_LOG_TO_STDOUT in the
template for new projects here: https://github.com/rails/rails/pull/23734

This commit adds the same code to the discourse production environment,
making it easy to configure logging to stdout in production for
environments which already support log collection via stdout.
2023-03-01 07:06:14 +08:00
David Taylor
7c77cc6a58
DEV: Apply syntax_tree formatting to config/* 2023-01-09 11:13:29 +00:00
David Taylor
84bec1cbae
DEV: Cleanup legacy asset compilation gems and code (#19177)
We now use Ember CLI (core/plugins) and DiscourseJSProcessor (themes) for all Ember and template compilation. This commit removes the remnants of the legacy Sprockets-based Ember compilation system.

Sprockets, and its DiscourseJSProcess-based Babel transformations, is still in use for a few assets. Ideally that will be removed/replaced in the near future.
2022-11-24 12:13:59 +00:00
Roland
3a37a7f6b4
FEATURE: Allow configuration of smtp timeout settings (#17863)
Adds DISCOURSE_SMTP_OPEN_TIMEOUT and DISCOURSE_SMTP_READ_TIMEOUT GlobalSettings that allow site admins to configure the SMTP connection behavior to match the needs of their SMTP server.
2022-08-15 12:14:09 -03:00
Loïc Guitaut
fff3ff11c0 FIX: Make disabling TLS in mail possible again
Following the Rails 7 upgrade, the `DISCOURSE_SMTP_ENABLE_START_TLS`
setting doesn’t work anymore. This is because Rails upgraded the
`net-smtp` gem to the 0.3.1 version which enables `starttls` by default.
The `mail` gem doesn’t support this new behavior yet and doesn’t know
how to disable TLS. This should be fixed in an upcoming release.

Meanwhile applying this patch allows us to get back the previous
behavior which is expected by many.
2022-06-08 14:04:05 +02:00
David Taylor
65164bf189
FIX: Do not dump schema during production database migrations (#12785)
It's important that we don't perform pg_dumps against databases
running behind pgbouncer.

We had an old monkey-patch to prevent this, but following some [recent
internal rails refactoring](5488686851),
the patch no longer works. Instead, we can use the official
`config.active_record.dump_schema_after_migration` option.

Setting this to false in production is recommended by Rails, and is the
default for newly generated Rails applications.
2021-04-21 16:26:20 +01:00
godmar
9aeece465f
FEATURE: support DISCOURSE_SMTP_FORCE_TLS option (#11733)
Background: RFC 8314 3.3 asks that:

clients and servers SHOULD implement both STARTTLS on
port 587 and Implicit TLS on port 465

Discourse currently cannot be configured this way.
With this patch, it's possible to set
DISCOURSE_SMTP_FORCE_TLS=true to use implicit TLS on port 465
2021-01-18 11:56:18 -05:00
David Taylor
33bd47164f DEV: Re-enable uglifier for non-precompiled assets
Keep `harmony` disabled
2019-05-14 10:28:18 +01:00
David Taylor
f12709e24c DEV: Temporarily disable uglifier for non-precompiled assets
This is causing performance issues which require further investigation
2019-05-14 09:34:38 +01:00
Sam Saffron
30990006a9 DEV: enable frozen string literal on all files
This reduces chances of errors where consumers of strings mutate inputs
and reduces memory usage of the app.

Test suite passes now, but there may be some stuff left, so we will run
a few sites on a branch prior to merging
2019-05-13 09:31:32 +08:00
Penar Musaraj
d9ab722d05 Revert "Revert "PERF: Skip compressing locales for faster rebuilds (#7501)" (#7502)"
This reverts commit 6ea811c923.
2019-05-08 14:55:06 -04:00
Joffrey JAFFEUX
6ea811c923
Revert "PERF: Skip compressing locales for faster rebuilds (#7501)" (#7502) 2019-05-08 07:54:21 +02:00
Penar Musaraj
b9d8281818 PERF: Skip compressing locales for faster rebuilds (#7501)
* Do not brotli all locales in precompile

* Try without gzip

* uglify without compressing, always gzip

* skip uglify for unused locales

* FIX: Uglifier needs harmony for ES6 compatibility

* Use node uglifier if available

* Minor refactor
2019-05-08 10:22:19 +10:00
Régis Hanol
3c9c95ac83 Update Rubocop to 0.60 2018-12-04 10:48:16 +01:00
Régis Hanol
7ab49acac2 FIX: 'config.serve_static_files' was renamed to 'config.public_file_server.enabled' in Rails 5.1 2017-10-27 18:46:09 +02:00
Guo Xiang Tan
5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Sam
a3e8c3cd7b FEATURE: Native theme support
This feature introduces the concept of themes. Themes are an evolution
of site customizations.

Themes introduce two very big conceptual changes:

- A theme may include other "child themes", children can include grand
children and so on.

- A theme may specify a color scheme

The change does away with the idea of "enabled" color schemes.

It also adds a bunch of big niceties like

- You can source a theme from a git repo

- History for themes is much improved

- You can only have a single enabled theme. Themes can be selected by
    users, if you opt for it.

On a technical level this change comes with a whole bunch of goodies

- All CSS is now compiled using a custom pipeline that uses libsass
    see /lib/stylesheet

- There is a single pipeline for css compilation (in the past we used
    one for customizations and another one for the rest of the app

- The stylesheet pipeline is now divorced of sprockets, there is no
   reliance on sprockets for CSS bundling

- CSS is generated with source maps everywhere (including themes) this
    makes debugging much easier

- Our "live reloader" is smarter and avoid a flash of unstyled content
   we run a file watcher in "puma" in dev so you no longer need to run
   rake autospec to watch for CSS changes
2017-04-12 10:53:49 -04:00
Sam
bd9bc7918c FIX: downcase developer emails do it matches internal email storage 2016-05-27 12:18:54 +10:00
Guo Xiang Tan
9e25e4baa8
[CI SKIP] Typo. 2016-04-18 11:40:04 +08:00
Sam
613761d1cd FEATURE: upgrade to Rails 4.2.4 2015-09-23 15:24:30 +10:00
Kane York
ecfa17b5a7 FEATURE: Localization fallbacks (server-side)
The FallbackLocaleList object tells I18n::Backend::Fallbacks what order the
languages should be attempted in. Because of the translate_accelerator patch,
the SiteSetting.default_locale is *not* guaranteed to be fully loaded after the
server starts, so a call to ensure_loaded! is added after the locale is set for
the current user.

The declarations of config.i18n.fallbacks = true in the environment files were
actually garbage, because the I18n.default_locale was
SiteSetting.default_locale, so there was nothing to fall back to. *derp*
2015-07-15 10:17:36 -07:00
Sam
85e5e912b2 be explicit about log level 2014-11-17 18:03:11 +11:00
Robin Ward
65ab88da77 Let's try to change Uglifier settings properly 2014-10-15 16:51:16 -04:00
Robin Ward
bc01589ea5 Add screw_ie8 setting 2014-10-15 16:28:06 -04:00
Robin Ward
42d9dedad1 Check if Uglifier is defined (we're precompiling assets) 2014-10-15 16:08:00 -04:00
Robin Ward
8a6f9425d4 Fix uglifier args 2014-10-15 16:00:45 -04:00
Robin Ward
309144d9fc Let's try telling uglifier to user 1k lines 2014-10-15 15:55:55 -04:00
Sam
68a3fd5ef0 FIX: developer emails not working on ruby 2.0 2014-08-30 09:07:30 +10:00
Sam
b7e8bcda07 FIX: strip leading/trailing spaces from developer emails 2014-08-29 12:21:33 +10:00
Akshay
6301a43d57 Not initializing variable for looping if unused in loop 2014-08-15 03:24:55 +05:30
Sam
9468ebeb2e CHANGE: Mini Profiler only enabled for developers in prd 2014-07-17 08:34:41 +10:00
Sam
6019e3f257 FIX: remove hardcoding from middleware stack so we can control it 2014-07-10 17:01:21 +10:00
Sam
97373535c8 A regression here worries me too much 2014-05-14 11:27:29 +10:00
Claus Strasburger
b53248178b Added openssl_verify_mode parameter for action_mailer.
- parameter in `environments/production.rb`
- documentation & default value (nil) in `discourse_defaults.conf`
2014-05-08 22:21:36 +02:00
Stephan Kaag
f12925887c Drop Rails3 support 2014-02-17 19:42:08 +01:00
Sam
73aca9063d FEATURE: allow overriding server static asset if needed 2014-02-17 10:44:37 +11:00
Vikhyat Korrapati
6d50504a83 Make SMTP authentication mechanism configurable. 2014-01-06 18:19:42 +05:30
illspirit
1b2e3bf141 Fix smtp settings, added password 2013-12-20 20:50:17 -05:00
Sam
bac2d21382 strip out nil settings from config 2013-12-20 19:12:08 +11:00
Sam
b312b4d563 clean up config to use global settings 2013-12-20 15:12:23 +11:00
Sam
ffffee3ae1 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
2013-12-18 16:46:37 +11:00
Sam
850b042cab introduce rack:cache as a default, so users don't need to configure apache or nginx
under rack cache we are able to serve 620reqs a second per thin (on my machine) before it 12 (on my machine)

reorganised so mini profilers can be cleanly disabled from config file

added caching for categories index

move production.rb to production.sample.rb
2013-04-11 16:24:21 +10:00
Gosha Arinich
cafc75b238 remove trailing whitespaces ❤️ 2013-02-26 07:31:35 +03:00
Robin Ward
928e215e57 Update to latest Ember.js 2013-02-19 12:28:18 -05:00
Robin Ward
21b5628528 Initial release of Discourse 2013-02-05 14:16:51 -05:00