You can deploy MDriven Server with the PostgreSQL, MySQL, or MSSQL database included in an MDriven production package, persist its data on the host, and connect the running server to the database schema.
This page applies to the production deployment packages that include a database container. For the complete production deployment and Nginx setup, see Documentation:Deploying MDriven to Production with Nginx. For Docker concepts and package downloads, see Documentation:Deploying MDriven Server and Turnkey with Docker.
What the production package configures
A database-enabled production package contains Docker Compose configuration for the selected database engine, MDriven Server, and MDriven Turnkey. Docker Compose starts these services as containers.
The supplied Compose configuration places the database and MDriven Server on a shared internal Docker network. MDriven Server can therefore connect to the database by its Docker service name without making that database connection public. MDriven Turnkey is also connected to MDriven Server through the internal network.
Do not use the Docker service name when connecting from a database client running outside Docker. See Connect with an external database client.
Package layout
The deployment package contains configuration for each supported database option.
| Database engine | Package directory | Initialization content | Credentials file | Host directory used for database data |
|---|---|---|---|---|
| PostgreSQL | databases/postgres
|
init folder containing the required .sql schema script
|
postgres.env
|
/postgres-data
|
| MySQL | databases/mysql
|
init folder containing the required .sql schema script
|
mysql.env
|
/mysql-data
|
| MSSQL | databases/mssql
|
init folder containing the required .sql schema script and Bash scripts
|
mssql.env
|
/mssql-data
|
The environment file defines the credentials used by MDriven Server for the selected database. PostgreSQL and MySQL packages contain credentials for the different accounts that MDriven Server uses. The MSSQL package contains the credentials for the account MDriven Server uses.
Start the database and initialize the schema
- Upload the production package to the server and extract it.
- Before the first start, review the environment file for your selected database under
databases/postgres,databases/mysql, ordatabases/mssql. Set the required credentials according to your deployment policy. - From the deployment folder, start the Compose application:
docker compose up -d
- Allow the database container to complete its first startup. On first initialization, the package initialization scripts create the database schema.
- Verify that the containers are running before configuring MDriven Server.
Important: Initialization scripts are intended for the first creation of the database schema. Do not assume that changing a script after the database data directory has been initialized will recreate or modify an existing database. Treat schema changes and data recovery as operational tasks for your deployment.
The Compose setup can use health checks and service dependencies so that dependent services start only after prerequisite services respond. The MySQL production configuration is described in Documentation:Advanced Docker Compose Configuration for MDriven.
Persistence is not a backup
The database data directory is mounted from the container onto the host. This makes the data survive a database-container restart or replacement, provided that the host directory is retained.
| Database engine | Host-mounted data directory |
|---|---|
| PostgreSQL | /postgres-data
|
| MySQL | /mysql-data
|
| MSSQL | /mssql-data
|
A host-mounted directory provides persistence; it is not, by itself, a tested backup. Create and test backups appropriate for the database engine and your recovery requirements. MDriven Server database-management topics, including database download, upload, SQL export, and database recreation, are listed in Documentation:Server.
Connect MDriven Server to the database
After the database container is running, configure the running MDriven Server to use its schema.
- Open the MDriven Server URL in a browser and sign in.
- Select Running > Model.
- If the application is running, select Pause App.
- Set Connection Type to the engine included in your deployment package:
MSSqlServerfor MSSQLMySQLfor MySQLPostgreSQLfor PostgreSQL
- In Alternate Connection String, enter the connection string supplied for the selected production package.
- If you changed passwords in the database
.envfile, update the correspondingPwdorPasswordvalue in the alternate connection string. - Select Start App.
Use the database host and credentials specified by the supplied Compose configuration when MDriven Server connects from inside Docker. The Docker-internal host is not the same as the host address used by a desktop database client.
Example: If you change a PostgreSQL password in databases/postgres/postgres.env, MDriven Server must use that same updated password in its PostgreSQL alternate connection string. A mismatch prevents MDriven Server from opening the database.
Upload the model
When MDriven Server has started with the selected database connection:
- Upload your model to MDriven Server.
- Authenticate the upload using the password assigned to user
a.
For instructions on resetting the user a password and other Compose-level settings, see the Docker Compose configuration guidance in Documentation:Advanced Docker Compose Configuration for MDriven.
Connect with an external database client
You can inspect schemas, run queries, and manage database data with a database client running on the Docker host or another machine that can reach the published database port.
| Tool type | Examples |
|---|---|
| Multi-database client | DBeaver; DataGrip |
| MySQL-specific client | MySQL Workbench |
| PostgreSQL-specific client | pgAdmin |
| MSSQL-specific client | SQL Server Management Studio (SSMS); Azure Data Studio |
When connecting from outside Docker:
- Use
127.0.0.1when the client runs on the Docker host, or use the server's reachable IP address when connecting remotely. - Use the external port published in
compose.yaml. - Use credentials from the relevant database
.envfile. - Do not use Docker-internal service names such as
mysql,postgres, ormssqlas the external client host.
Example: A database tool running directly on the Docker host connects to 127.0.0.1 and the port exposed for PostgreSQL in compose.yaml; it does not connect to postgres.
For a local PostgreSQL installation and a PostgreSQL connection-string example, see Documentation:PostgreSQL. For MySQL-specific setup notes, see Documentation:MySQL–notes to support the use of MySQL with MDriven.
See also
- Documentation:Deploying MDriven to Production with Nginx
- Documentation:Deploying MDriven Server and Turnkey with Docker
- Documentation:Advanced Docker Compose Configuration for MDriven
- Documentation:Server
- Documentation:PostgreSQL
- Documentation:MySQL–notes to support the use of MySQL with MDriven
Use an external managed database
Use an external managed database
You can run MDriven Server and MDriven Turnkey in Docker while using PostgreSQL, MySQL, or MSSQL hosted by your Azure or AWS environment; this is for deployments where the database is managed separately from the Docker host.
When you download the Docker production deployment, select Default (Vista DB) if you will connect to an external PostgreSQL, MySQL, or MSSQL database hosted elsewhere. The database-enabled production packages described on this page are for deployments that run the selected database in Docker.
For example, if your organization provides a managed PostgreSQL database in Azure or AWS, deploy MDriven Server and Turnkey with the Default (Vista DB) setup, then configure MDriven Server to connect to the PostgreSQL database instead of starting the postgres database container.
Configure MDriven Server for the external database
- Create and prepare the external database schema according to your database administration process.
- Deploy MDriven Server and Turnkey with the Default (Vista DB) Docker production setup. See Documentation:Deploying MDriven Server and Turnkey with Docker.
- Open the MDriven Server URL and sign in.
- Select Running > Model.
- If the application is running, select Pause App.
- Set Connection Type to the database engine used by the external database:
MSSqlServerfor MSSQLMySQLfor MySQLPostgreSQLfor PostgreSQL
- Enter the external database connection string in Alternate Connection String. Use the database host and credentials supplied for that external database.
- Select Start App.
Do not use the Docker service names mysql, postgres, or mssql for an external managed database. Those names apply only to the database containers in the database-enabled Compose packages.
The host-mounted directories /postgres-data, /mysql-data, and /mssql-data apply only when the corresponding database container runs on the Docker host. Back up and restore an external managed database using the procedures for that database service. Before upgrading MDriven Server, Turnkey, or the model, create a restore point as described in Documentation:MDriven Backup & Restore Guide.
For Azure application hosting, see HowTos:Install MDriven Server and Turnkey on Microsoft Azure.
