drago-ex / project-docker-db
The package extends the Drago Project to include mysqli database on docker.
Package info
github.com/drago-ex/project-docker-db
Type:drago-tools-resource
pkg:composer/drago-ex/project-docker-db
Requires
- php: >=8.3 <9
- drago-ex/database: ^4.0 || ^5.0
- drago-ex/project-docker: ^1.1
Requires (Dev)
- drago-ex/project-tools: ^1.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
The package extends Drago Project with a MySQL database in Docker.
Requirements
- PHP >= 8.3, < 9
- Drago Project
- Docker
Installation
composer require drago-ex/project-docker-db
Files copied into the project
The files are copied into the project by drago-ex/project-tools,
as set in extra.drago-tools of this package's composer.json.
The package does the following
- Copies a configured Neon file with database settings preconfigured for Docker.
- Adds Docker files for database setup.
- Integrates Dibi for database interaction.
The data of the database are in the Docker volume db-data, which is much faster than a directory of the project
on Windows. docker compose down keeps it, docker compose down --volumes deletes the data.
The database connection is in local/db.neon. The local/ directory is mounted into the container, so what the
application writes there (e.g. an installer) outlasts a new image; keep it out of git.
Development only
The database user and passwords (super/pass, root root) in docker-compose.override.yaml and
local/db.neon are for local development. Change them before the setup runs anywhere else (the
docker:production script uses the same files).
The database listens only on 127.0.0.1:6033, so tools on your computer can connect to it. To publish it on
every interface, set DB_PORT=6033; Docker bypasses firewalls such as ufw, so never do so on a server.
Remember
The package extends the basic PHP Docker server with a MySQL database. Install and build the base Docker setup first, then add this database package and rebuild Docker.