Commit Graph

171 Commits

Author SHA1 Message Date
Guo Xiang Tan
16ab6430fe
DEV: Follow up to a078feee07 2020-04-29 14:24:48 +08:00
Guo Xiang Tan
a078feee07
DEV: Turn off ActiveRecord development color and query log by default.
It breaks logster.
2020-04-29 14:19:14 +08:00
Guo Xiang Tan
fa21c03a1d
DEV: Minor follow up to 1d04fb24f8 2020-04-29 14:09:19 +08:00
Guo Xiang Tan
1d04fb24f8
DEV: Enable all the ActiveRecord goodness in development env. 2020-04-29 14:08:00 +08:00
Guo Xiang Tan
5503eba924
DEV: Add env in dev to support verbose query log. 2020-04-29 11:10:57 +08:00
Sam Saffron
59a7afbde9
DEV: flag MRI specific gems
byebug, ruby-prof, better_errors and rbtrace are very MRI specific, flag
them as such

This helps move forward on potential jruby and truffleruby experiments
2020-02-18 11:04:56 +11:00
Martin Brennan
2050238d0c
DEV: Log to STDOUT if RAILS_ENABLE_TEST_LOG (#8650)
The env var `RAILS_ENABLE_TEST_LOG` didn't seem to do anything if enabled. This now sets the logger to STDOUT if `RAILS_ENABLE_TEST_LOG` is enabled and also introduces `RAILS_TEST_LOG_LEVEL` so the level of the logging in the console can be provided (default info).

Note: I am not sure if the original behaviour is expected. I can add an additional env var to enable the STDOUT logging if required
2020-01-03 09:58:01 +10:00
David Taylor
bc4c40abd4
DEV: Remove unsafe-eval from development CSP (#8569)
- Refactor source_url to avoid using eval in development
- Precompile handlebars in development
- Include template compilers when running qunit
- Remove unsafe-eval in development CSP
- Include unsafe-eval only for qunit routes in development
2019-12-30 12:17:12 +00:00
Penar Musaraj
78969d7719 DEV: Support custom log level in dev
See https://guides.rubyonrails.org/debugging_rails_applications.html#log-levels
Can be used to reduce noise when running "bundle exec rails server" in dev.

Setting DISCOURSE_DEV_LOG_LEVEL="warn" will make for easier puts debugging with unicorn.
2019-12-06 10:57:10 -05:00
David Taylor
1b8be069e5
DEV: Disable better_errors when developing with more than one worker (#8201)
From the better_errors README:

> Better Errors works by leaving a lot of context in server process memory. If you're using a web server that runs multiple "workers" it's likely that a second request (as happens when you click on a stack frame) will hit a different worker. That worker won't have the necessary context in memory, and you'll see a Session Expired message.
2019-10-16 14:44:48 +01:00
Krzysztof Kotlarek
0bf55fe2ff
Revert "FIX: public_file_server.enabled is false in test (#8192)" (#8196)
This reverts commit 5a8fdd02fe.
2019-10-16 10:39:31 +11:00
Krzysztof Kotlarek
5a8fdd02fe FIX: public_file_server.enabled is false in test (#8192)
After a small conversation, we decided that we can set `public_file_server.enabled` to false in the `test` environment to have the same value as `production`.
2019-10-16 09:18:48 +11:00
Sam Saffron
b282c893b2 DEV: support multiple hosts in dev
This renames the DISCOURSE_ENV_HOST var @eviltrout introduced in 95a9a544
to DISCOURSE_ENV_HOSTS and allows for a comma delimited list of hosts

This is useful for testing plugins and customized host names
2019-09-17 16:01:39 +10:00
Robin Ward
95a9a544c9 DEV: Allow custom hosts in development mode
Rails 6 seems to introduce a whitelist of allowed hosts. I personally
use `dev.local` for development and this no longer works.

This introduces a new ENV variable, `DISCOURSE_DEV_HOST`. If present,
it will whitelist that host for development mode.
2019-09-12 13:12:06 -04: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
Sam Saffron
88650a1259 PERF: avoid checking for consecutive replies in test
This check can issue up to 2 queries per post created, we have specific
tests for it so we can avoid.

This also rolls back #4da6ca4d
2019-05-09 13:28:53 +10: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
Robin Ward
fa5a158683 REFACTOR: Move queue_jobs out of SiteSetting
It is not a setting, and only relevant in specs. The new API is:

```
Jobs.run_later!        # jobs will be thrown on the queue
Jobs.run_immediately!  # jobs will run right away, avoid the queue
```
2019-03-14 10:47:38 -04:00
Régis Hanol
3c9c95ac83 Update Rubocop to 0.60 2018-12-04 10:48:16 +01:00
Guo Xiang Tan
12a0f12530 Fix the build. 2018-06-01 11:24:32 +08:00
Guo Xiang Tan
50be06af47 Remove stale code. 2018-06-01 08:18:59 +08:00
Sam
ec337bbcb3 DEV: attempt to report last exception as the "cause" for failures
This allows our request specs to report exceptions so we can debug

May have a few false positives but generally should be quiet

TODO only wire magic in for request specs, currently happens for all
2018-05-21 17:01:50 +10:00
Sam
800760e353 also watch CSS in unicorn on dev 2018-03-09 17:47:57 +11:00
Arpit Jalan
25ec077eca rename 'min_private_message_{post/title}_length' to 'min_personal_message_{post/title}_length' 2018-02-01 13:25:29 +05:30
Sam
49ed382c2a FIX: return 429 when admin api key is limited on admin route
This also handles a general case where exceptions leak out prior to being handled by the application controller
2018-01-12 14:15:26 +11: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
4e89d3f778 Only refresh site settings once on initialization. 2017-10-12 14:12:18 +08:00
Guo Xiang Tan
3f24ed2b3e Can't revert due to incompatibility of new site setting types.
Revert "Revert "FEATURE: Site settings defaults per locale""

This reverts commit 439fe8ba24.
2017-08-07 10:43:09 +09:00
Guo Xiang Tan
439fe8ba24 Revert "FEATURE: Site settings defaults per locale"
This reverts commit 468a8fcd20.
2017-08-07 10:31:50 +09:00
Erick Guan
468a8fcd20 FEATURE: Site settings defaults per locale
This change-set allows setting different defaults for different locales. 

It also:

- Adds extensive testing around site setting validation

- raises deprecation error if site setting has the default property based on env

- relocated site settings for dev and tests in the initializer

- deprecated client_setting in the site setting's loading process

- ensure it raises when a enum site setting being set

- default_locale is promoted to `required` category.

- fixes incorrect default setting and validation

- fixes ensure type check for site settings

- creates a benchmark for site setting

- sets reasonable defaults for Chinese
2017-08-02 12:24:19 -04:00
Guo Xiang Tan
5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Robin Ward
7fb62bdab4 Enable logging behind ENV var for test mode 2017-07-13 11:38:17 -04:00
Robin Ward
95b9ea1222 Makes tests run slightly faster.
see:
https://jtway.co/speed-up-your-rails-test-suite-by-6-in-1-line-13fedb869ec4
2017-07-13 11:35:24 -04:00
Sam
492eed70ab correct with brackets 2017-06-20 15:53:14 -04:00
Sam
9f8388c2eb FIX: start filesystem watcher when running under rails s 2017-06-20 15:44:01 -04:00
Jay Pfaffman
0da8bdca73 Update development.rb 2017-06-08 13:07:51 -07: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
473363e0fa only enable bullet on demand 2016-07-05 11:10:42 +10:00
Guo Xiang Tan
4a143d584b
Don't log bullet alerts in the console. 2016-06-29 09:36:32 +08:00
Guo Xiang Tan
3e07658fb2
Don't alert. 2016-06-28 11:53:45 +08:00
Guo Xiang Tan
9ed79d8ecd
Add Bullet gem to detect N+1 queries. 2016-06-28 09:29:42 +08:00
Régis Hanol
5943483ef5 nope nope nope 2016-06-03 17:25:39 +02:00
Régis Hanol
9704603fab FEATURE: sendgrid webhooks 2016-06-01 21:48:06 +02: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
2599b94920 ignore uploads for mini profiler 2015-04-17 12:16:37 +10:00
Robin Ward
c7d367996a PERF: Concatenate scripts in development mode
This improves my DOMContentLoaded from 9s+ to less than 4s.
Pinging @SamSaffron on this because this was previously controversial.

This implementation adds the `@sourceURL` directive so chrome correctly
identifies the source files.
2015-04-16 15:40:23 -04:00
Arpit Jalan
c84b51d4ae FEATURE: show exact error for test email 2014-11-19 22:58:59 +05:30
Sam
85e5e912b2 be explicit about log level 2014-11-17 18:03:11 +11:00
Sam
34180eba93 FIX: official benchmark crashing while populating db 2014-11-11 10:28:17 +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
0a14d80f4a Don't specify uglifier in dev 2014-10-15 16:23: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
Godfrey Chan
2dd2b70994 *Don't* silence the deprecation warnings in test
This is actually where we are most likely to see it (and we should try to deal
with those as soon as possible, ideally when upgrading).
2014-10-11 15:02:15 -07:00
Akshay
7cd8b4f329 raise migration error in development if pending migrations 2014-10-04 07:02:30 +05:30
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
Sam
7e7c4efcc0 FEATURE: on initial boot hint users on how to get admin 2014-03-24 18:03:39 +11:00
Sam
76c7d42027 require rbtrace in development cause it is handy 2014-03-18 15:22:53 +11: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
Robin Ward
18e719b0af In development mode, if an avatar is missing just serve up a placeholder 2014-01-17 11:47:23 -05: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
66afabcf4c stop messing with asset pipeline defaults
stripping postfixes is wasteful and uneeded. It messes up our build
2013-12-19 12:33:17 +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
646cca3128 Good luck getting this updated everywhere, kicking myself really hard for allowing these stupid sample files
see: http://meta.discourse.org/t/enough-with-the-sample-files/10351

Our default sample setup was not minifying css or js causing js and css to be 2.5x larger than it needed

Anyone using my docker setup, please run a new bootstrap. Anyone else, apply diff manually.
2013-12-16 18:21:24 +11:00
Régis Hanol
78b2c5acff use CDN_URL environement variable in production 2013-11-29 18:35:29 +01:00
Sam
9d13c6b931 we need this eager load thing 2013-11-26 15:16:56 +11:00
Régis Hanol
eb9c1f28ed add debug mode to autospec 2013-11-05 11:01:17 +01:00
Sam
a2efe27a58 allow compile in profile. 2013-11-05 14:12:26 +11:00
Sam
8ff35d4b10 automatically make developers admins on account creation, this solves the user #1 problem
you can simply set the DEVELOPER_EMAILS to a comma delimited list and the users will be auto admined
2013-11-02 10:26:02 +11:00
Faraz Yashar
69460b8f9b Remove best standards support for Rails 4 since it's been removed from ActionDispatch 2013-10-17 15:36:18 -04:00
Sam
3d647a4b41 remove rack cache, it has been causing trouble
instead implement an aggressive anonymous cache that is stored in redis
this cache is sitting in the front of the middleware stack enabled only in production
TODO: expire it more intelligently when stuff is created
2013-10-16 16:39:18 +11:00
Cyril Rohr
a7b8481c8f Allow to set SMTP settings via environment variable. 2013-10-08 15:48:57 +01:00
Sam
9c6c0f2a3d enable eager loading in profile mode
correct bench script
2013-09-10 16:22:58 +10:00
Sam
3d9496f5d3 disable compilation in profile mode, you must precompile 2013-09-10 16:02:16 +10:00
Sam
5b08f73561 give god rights of impersonation to developers, must be edited into the production.rb config file 2013-09-05 10:27:34 +10:00
Sam
22f2a0c1f4 update rails 4, use log level info in profile for better accuracy 2013-09-04 09:39:16 +10:00
Sam
b41fa4988a update rails 4
ensure you clear the tmp/cache folder on each bench (so results are correct, there is an incompat upgrade)
add facter gem which will be used to collect hardware data from the bencher
2013-08-29 21:23:00 +10:00
Sam
1d74cc60a1 don't try sending emails out in profile mode 2013-08-19 11:33:38 +10:00
Sam
9e4b0df7ff 69 specs fail in rails 4 now ...not too bad 2013-07-22 15:07:20 +10:00
Sam
5086f48784 reloading classes is just trouble in test, lets not do that so spork is squeaky clean and happy. 2013-07-08 12:10:47 +10:00
Neil Lalonde
ceee8ed63b Put back mailcatcher config in development.rb 2013-07-05 11:32:54 -04:00