Page MenuHomePhabricator

[keyserver] Add MySQL image to docker-compose.yml
ClosedPublic

Authored by ashoat on May 2 2022, 7:24 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 18, 3:36 AM
Unknown Object (File)
Thu, Nov 7, 4:46 PM
Unknown Object (File)
Sun, Nov 3, 3:18 PM
Unknown Object (File)
Oct 20 2024, 12:59 AM
Unknown Object (File)
Oct 19 2024, 11:16 AM
Unknown Object (File)
Oct 19 2024, 11:16 AM
Unknown Object (File)
Oct 19 2024, 11:16 AM
Unknown Object (File)
Oct 19 2024, 11:09 AM

Details

Summary
  • We unfortunately are still on MySQL 5.7. ENG-111 tracks moving to a recent version of MariaDB
  • I am purposefully deferring the question of persistence/volumes here, which is tracked in ENG-1069. I need to read up on the subject first, and also I'll probably (maybe?) want to make Redis persist as well
Test Plan

Run docker-compose up --build

Diff Detail

Repository
rCOMM Comm
Branch
ashoat/dockerize_node
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

ashoat requested review of this revision.May 2 2022, 7:38 AM
ashoat added inline comments.
keyserver/docker-compose.yml
16

Note that I'm purposefully deferring the question of volumes / persistence – see diff description

varun requested changes to this revision.May 2 2022, 12:28 PM
varun added inline comments.
keyserver/docker-compose.yml
25

why do we need to set MYSQL_RANDOM_ROOT_PASSWORD if it defaults to true?

This revision now requires changes to proceed.May 2 2022, 12:28 PM

Interesting... you linked a docs page I hadn't seen before, but seems quite relevant (Docker config for MySQL 5.7).

That said – when I leave this config out I get this error:

keyserver-database-1  | 2022-05-02 19:48:55+00:00 [ERROR] [Entrypoint]: Database is uninitialized and password option is not specified
keyserver-database-1  |     You need to specify one of the following:
keyserver-database-1  |     - MYSQL_ROOT_PASSWORD
keyserver-database-1  |     - MYSQL_ALLOW_EMPTY_PASSWORD
keyserver-database-1  |     - MYSQL_RANDOM_ROOT_PASSWORD

Accepting, but have one q: is the root user prompted to reset their password before MySQL can be used normally or will they have to find the random password in the container logs if they need to access the server?

This revision is now accepted and ready to land.May 2 2022, 1:06 PM
In D3885#108879, @varun wrote:

Accepting, but have one q: is the root user prompted to reset their password before MySQL can be used normally or will they have to find the random password in the container logs if they need to access the server?

The docs explain that the password is printed to logs:

The password is printed to stdout of the container and can be found by looking at the container’s log (see Starting a MySQL Server Instance).

Looking at the logs from running docker-compose up --build, I think this is the line:

2022-05-03 16:09:52+00:00 [Note] [Entrypoint]: GENERATED ROOT PASSWORD: R0zD6xFYD9ep+wueozyXW5P3kzYefnx2

When I boot the container using docker-compose up --build, and connect to it in another terminal using docker exec -it keyserver-database-1 /bin/bash, I am able to access MySQL inside the container using mysql -uroot -p while using the generated root password, without MySQL prompting me to change it.