Skip to content

Commit 640bb32

Browse files
authored
Moving back to MySQL (#9)
1 parent 1961d75 commit 640bb32

File tree

6 files changed

+938
-157
lines changed

6 files changed

+938
-157
lines changed

README.md

+15-6
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<span class="badge-npmversion"><a href="https://www.npmjs.com/package/@mep-agency/local-dev-db" title="View this project on NPM"><img src="https://img.shields.io/npm/v/%40mep-agency/local-dev-db" alt="NPM version" /></a></span>
66
<span class="badge-npmdownloads"><a href="https://www.npmjs.com/package/@mep-agency/local-dev-db" title="View this project on NPM"><img src="https://img.shields.io/npm/dt/%40mep-agency/local-dev-db" alt="NPM downloads" /></a></span>
77

8-
A zero-config local MariaDB instance for local development (using Docker) so you can finally stop doing things like:
8+
A zero-config local MySQL instance for local development (using Docker) so you can finally stop doing things like:
99

10-
- Using different databases for dev and prod environments (e.g. SQLite vs MariaDB/MySQL)
10+
- Using different databases for dev and prod environments (e.g. SQLite vs MySQL/MariaDB)
1111
- Installing a local database server directly on your machine
1212
- Spending time getting up and running in a new development environment
1313

@@ -16,11 +16,11 @@ A zero-config local MariaDB instance for local development (using Docker) so you
1616
While this tool is designed to be installed as a dependency in your projects, it actually runs as a single database server.
1717
This makes it possible to optimize resources when working on multiple projects at the same time.
1818

19-
Feel free to install this tool as a dependency in any project where you need a MariaDB/MySQL database, CLI commands will act on the same instance and all your databases will share the same storage volume.
19+
Feel free to install this tool as a dependency in any project where you need a MySQL/MariaDB database, CLI commands will act on the same instance and all your databases will share the same storage volume.
2020

2121
## Features
2222

23-
- Runs a fully-featured MariaDB server without touching your local system
23+
- Runs a fully-featured MySQL server without touching your local system
2424
- Runs a PhpMyAdmin instance attached to the DB server so you can manage your databases with no additional software
2525
- Provides you with a simple set of CLI commands do run common tasks:
2626
- Create/drop databases and dedicated users
@@ -59,7 +59,7 @@ Run the `ldd` binary to see the available commands:
5959
$ yarn ldd --help
6060
Usage: ldd [options] [command]
6161

62-
A zero-config local MariaDB instance for local development (using Docker)
62+
A zero-config local MySQL instance for local development (using Docker)
6363

6464
Options:
6565
-V, --version output the version number
@@ -139,7 +139,16 @@ Creating a new DB named "my-awesome-app"...
139139

140140
We hope you never have to use them, but just in case, here are some ENV vars you can set on your machine to customize the behavior of the application:
141141

142-
- `LDD_DB_IMAGE_TAG` (default: `latest`): we use the official [MariaDB](https://hub.docker.com/_/mariadb) Docker image. You can pick a different tag if you wish.
142+
#### Server behavior
143+
144+
- `LDD_SQL_MODE` (default: `"ANSI,ONLY_FULL_GROUP_BY,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,STRICT_ALL_TABLES,ALLOW_INVALID_DATES"`): The SQL mode to use for the MySQL server.
145+
- `LDD_SQL_REQUIRE_PRIMARY_KEY` (default: `ON`): Whether to require primary keys to be defined for each table.
146+
- `LDD_DEFAULT_STORAGE_ENGINE` (default: `InnoDB`): The default storage engine to use for the MySQL server.
147+
- `LDD_EXPLICIT_DEFAULTS_FOR_TIMESTAMP` (default: `ON`): Whether to use explicit defaults for timestamp columns.
148+
149+
#### Advanced customization
150+
151+
- `LDD_DB_IMAGE_TAG` (default: `lts`): we use the official [MySQL](https://hub.docker.com/_/mysql) Docker image. You can pick a different tag if you wish.
143152
- `LDD_DB_PORT` (default: `3306`): The database server will be attached to this port on your local machine. You can customize this to avoid any conflicts with other services.
144153
- `LDD_DB_ROOT_PASSWORD` (default: `not-secure-pwd`): This tool is not secure by design, so you should probably leave this untouched to avoid issues.
145154
- `LDD_PMA_IMAGE_TAG` (default: `latest`): we use the official [PhpMyAdmin](https://hub.docker.com/_/phpmyadmin) Docker image. You can pick a different tag if you wish.

docker/docker-compose.yml

+14-8
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,27 @@ version: '3'
22

33
services:
44
db:
5-
image: "mariadb:${LDD_DB_IMAGE_TAG:-latest}"
5+
image: 'mysql:${LDD_DB_IMAGE_TAG:-lts}'
66
ports:
7-
- "${LDD_DB_PORT:-3306}:3306"
7+
- '${LDD_DB_PORT:-3306}:3306'
8+
command: >
9+
--sql-mode=${LDD_SQL_MODE:-"ANSI,ONLY_FULL_GROUP_BY,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,STRICT_ALL_TABLES,ALLOW_INVALID_DATES"}
10+
--sql-require-primary-key=${LDD_SQL_REQUIRE_PRIMARY_KEY:-ON}
11+
--default-storage-engine=${LDD_DEFAULT_STORAGE_ENGINE:-InnoDB}
12+
--explicit_defaults_for_timestamp=${LDD_EXPLICIT_DEFAULTS_FOR_TIMESTAMP:-ON}
813
networks:
914
- private
1015
volumes:
1116
- db_data:/var/lib/mysql
1217
environment:
13-
MARIADB_ROOT_PASSWORD: "${LDD_DB_ROOT_PASSWORD:-not-secure-pwd}"
14-
MARIADB_DATABASE: defaultdb
18+
MYSQL_ROOT_PASSWORD: '${LDD_DB_ROOT_PASSWORD:-not-secure-pwd}'
19+
MYSQL_DATABASE: defaultdb
20+
1521
phpmyadmin:
16-
image: "phpmyadmin:${LDD_PMA_IMAGE_TAG:-latest}"
22+
image: 'phpmyadmin:${LDD_PMA_IMAGE_TAG:-latest}'
1723
restart: always
1824
ports:
19-
- "${LDD_PMA_PORT:-8010}:80"
25+
- '${LDD_PMA_PORT:-8010}:80'
2026
networks:
2127
- private
2228
depends_on:
@@ -25,8 +31,8 @@ services:
2531
PMA_HOST: db
2632
PMA_PORT: 3306
2733
PMA_USER: root
28-
PMA_PASSWORD: "${LDD_DB_ROOT_PASSWORD:-not-secure-pwd}"
29-
MYSQL_ROOT_PASSWORD: "${LDD_DB_ROOT_PASSWORD:-not-secure-pwd}"
34+
PMA_PASSWORD: '${LDD_DB_ROOT_PASSWORD:-not-secure-pwd}'
35+
MYSQL_ROOT_PASSWORD: '${LDD_DB_ROOT_PASSWORD:-not-secure-pwd}'
3036

3137
networks:
3238
private:

0 commit comments

Comments
 (0)