How to Set Up Custom URL in Mendix on Edge

0
Hi,    i want to use a custom URL for a mendix on edge application.   In the industrial edge plugin it requires to write down the custom URL. But this isn't enough since it is not working/reachable once deployed. I'm pretty sure that i have to change the port mapping and exposure in the docker compose. Usually i would think to use the port 443 but this is already used by the edge device. So what i should do to make it work?   Below my docker compose file:   version: "2.4" services: mendix: image: mendix:latest restart: always volumes: - "./publish/:/publish/" - "./cfg-data/:/cfg-data/" environment: MXRUNTIME_DatabaseType: PostgreSQL MXRUNTIME_DatabaseUserName: postgres MXRUNTIME_DatabasePassword: DATABASE_PASSWORD MXRUNTIME_DatabaseName: mendix MXRUNTIME_DatabasePort: DATABSE_PORT MXRUNTIME_DatabaseHost: db_postgre ADMIN_PASSWORD: ANADMINPASSWORD CERTIFICATE_AUTHORITIES_BASE64: "A VERY LONG CERTIFICATE" expose: - 60000 ports: - "60000:8080" # here which port should i map with a custom URL? networks: - proxy-redirect logging: driver: "json-file" options: max-file: "3" max-size: "63m" mem_limit: 1gb volumes: mendix-data: networks: proxy-redirect: external: true name: proxy-redirect                    
asked
3 answers
1

Hi Alessandro,

 

you have basicaly two options how you can enable your app users to access Mendix on Edge applications. 

 

First option (recomended) is to use the embeded reverse proxy of Industrial Edge. Edge then takes care of the login and also securing the communicaiton to be HTTPS and not just HTTP.  This option also allows you to use the remote access feature from IEM.

 

With this option you can choose the string in the URL after the device IP address/DNS name. For example

 

https://192.168.100.1/mymendixapp/

 

you cannot choose the root domain because that is reserved for the edge runtime.

 

all you need to do is choose the default nginx configuration in the plugin wizzard and then select this option in URL dropdown menu.

 

For example this is how I expose my app as https://192.168.100.1/mendix/ on any IED.

image.png

 

In the Version Creation then you will have the option to select that option:

image.png

 

If you have this configured then you also can configure a DNS to IP resolution in your own DNS server and then you can have something like

 

https://myied.com/mymendixapp/

 

to replace the IP address with DNS name. Please note that you need to have a proper DNS infrastructure in place to be able to use this DNS name.

 

Second option is to use a simple port maping in the docker compose file which as you correctly already tried in your example

      - "60000:8080"

 

Then you app will be accesible via IP address of the edge device and your selected port on HTTP

 

http://192.168.100.1:60000

 

This is not the recommended option but good starting point for debugging.

 

 

 

 

answered
0

Hey Alessandro,

You can use MXRUNTIME_ApplicationRootUrl: "https://myapp" under environment variables.

 

If you opt to use NGINX explicitly, then it is not required to set. Instead, NGINX will handle all the requests

answered
0

Hi,

I have a similar question, but I want to access Mendix via the standard https://edge_ip/medix.

My app consists of a backend, a database, and the Mendix container. I want to build it through our CI/CD pipeline, not manually with the plugin.

Could you help me with the NGINX settings for Mendix?

Do I need to expose a port, or will NGINX handle that? I don’t want to access the app via HTTP on a port number.

(I know it’s running in dev mode; that will be changed later.)

My simplified docker-compose and nginx config. I use the IECTL to upload the app to the IEM.

 

  mendix-client:
    image: custom_mendix:latest
    container_name: mendix-client
    mem_limit: 1024m
    environment:
      - RUNTIME_PORT=8080
      - MXRUNTIME_DTAPMode=D
      - ADMIN_PASSWORD=...
      - CF_INSTANCE_INDEX=0
      - MXRUNTIME_UseXForwardedHeaders=true

      # Database configuration
      - MXRUNTIME_DatabaseType=PostgreSQL
      - MXRUNTIME_DatabaseHost=postgres-db:5432
      - MXRUNTIME_DatabaseName=...
      - MXRUNTIME_DatabaseUserName=...
      - MXRUNTIME_DatabasePassword=...

    depends_on:
      - postgres
    restart: unless-stopped
    networks:
      - app-network
      - proxy-redirect

Add these are my edge app settings:

    NGINX_JSON: '{"mendix-client":[{"name":"appname","protocol":"HTTP","port":"8080","headers":"{}","subPath": "", "rewriteTarget":"/", "isSecureRedirection":false, "bypassUrlDecoding":false}]}'
    REDIRECT_SECTION: "mendix-client"
    REDIRECT_TYPE: "FromBoxReverseProxy"
    REDIRECT_URL: "medix/"
    IMAGE_TAR_JSON: '{"backend":"backend.tar", "mendix-client":"mendix.tar", "postgres":"postgres.tar"}'

 

answered