Installing Martini Server Runtime using Docker
Deploying Martini Server Runtime within a Docker Container
Docker simplifies application deployment by bundling applications and their underlying operating systems, making them portable across environments. This guide will walk you through deploying Martini Server Runtime using Docker.
Docker Image
The official Martini Server Runtime Docker image is available on the Docker registry. It's based on Alpine Linux and comes pre-configured for production use.
Details
- Image Base: Alpine Linux
- Exposed Ports:
- 8080
- 8443: Although the Dockerfile exposes port
8443
, by default the Martini Server Runtime Docker image is configured to serve requests over HTTP only. - Default Configuration: HTTP-only setup
- Working Directory:
/data
- Environment Variables:
JAVA_XMX
: Maximum heap memory for JavaJAVA_XMS
: Initial heap memory for Java- Entry Point:
/data/bin/toro-martini
General Steps for Docker-Based Installation
Important directories
Normally, when a Docker instance is stopped and removed, the data inside the container will be lost unless you have defined the directories or files as volumes so they can be persisted. When doing this with Martini Server Runtime, it's important to note that the container runs with root privileges, meaning any mounted volumes will be owned by the root user inside the container. This may affect file permissions and access depending on how your host system is configured.
-
For a Docker instance of Martini Server Runtime, here are the following directories:
-
/<martini-home>/data
/<martini-home>/conf/db-pool
/<martini-home>/conf/overrides
/<martini-home>/packages
/<martini-home>/logs
By default, the Docker Image of Martini uses /data
as the entrypoint. As a result, mounting <martini-home>/data
from the host will appear as data/data
inside the container.
NOTE: The /data directory contains files related to Martini's embedded databases and message queues. It is not recommended to use these embedded databases and message queues for larger production environments or where two or more Martini Server Runtime instances are running. Martini Server Runtime creates locks on these files and as such the /data directory should not be mounted where two or more instances would be sharing the same folder.
1. Prepare the Hosting Environment
- Set up your hosting environment, which can be a public cloud provider or a your own private server.
- Ensure that the environment is configured to support Docker, including enabling any necessary virtualization settings.
2. Install Docker
- Install Docker on your chosen host. You can find detailed installation instructions for different operating systems in the Docker official documentation.
- Verify the Docker installation by running:
1 |
|
3. Set your License
- From the command line of your host machine, set your license as an environment variable:
1 |
|
4. Deploy Martini Server Runtime
Start the Martini Server Runtime container. Here is an example of using Docker Run with the following volumes:
1 2 3 4 5 6 7 8 9 10 |
|
5. Verify Deployment
Check if the container is running:
1 |
|
Upgrading Martini Server Runtime
To upgrade to the latest version:
-
Pull the latest image:
1
docker pull lontiplatform/martini-server-runtime:latest
-
Stop and remove the existing container:
If you did not assign a name to your container, identify it with:
1
docker ps
Look for a container running the lontiplatform/martini-server-runtime image. Then stop and remove it using the container ID or name:
1
docker rm -f <container_id_or_name>
-
Start a new container with the latest image, following the deployment steps above.
Using Docker Compose
Docker Compose simplifies setting up Martini Designer by consolidating configurations like ports, volumes, and environment variables into a single file, making it easier to manage and deploy the setup consistently across different environments.
1. Create a folder for your files
1 |
|
2. Create a docker-compose.yml file
- Create a docker-compose file that specifies all of your needs.
- Here is an example docker-compose.yml file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
- You can set the license by creating an
.env
file in the same folder and inputting the following:
1 |
|
3. Start your Docker container
With Docker Compose, you can execute the following commands:
docker compose up -d
: starts the docker container in detach modedocker compose up
: starts the docker container in verbose modedocker compose down
: stops the docker container
Other Useful commands are:
docker compose logs -f
: Views the docker compose logs in verbose modedocker compose logs
: View the last few lines of the docker compose logsdocker exec -it <container-name> /bin/bash
: Enter the console of your containerdocker compose down && docker compose pull && docker compose up -d
: Update the docker container to the newest image
Memory Considerations
For memory-intensive systems:
- Optimize memory allocation from the Docker container to the JVM using the following command on Docker run:
XX:+UseContainerSupport -XX:MaxRAMPercentage=75.0
The variable 75.0 can be modified to the user's requirements. We recommend setting this option to a value that is less than or equal to 75.0. A value of 75.0 will allocate 75% of the memory allocated to the Docker image to the JVM.
Refer to Docker documentation for detailed resource limitation options.
Post-Installation Steps
- Initial Configuration: Configure Martini Server Runtime according to your requirements.
Martini Docker Stack using Compose
The Martini Docker Stack is a containerized development and testing environment designed to run Martini Runtime alongside popular databases using Docker Compose. This stack simplifies the process of setting up a local Martini ecosystem by providing all necessary components pre-configured and ready to launch with a single command.
Key Features
-
Zero-Config Setup
Just clone the repository and rundocker compose up -d
. No manual installation or configuration needed. -
Multi-Database Support
Includes multiple databases out-of-the-box, with the flexibility to add more databases or services. -
Port Mapping for Services
Easily access Martini and database services via exposed ports onlocalhost
. -
Extensibility
Fully customizable dbxml files allow you to extend or override service configurations as required. -
Environment Isolation
All services run in isolated containers to prevent local environment conflicts.
Stack Architecture
The stack includes the following components:
Service | Image | Description | Port |
---|---|---|---|
martini |
martini-server-runtime:latest |
Martini Runtime | 8080/8443 |
postgres |
postgres:latest |
SQL database for storage-backed Martini services | 5432 |
cassandra |
cassandra:latest |
NoSQL database for specific use cases | 9042 |
mysql |
mysql:latest |
Widely-used open-source relational database | 3306 |
oracle |
Custom Oracle image | Enterprise-grade relational database | 1521 |
mssql |
mcr.microsoft.com/mssql/server |
Microsoft SQL Server | 1433 |
Docker Compose ensures seamless networking between these services and enables you to start or stop the entire stack with one command.
Getting Started
To get started, make sure you have the following installed:
Clone the Repository
1 2 |
|
Start the stack
1 |
|
Martini UI will be available at http://localhost:8080
Refer to the README file in the repository for more detailed instructions on how to access databases, configure volumes, or extend the stack.
Resources
- GitHub Repository: https://github.com/lontiplatform/martini-docker-compose-stack
- Martini Documentation: https://developer.lonti.com/docs/martini/
- Docker Documentation: https://docs.docker.com/