Skip to content

Commit 7dd5f60

Browse files
Merge pull request #10935 from mendix/kk-pad
Portable App Distribution
2 parents ab429f7 + a750162 commit 7dd5f60

29 files changed

Lines changed: 882 additions & 508 deletions

File tree

Lines changed: 12 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,26 @@
11
---
22
title: "Docker"
3-
url: /developerportal/deploy/docker-deploy/
3+
url: /developerportal/deploy/docker/
44
weight: 60
5-
description: "Describes how to deploy using a Docker image."
6-
#If moving or renaming this doc file, implement a temporary redirect and let the respective team know they should update the URL in the product. See Mapping to Products for more details.
5+
description: "Describes how to deploy your Mendix app to a Docker environment."
6+
no_list: false
7+
description_list: true
78
---
89

910
## Introduction
1011

11-
Docker is an open source container technology. With Mendix, you can use it for simple deployments, particularly when running local or development versions of your app. However, it lacks some scaling and integration features.
12+
This section describes how to deploy your Mendix app to a Docker environment.
1213

13-
The Docker Buildpack simplifies the creation of Docker images locally, but it falls short in terms of running, managing, and operating them effectively compared to the capabilities offered by Mendix on Kubernetes. Leveraging Mendix on Kubernetes means entrusting the Mendix Operator to automate these essential tasks whenever Kubernetes handles your containers. The following diagram illustrates the disparity between Docker Buildpack and Mendix Operator:
14+
## Docker Deployment Options
1415

15-
{{< figure src="/attachments/deployment/docker-deploy/dockerbuildpack-vs-mxoperator.png" class="no-border" >}}
16+
Mendix offers two options for Docker deployments: Portable App Distribution or the Docker Buildpack.
1617

17-
{{% alert color="info" %}}
18-
Mendix suggests that, if you are planning to deploy to your own cloud platform at scale, a better solution for production apps is to use [Mendix on Kubernetes](/developerportal/deploy/private-cloud/). This provides you with structured and tested solutions for integrating with your own cloud infrastructure using comprehensive, automated, native functions, avoiding the need to create your own processes from scratch.
19-
{{% /alert %}}
18+
### Portable App Distribution
2019

21-
This page explains how to build a Docker image from your Mendix App. Every time you make changes to your app, you must create a new Docker image that can be pushed through the different stages of your application pipeline.
20+
[Portable App Distribution](/developerportal/deploy/portable-app-distribution-deploy/) allows users to generate their portable app with a single MxBuild command. It requires fewer manual steps than the Docker Buildpack, simpler environment configuration, and no `rootfs` preparation. Running Portable App Distribution can take as little as 3-6 minutes (the time may vary based on the application's size and complexity).
2221

23-
This how-to teaches you how to do the following:
22+
### Docker Buildpack
2423

25-
* Build the image
26-
* Push the image to a registry
24+
The Docker Buildpack offers custom `rootfs` configuration, but requires multiple build steps, a more complex setup process, and a longer total build time (at least 14-25 minutes).
2725

28-
## Prerequisites
29-
30-
Before starting these instructions, make sure you have completed the following prerequisites:
31-
32-
* Download the latest version of [Mendix Studio Pro](https://marketplace.mendix.com/link/studiopro/) from the *Mendix Marketplace*
33-
* Install Docker from the [Docker site](https://docs.docker.com/engine/installation/)
34-
* Download the [Mendix Docker Buildpack](https://github.com/mendix/docker-mendix-buildpack)
35-
36-
## Building the Image
37-
38-
To build the Docker image, follow these steps:
39-
40-
1. Install Docker on your computer.
41-
2. Restart the computer to ensure that you have been granted access to Docker.
42-
3. Unzip the buildpack into a location of your choice.
43-
4. Open the **Command Prompt** and navigate to the folder where you unzipped the buildpack.
44-
5. Open your app in Studio Pro and select the menu option **App** > **Show App Directory in Explorer**:
45-
46-
{{< figure src="/attachments/deployment/docker-deploy/create-deployment-package.png" class="no-border" >}}
47-
48-
6. Copy the project folder and all its subfolders to the unzipped docker build folder. The project folder needs to be in the same folder as the Docker file, otherwise Docker cannot access it.
49-
7. Execute the following command:
50-
51-
```bash
52-
docker build --build-arg BUILD_PATH="{relative-mendix-project-location}" -t {image name} .
53-
```
54-
55-
**{relative-mendix-project-location}** is the BUILD_PATH which indicates where the application model is located. It is the directory where your .MPR file is located after you copied the project into the docker build folder. If you do not specify it, it defaults to `./project`.
56-
57-
A successful build will resemble the output shown below:
58-
59-
{{< figure src="/attachments/deployment/docker-deploy/build-image.png" class="no-border" >}}
60-
61-
{{% alert color="info" %}}
62-
You can find much more information and links to relevant Docker documentation in the [Mendix Docker Buildpack](https://github.com/mendix/docker-mendix-buildpack) GitHub repository.
63-
{{% /alert %}}
64-
65-
## Pushing the Image
66-
67-
A new Docker image has been created with the name (`{image name}`) you gave it. You can see the image by using the command `docker images`.
68-
69-
Next, you need to push the image to a registry. This can be a public registry or your own. To push it to your own registry, use the command `docker push {image name}`.
70-
71-
## Read More
72-
73-
* [How to Run a Mendix Docker Image](/developerportal/deploy/run-mendix-docker-image/)
26+
## Documents in This Section
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
title: "Docker Buildpack"
3+
url: /developerportal/deploy/docker-deploy/
4+
weight: 60
5+
description: "Describes how to deploy using a Docker image using a Docker Buildpack."
6+
#If moving or renaming this doc file, implement a temporary redirect and let the respective team know they should update the URL in the product. See Mapping to Products for more details.
7+
---
8+
9+
## Introduction
10+
11+
This page explains how to build a Docker image from your Mendix App using a Docker buildpack. Every time you make changes to your app, you must create a new Docker image that can be pushed through the different stages of your application pipeline.
12+
13+
This how-to teaches you how to do the following:
14+
15+
* Build the image
16+
* Push the image to a registry
17+
18+
## Prerequisites
19+
20+
Before starting these instructions, make sure you have completed the following prerequisites:
21+
22+
* Download the latest version of [Mendix Studio Pro](https://marketplace.mendix.com/link/studiopro/) from the *Mendix Marketplace*
23+
* Install Docker from the [Docker site](https://docs.docker.com/engine/installation/)
24+
* Download the [Mendix Docker Buildpack](https://github.com/mendix/docker-mendix-buildpack)
25+
26+
## Compatibility
27+
28+
Mendix is compatible with Docker hosts as long as there are compatible database services like PostgreSQL, RDS, or Azure SQL. External file store support can be set up with Amazon S3 or Azure Blob store.
29+
30+
## Building the Image
31+
32+
To build the Docker image, follow these steps:
33+
34+
1. Install Docker on your computer.
35+
2. Restart the computer to ensure that you have been granted access to Docker.
36+
3. Unzip the buildpack into a location of your choice.
37+
4. Open the **Command Prompt** and navigate to the folder where you unzipped the buildpack.
38+
5. Open your app in Studio Pro and select the menu option **App** > **Show App Directory in Explorer**:
39+
40+
{{< figure src="/attachments/deployment/docker-deploy/create-deployment-package.png" class="no-border" >}}
41+
42+
6. Copy the project folder and all its subfolders to the unzipped docker build folder. The project folder needs to be in the same folder as the Docker file, otherwise Docker cannot access it.
43+
7. Execute the following command:
44+
45+
```bash
46+
docker build --build-arg BUILD_PATH="{relative-mendix-project-location}" -t {image name} .
47+
```
48+
49+
**{relative-mendix-project-location}** is the BUILD_PATH which indicates where the application model is located. It is the directory where your .MPR file is located after you copied the project into the docker build folder. If you do not specify it, it defaults to `./project`.
50+
51+
A successful build will resemble the output shown below:
52+
53+
{{< figure src="/attachments/deployment/docker-deploy/build-image.png" class="no-border" >}}
54+
55+
{{% alert color="info" %}}
56+
You can find much more information and links to relevant Docker documentation in the [Mendix Docker Buildpack](https://github.com/mendix/docker-mendix-buildpack) GitHub repository.
57+
{{% /alert %}}
58+
59+
## Pushing the Image
60+
61+
A new Docker image has been created with the name (`{image name}`) you gave it. You can see the image by using the command `docker images`.
62+
63+
Next, you need to push the image to a registry. This can be a public registry or your own. To push it to your own registry, use the command `docker push {image name}`.
64+
65+
## Running the Mendix Docker Image
66+
67+
To start the container, you must provide the container with the password in order to create an administrative account for your Mendix application's `ADMIN_PASSWORD`
68+
and `DATABASE_ENDPOINT`, as you can see in this example:
69+
70+
```shell
71+
docker run -it \
72+
-e ADMIN_PASSWORD=Password1! \
73+
-e DATABASE_ENDPOINT=postgres://username:password@host:port/mendix \
74+
mendix/mendix-buildpack:v1.2
75+
```
76+
77+
This is an example for Microsoft SQL Server:
78+
79+
```powershell
80+
docker run -it \
81+
-e ADMIN_PASSWORD=Password1! \
82+
-e DATABASE_ENDPOINT=sqlserver://username:password@host:port/mendix \
83+
mendix/mendix-buildpack:v1.2
84+
```
85+
86+
## Read More
87+
88+
* [Mendix Docker Buildpack](https://github.com/mendix/docker-mendix-buildpack)
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
---
2+
title: "Portable App Distribution for Docker"
3+
url: /developerportal/deploy/docker-deploy-pad/
4+
weight: 20
5+
description: "Describes how to deploy using a Docker image by using Portable App Distribution."
6+
---
7+
8+
## Introduction
9+
10+
This guide provides a walkthrough for deploying your Mendix application using [Portable App Distribution](/developerportal/deploy/portable-app-distribution-deploy/) with Docker. This approach is particularly useful for containerized environments, and can significantly ease your CI/CD setup.
11+
12+
{{% alert color="info" %}}
13+
This document is not an official Mendix implementation, or a substitute for recommended production deployment strategies. For more features, such as app management or governance, we suggest using [Mendix on Kubernetes](/developerportal/deploy/private-cloud/) or [Mendix on Azure](/developerportal/deploy/mendix-on-azure/), which offer a structured, tested experience with cloud infrastructure.
14+
15+
For information about the scope of support, see [Support for Different Deployment Strategies](/support/deployment-strategy-support/).
16+
{{% /alert %}}
17+
18+
## Benefits of Portable App Distribution
19+
20+
Portable App Distribution revolutionizes the way in which Mendix applications are packaged and delivered. This innovative approach bundles your application code with all its necessary dependencies into a single, self-contained, and runnable artifact. This greatly simplifies the deployment of Mendix applications, whether you are targeting on-premise infrastructure or modern containerized environments like Docker, making the entire process more efficient and seamless.
21+
22+
The ability to generate a Portable App Distribution with a single build command means that creating a Docker-ready artifact becomes a streamlined process, making the overall integration into existing Docker-based CI/CD pipelines more efficient and less prone to errors.
23+
24+
Portable App Distribution offers a more agile, user-centric, and efficient deployment ecosystem, empowering customers with greater control over their Docker deployments and simplifying the internal deployment processes.
25+
26+
## Deploying an App with Portable App Distribution
27+
28+
The Portable App Distribution feature in Mendix Studio Pro provides you with the necessary application files to build a Docker image. It packages your Mendix application as a self-contained distribution, ready for integration into your Docker environment.
29+
30+
To deploy your app to Docker, perform the following steps:
31+
32+
1. Generate the application files. For more information, see [Portable App Distribution](/developerportal/deploy/portable-app-distribution-deploy/).
33+
34+
These files are the core of your Mendix application and are ready to be included in a Docker image.
35+
36+
The following is an example *Dockerfile* that incorporates them. You must create this Dockerfile yourself and place it alongside the application files generated by the Portable App Distribution. The `COPY` commands in the example below assumes that the `app`, `bin`, `etc`, and `lib` directories are in the same location as your Dockerfile.
37+
38+
```text
39+
# This file provides an example on how to start the runtime in Docker.
40+
# It is based on the configuration named Default.
41+
42+
FROM eclipse-temurin:21-jdk
43+
44+
# Set working directory
45+
WORKDIR /mendix
46+
47+
# Copy Mendix app files into the image
48+
COPY ./app ./app
49+
COPY ./bin ./bin
50+
COPY ./etc ./etc
51+
COPY ./lib ./lib
52+
53+
# Environment variables (optional)
54+
ENV MX_LOG_LEVEL=info
55+
ENV M2EE_ADMIN_PASS=${M2EE_ADMIN_PASS}
56+
57+
# Expose ports
58+
EXPOSE 8090
59+
EXPOSE 8080
60+
61+
# Start command
62+
CMD ["./bin/start", "etc/Default"]
63+
```
64+
65+
2. Build the Docker image by running a command like the following: `docker build -t mx/project:latest -f build/docker/Dockerfile`, where:
66+
67+
* `-t mx/project:latest` - Tags your image as `mx/project` with the label `latest`. You can customize this to your project's name and version.
68+
69+
* `-f build/docker/Dockerfile` - Specifies the path to your Dockerfile.
70+
71+
3. Start your Mendix application in a Docker container by running a command like the following: `docker run --rm -it -p 8080:8080 -e M2EE_ADMIN_PASS=<your password> mx/project:latest`, where:
72+
73+
* `--rm` - Automatically removes the container when it exits.
74+
* `-it` - Runs the container in interactive mode and allocates a pseudo-TTY.
75+
* `-p 8080:8080` - Maps port 8080 on your host machine to port 8080 inside the container, allowing you to access your app.
76+
* `-e M2EE_ADMIN_PASS=<yourPassword>` - Ensure that you set your admin password here.
77+
* `mx/project:latest` - Refers to the image that you built.
78+
79+
You can view your running Mendix application at `localhost:8080`. To stop the application, press **Ctrl-C** in your terminal.
80+
81+
## Docker Compose for Multi-Container Setups
82+
83+
For more complex setups involving multiple Docker containers, or for simpler local testing purposes, you can use Docker Compose. It allows you to define and run multi-container Docker applications.
84+
85+
The following is an example of a *docker-compose.yaml* file that sets up your Mendix application with an HSQLDB for local testing. This example assumes you have the Portable App Distribution files (`app`, `bin`, `etc`, `lib`) in a parent directory relative to your *docker-compose.yaml* file.
86+
87+
```yaml
88+
# This file provides an example on how to start the runtime with HSQLDB.
89+
# This setup is intended for local testing only.
90+
# It is based on the configuration named Default.
91+
92+
services:
93+
mendix-app:
94+
image: eclipse-temurin:21-jdk
95+
container_name: mendix-app
96+
working_dir: /mendix
97+
volumes:
98+
- ../app:/mendix/app
99+
- ../bin:/mendix/bin
100+
- ../etc:/mendix/etc
101+
- ../lib:/mendix/lib
102+
environment:
103+
- MX_LOG_LEVEL=info
104+
- M2EE_ADMIN_PASS=${M2EE_ADMIN_PASS}
105+
ports:
106+
- "8090:8090"
107+
- "8080:8080"
108+
command: ["./bin/start", "etc/Default"]
109+
```
110+
111+
### Running with Docker Compose
112+
113+
To use this Docker Compose configuration, perform the following steps:
114+
115+
1. Set your admin port password in the **M2EE_ADMIN_PASS** variable within your environment, or directly in the *docker-compose.yaml* file.
116+
2. Navigate to the directory containing your *docker-compose.yaml* file
117+
3. Run a command like the following: `docker compose -f docker_compose/Default.yaml up`
118+
119+
This example assumes that your configuration is named Default.

content/en/docs/deployment/docker-deploy/run-mendix-docker-image.md

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)