Commit Graph

19 Commits

Author SHA1 Message Date
Javi Martín
210a91bd8f Use postgreSQL 14 as postgres Docker image
PostgreSQL 13 will reach its end-of-life on November 13, 2025. So we're
upgrading before that happens.

We're also upgrading to PostgreSQL 14 in our CI. In this case, we're
using the default distribution (Trixie, as of October 2025); it doesn't
affect the development or production environments, so it's OK if use the
default one.
2025-10-17 14:00:52 +02:00
Javi Martín
170530e52e Unify database configuration files
We had three files that were almost identical, and we can use
environment variables to specify the differences.

Note we're using the `PGUSER` and `PGPASSWORD` variables, since these
variables will automatically be used by the PostgreSQL client when we
have a blank `username` and `password` keys in the `database.yml` file
(which we did until now). The difference between these variables and the
`POSTGRES_USER` and `POSTGRES_PASSWORD` variables is that the `PG`
variables are used by the client connecting to the database, while the
`POSTGRES_` variables are used by the Docker postgresql image when
creating the database superuser.

For consistency with the code in our github workflows (and everywhere
else in the postgres world), we're respecting this double standard. The
fact that there are two different names for what's basically the same
thing makes the code confusing, though, particularly when running the
docker-compose commands, since we get the password from an environment
variable but we have to assign two different environment variables with
it.

So we're accepting both `PGPASSWORD` and `POSTGRES_PASSWORD` variables
in the database configuration file. This way, developers using
docker-compose can use `POSTGRES_PASSWORD` for everything and it'll work
fine. We're also making `PGPASSWORD` default to `POSTGRES_PASSWORD` so
we don't get a warning if we only set `POSTGRES_PASSWORD`:

```
WARN[0000] The "PGPASSWORD" variable is not set. Defaulting to a blank
string.
```

Also note we're using `DB_HOST` instead of `PGHOST` because that's the
variable Rails currently uses by default for new applications [1].

Finally, note we're using `.presence` in the `ENV` calls in the
database.yml file. The `PGPASSWORD` variable was set to an empty string
when running docker-compose, so using `ENV["PGPASSWORD"] ||` wouldn't
work.

[1] https://github.com/rails/rails/blob/c90a8701e5/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt#L22
2024-10-07 15:23:40 +02:00
Javi Martín
d86299f44d Add documentation to run tests with Docker 2024-09-19 15:41:32 +02:00
Javi Martín
b3facb39bf Don't use an image to show the results of docker ps
The alternative text of the image was useless, and we were depending on
an external server in order to display it. Furthermore, the text inside
the image was pretty small.

So we're displaying the output of the command as plain text.
2024-09-19 15:20:38 +02:00
Javi Martín
d88ea7f26d Use build+create in Docker installation instructions
There was a typo where we said we were creating the containers but we
were building the image.

While none of these commands are necessary because they're run
automatically when first running the `db:create` rake task, I think it's
better to show them separately, since the `build` command might be used
to rebuild the image, and running the `create` command separately makes
it easier to know what's going on.

We're also removing the "start database service" step, since it's
automatically started because the app service depends on it.

Finally, we're updating one command for macOS.
2024-09-19 15:20:38 +02:00
Javi Martín
2f5ddfd77e Simplify documentation to install Docker
Docker and Docker Compose are included in most Linux distributions, and
we don't know whether the windows error we talked about is still
relevant in 2024. In any case, the Docker documentation to install
windows is a better resource for that than our documentation.

We're also using the same Docker commands for every operating system.
2024-09-19 15:20:14 +02:00
Javi Martín
819485eb80 Re-add and apply MDL rule MD040
We were following it about half of the time and we even added it to our
former `.mdlrc` file. However, for some reason, MDL doesn't detect this
rule when specified in the `.mdlrc` file, so we didn't notice we weren't
following it in many cases.

Now that we're using a style file to configure MDL, we can enable this
rule again and apply it, since now MDL correctly includes it in its
report.
2024-06-21 15:57:52 +02:00
Javi Martín
10e2a9713f Update references to GitHub repositories 2023-07-12 16:03:17 +02:00
Javi Martín
13c641eedc Update application name
Note that, in order to have some consistency, we're always writing
"Consul Democracy", instead of using capital letters sometimes (but not
always), like we did until now.
2023-07-12 15:36:49 +02:00
Pietro Monticone
f62cd1129b Clean docs 2022-11-01 15:20:25 +01:00
Javi Martín
e2ec47ae4d Use the same URL to clone the repo everywhere
We were using the SSH URL in the Docker documentation, while using the
HTTPS URL everywhere else. The HTTPS URL is the right one in this case
because it's meant for people who won't have write access to the
repository.
2021-12-13 14:35:49 +01:00
Javi Martín
7ac5443006 Recommend building the image with docker-compose
If we used the `docker build` to build the image and then
`docker-compose`, we'd build two images.
2021-12-10 20:04:37 +01:00
Javi Martín
63f23852f5 Improve markdown style in Docker documentation files 2021-09-12 21:37:32 +02:00
Vaibhav Ariyur
c6a273b620 Update docker.md
added "under Docker Desktop " to specify installing docker instructions more
2021-08-26 18:08:34 -04:00
Vaibhav Ariyur
b54b81e147 Update docker.md
Added installation instructions for Docker on Windows.
2021-08-26 18:03:53 -04:00
Javi Martín
6240f4c313 Specify password in Docker commands
This is needed since pull request 4478 in the consul/consul repository.
2021-04-23 12:32:30 +02:00
Javi Martín
68ff36685d Simplify instructions to populate Docker database 2021-04-22 19:04:50 +02:00
taitus
e30ccf4689 Fix links on Docker section 2019-12-17 16:22:42 +01:00
voodoorai2000
dd760f5553 Move pages to adapt to new SUMMARY structure 2019-04-01 22:01:32 +02:00