Commit Graph

33 Commits

Author SHA1 Message Date
Alan Guo Xiang Tan
f9789e974b
DEV: Reduce pool size for test environment to 1 (#25584)
Why this change?

I have been investigating transaction related issues with our system
tests and I have a hard time figuring out what is causing the problem.
To help simplify our environment further, we will set the pool size in
the test environment to 1 so that it is impossible for us to be fetching
a different connection between the threads since they all share the
connection pool.

Also set `reaping_frequency` to `0` to ensure we don't reap any
connection ensuring the same connection is always used.
2024-02-07 11:10:17 +08:00
Daniel Waterworth
50d527b80c
DEV: Remove db_timeout setting (#22912)
It doesn't actually do anything.
2023-08-01 14:17:43 -05:00
Daniel Waterworth
e0ece3a77e
Revert "DEV: Improve multisite db scripts in dev (#17337)" (#17801)
This reverts commit 2e4056d185.

Unfortunately, this broke db:create and db:drop when multisite config
wasn't present.
2022-08-04 16:15:06 -05:00
Gerhard Schlager
ff78a1eca7
DEV: Remove workaround for advisory lock (#17689)
This reverts f08d440ea0 because the issue has been resolved in Rails 6.1.0 and later.
2022-07-28 09:17:25 +08:00
Jarek Radosz
2e4056d185
DEV: Improve multisite db scripts in dev (#17337)
## Without multisite.yml config

No change. `bin/rails db:create` / `db:migrate` / `db:drop` should work the same.

## With multisite.yml config

### db:create

`bin/rails db:create` creates development, test, and all databases from the multisite config

`RAILS_DB=[site] bin/rails db:create` creates the database for the specified site from the multisite config

### db:migrate

`bin/rails db:migrate` migrates the development database and all databases from the multisite config

`RAILS_ENV=test bin/rails db:migrate` migrates the test database and `discourse_test_multisite`

`RAILS_DB=[site] bin/rails db:migrate` migrates the database for the specified site from the multisite config

### db:drop

`bin/rails db:drop` drops development, test, and all databases from the multisite config

`RAILS_DB=[site] bin/rails db:create` drops the database for the specified site from the multisite config
2022-07-06 10:39:03 +02:00
Ryan Lerch
1fffe941bf
remove some hardcoded 'localhost's from dev environment (#14801)
Trying to use a local test hostname other than localhost
(e.g. discourse.test )for discourse development was difficult due
the fact that localhost was hardcoded in a few places. This patch
uses existing environment variables to allow a developer to use a
different domain when developing.

Signed-off-by: Ryan Lerch <rlerch@redhat.com>
2021-11-03 11:26:44 +08:00
Josh Soref
59097b207f
DEV: Correct typos and spelling mistakes (#12812)
Over the years we accrued many spelling mistakes in the code base. 

This PR attempts to fix spelling mistakes and typos in all areas of the code that are extremely safe to change 

- comments
- test descriptions
- other low risk areas
2021-05-21 11:43:47 +10:00
Michael Brown
dda1cd6a38 FEATURE: allow setting postgres connection variables via environment 2021-04-14 13:31:32 -04:00
Guo Xiang Tan
f08d440ea0
DEV: Disable migration advisory locks in dev and test environment.
There is a bug in Rails that leaks an idle PG session which will prevent
the dropping of the database.
2020-08-25 14:20:58 +08:00
Sam Saffron
412e1ebbe2 DEV: correct parallel specs rake tasks
This used to work due to side effects.

`rake parallel:migrate` used to work very inconsistently and would only migrate
some of the databases.

This introduces the recommended change to db.yml so the correct database is
found based off TEST_ENV_NUMBER if for some reason we did not set it using
RAILS_DB

Also avoids a bunch of schema dumping which is not needed when migrating
parallel specs



DB number 1 is very odd cause for whatever reason parallel spec is not
setting it.
2019-12-31 14:07:55 +11:00
Guo Xiang Tan
8e5e5d7d35 DEV: Make setting up of multisite DB in test env clearer. 2019-03-21 09:58:07 +08:00
Penar Musaraj
3501533a2b DEV: unpin Prettier version, apply to YAML files
We had Prettier pinned because of https://github.com/prettier/prettier/issues/5529. Since that bug is fixed, unpinning.

Prettier now supports YAML, so this applies Prettier to all .yml except for translations, which should not be edited directly anyway.
2019-01-17 13:05:39 -05:00
Robin Ward
d333155cd5 Support user defined postgres timeouts 2017-10-27 09:59:44 -04:00
Guo Xiang Tan
d4388f54a2 FIX: Use exact patht to ensure we always redirect with the right format. 2017-09-28 10:29:41 +08:00
Guo Xiang Tan
a324a8a9d4 Bump test AR pool to 10 while I investigate. 2017-09-26 17:52:16 +08:00
Guo Xiang Tan
23b787e0a6 Require dependency otherwise it causes Sidekiq to lock up in development. 2017-09-25 13:48:59 +08:00
Robin Ward
153eca23e3 Switch Development Database via ENV var
This is useful if you use multiple development databases locally
and don't want to constantly `db:drop db:create` into
`discourse_development`.

Simply add `DISCOURSE_DEV_DB=whatever_db` as an ENV variable and
Discourse will use it in development mode.
2017-09-04 12:14:34 -04:00
Guo Xiang Tan
2c39743d5d Introduce multisite tests for better coverage. 2017-08-08 12:58:22 +09:00
Axel Naumann
20a08561bc Make PgSQL happy ("ActiveRecord::StatementInvalid: PG::ProtocolViolation").
See https://meta.discourse.org/t/install-error-protocol-violation-with-postgresql/35160
2016-03-30 10:42:06 +02:00
Sam
dfe3ecb914 PERF: disable prepared statements
see: https://github.com/rails/rails/issues/21992
2015-10-19 14:02:22 +11:00
Akshay
d64d3aa2e2 fixed a spelling benchamarking -> benchmarking 2014-08-14 10:16:57 +05:30
Sam
abe814412e Source DB config more cleanly, fixes issues with socket in prd 2014-01-15 12:08:35 +11:00
Sam
81eec5ff06 remove "host" so it uses sockets by default, easier to configure 2013-12-30 13:02:38 +11:00
Sam
b312b4d563 clean up config to use global settings 2013-12-20 15:12:23 +11:00
Sam
9cecabd023 don't warn unless in production 2013-12-19 09:59:44 +11:00
Sam
14d21ec865 improve config so you can use it with a socket optionally 2013-12-18 19:23:58 +11:00
Sam
a85333790f attempt to bypass setting port if socket is provided 2013-12-18 17:48:54 +11:00
Sam
a7421f8612 correct parsing 2013-12-18 17:21:01 +11:00
Sam
573e3bd348 fix error message 2013-12-18 17:17:12 +11:00
Sam
5232f0efd1 default to a db called postgres 2013-12-18 16:54:47 +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
Robin Ward
be9c374285 Oops, database.yml and redis.yml were still included 2013-02-12 11:32:32 -05:00
Robin Ward
21b5628528 Initial release of Discourse 2013-02-05 14:16:51 -05:00