3 Commits

Author SHA1 Message Date
a5d6bcba6d Updated README 2025-10-02 14:48:29 +02:00
35d1b9c4cc Updated README 2025-10-02 14:44:21 +02:00
Paul White
9395aecef4 I want to use mariadb 2025-06-27 13:49:10 +02:00
3 changed files with 20 additions and 24 deletions

View File

@@ -5,9 +5,9 @@
<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> <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>
<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> <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>
A zero-config local MySQL instance for local development (using Docker) so you can finally stop doing things like: A zero-config local mariadb instance for local development (using Docker) so you can finally stop doing things like:
- Using different databases for dev and prod environments (e.g. SQLite vs MySQL/MariaDB) - Using different databases for dev and prod environments (e.g. SQLite vs mariadb/MariaDB)
- Installing a local database server directly on your machine - Installing a local database server directly on your machine
- Spending time getting up and running in a new development environment - Spending time getting up and running in a new development environment
@@ -16,11 +16,11 @@ A zero-config local MySQL instance for local development (using Docker) so you c
While this tool is designed to be installed as a dependency in your projects, it actually runs as a single database server. While this tool is designed to be installed as a dependency in your projects, it actually runs as a single database server.
This makes it possible to optimize resources when working on multiple projects at the same time. This makes it possible to optimize resources when working on multiple projects at the same time.
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. Feel free to install this tool as a dependency in any project where you need a mariadb/MariaDB database, CLI commands will act on the same instance and all your databases will share the same storage volume.
## Features ## Features
- Runs a fully-featured MySQL server without touching your local system - Runs a fully-featured mariadb server without touching your local system
- Runs a PhpMyAdmin instance attached to the DB server so you can manage your databases with no additional software - Runs a PhpMyAdmin instance attached to the DB server so you can manage your databases with no additional software
- Provides you with a simple set of CLI commands do run common tasks: - Provides you with a simple set of CLI commands do run common tasks:
- Create/drop databases and dedicated users - Create/drop databases and dedicated users
@@ -45,21 +45,21 @@ Make sure Docker is installed and configured properly, the `docker` CLI must be
Simply install the package using any package manager: Simply install the package using any package manager:
```bash ```bash
# With Yarn
$ yarn add --dev @mep-agency/local-dev-db
# With NPM # With NPM
$ npm install --save-dev @mep-agency/local-dev-db $ npm install --save-dev git+ssh@git.vascowhite.co.uk:paul/local-dev-db.git
``` ```
Run the `ldd` binary to see the available commands: Run the `ldd` binary to see the available commands:
```bash ```bash
# With Yarn
$ yarn ldd --help
Usage: ldd [options] [command]
A zero-config local MySQL instance for local development (using Docker) # With NPM
$ npx ldd
Usage: ldd [options] [command]
# ...
A zero-config local mariadb instance for local development (using Docker)
Options: Options:
-V, --version output the version number -V, --version output the version number
@@ -67,11 +67,6 @@ Options:
Commands: Commands:
# ... # ...
# With NPM
$ npx ldd
Usage: ldd [options] [command]
# ...
``` ```
### Starting a new project ### Starting a new project
@@ -95,7 +90,7 @@ Username: my-awesome-app
Password: my-awesome-app-pwd Password: my-awesome-app-pwd
``` ```
Our main focus is DX and speed, so don't expect any fancy configuration options or proper security. You can connect to the new database with simple default auth: `mysql://my-awesome-app:my-awesome-app-pwd@127.0.0.1:3306/my-awesome-app`. Our main focus is DX and speed, so don't expect any fancy configuration options or proper security. You can connect to the new database with simple default auth: `mariadb://my-awesome-app:my-awesome-app-pwd@127.0.0.1:3306/my-awesome-app`.
You can also connect to http://127.0.0.1:8010 to access a PhpMyAdmin instance attached to your server. You can also connect to http://127.0.0.1:8010 to access a PhpMyAdmin instance attached to your server.
@@ -141,15 +136,15 @@ We hope you never have to use them, but just in case, here are some ENV vars you
#### Server behavior #### Server behavior
- `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. - `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 mariadb server.
- `LDD_SQL_REQUIRE_PRIMARY_KEY` (default: `OFF`): Whether to require primary keys to be defined for each table. - `LDD_SQL_REQUIRE_PRIMARY_KEY` (default: `OFF`): Whether to require primary keys to be defined for each table.
- `LDD_DEFAULT_STORAGE_ENGINE` (default: `InnoDB`): The default storage engine to use for the MySQL server. - `LDD_DEFAULT_STORAGE_ENGINE` (default: `InnoDB`): The default storage engine to use for the mariadb server.
- `LDD_EXPLICIT_DEFAULTS_FOR_TIMESTAMP` (default: `ON`): Whether to use explicit defaults for timestamp columns. - `LDD_EXPLICIT_DEFAULTS_FOR_TIMESTAMP` (default: `ON`): Whether to use explicit defaults for timestamp columns.
- `LDD_MYSQL_NATIVE_PASSWORD` (default: `ON`): Whether to enable the native MySQL password hashing algorithm. - `LDD_mariadb_NATIVE_PASSWORD` (default: `ON`): Whether to enable the native mariadb password hashing algorithm.
#### Advanced customization #### Advanced customization
- `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. - `LDD_DB_IMAGE_TAG` (default: `lts`): we use the official [mariadb](https://hub.docker.com/_/mariadb) Docker image. You can pick a different tag if you wish.
- `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. - `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.
- `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. - `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.
- `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. - `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.

View File

@@ -2,7 +2,7 @@ version: '3'
services: services:
db: db:
image: 'mysql:${LDD_DB_IMAGE_TAG:-lts}' image: 'mariadb:${LDD_DB_IMAGE_TAG:-latest}'
ports: ports:
- '${LDD_DB_PORT:-3306}:3306' - '${LDD_DB_PORT:-3306}:3306'
command: > command: >

View File

@@ -11,7 +11,8 @@
"local", "local",
"database", "database",
"db", "db",
"mysql" "mysql",
"mariadb"
], ],
"repository": { "repository": {
"type": "git", "type": "git",
@@ -44,4 +45,4 @@
"docker-cli-js": "^2.10.0", "docker-cli-js": "^2.10.0",
"mysql2": "^3.14.0" "mysql2": "^3.14.0"
} }
} }