MariaDB
This guide shows you how to use MariaDB, one of the most popular open source relational databases. To run it, follow these steps:
-
Install the CLI and a container runtime engine, for example Docker. Use the unikraft CLI or the legacy kraft CLI.
-
Clone the
examplesrepository andcdinto theexamples/mariadb/directory:
Code
Make sure to log into Unikraft Cloud and pick a metro close to you.
This guide uses fra (Frankfurt, 🇩🇪):
When done, invoke the following command to deploy this app on Unikraft Cloud:
The output shows the instance address and other details:
Code
In this case, the instance name is mariadb-w2g2z which is different for each run.
To test the deployment, first forward the port with the kraft cloud tunnel command.
Code
The kraft cloud tunnel command is only supported by the legacy CLI.
You can now, on a separate console, use the mysql command line tool to test that the set up works:
Code
Or use the mariadb client command line tool:
Code
You should see output such as:
Code
To disconnect, kill the tunnel command using Ctrl+c.
Note: This guide uses
kraft cloud tunnelonly when a service doesn't support TLS and isn't HTTP-based (TLS/SNI determines the correct instance to send traffic to). Also note that thetunnelcommand isn't needed when connecting via an instance's private IP/FQDN. For example when the MariaDB instance serves as a database server to another instance that acts as a frontend and which does support TLS.
You can list information about the instance by running:
Code
Code
When done, you can remove the instance:
Tip: This example uses the
idlescale-to-zero policy by default (see thelabelssection in theKraftfile).
Using volumes
You can use volumes for data persistence for your MariaDB instance. For that you would first create a volume:
Then start the MariaDB instance and mount that volume:
Customize your app
To customize the app, update the files in the repository, listed below:
Kraftfile: the Unikraft Cloud specification, including command-line argumentsDockerfile: In case you need to add files to your instance's rootfs
Learn more
Use the --help option for detailed information on using Unikraft Cloud:
Or visit the CLI Reference or the legacy CLI Reference.