Create App Version with Reverse Proxy - Manual - Industrial Edge - Industrial Edge - Industrial Edge - Documentation of Industrial Edge APIs - CLI tools - Industrial Edge - References - APIs

Industrial Edge Platform Operation - APIs & References

Product
Industrial Edge
Edition
12/2024
Language
en-US (original)

After creating application using iectl publisher standalone-app create

You can create an app version by using the nginx reverse proxy with the following command:

# examples are based on given yaml
version: "2.4" 
services: 
  nginx: #serviceName to be used in --redirectsection, to tell device to use this service for app redirection.
    image: nginx:alpine 
    restart: always 
    mem_limit: 200m
$ iectl publisher standalone-app version create \
      --appname "my cool app" \
      --yamlpath "/path/to/folder/with/docker-compose.yaml" \ 
      --versionnumber "1.0.0" \
      --nginxjson '{"nginx":[{"name":"ui","protocol":"HTTP","port":"80","headers":"","rewriteTarget":"/"}]}' \ # nginxjson is json map of docker compose service names and arrays of reverse proxy settings.
      --redirectsection "nginx" \       # redirectsection requires the service name within docker-compose which contains the container that shall be exposed
      --redirecttype "FromBoxReverseProxy" \    # redirecttype is either FromBoxSpecificPort for direct port exposure or FromBoxReverseProxy for reverse proxy exposure
      --redirecturl "ui/" \                 # redirecturl is the port which shall be exposed from your container
      --restredirecturl "" \                    # restredirecturl path will be used upon redirect to your application

The nginx settings will look as follows for example when the app is installed on an Edge Device (Assuing 10.10.10.10 as the service ip in the proxy-redirect network):

location = /ui {
    rewrite /ui/(.*) /$1 break;
    rewrite (^/ui)$ $1/ permanent;
} 
location ~* ^/ui\/ {
    auth_request /auth;
    rewrite /ui/(.*) /$1 break;
    rewrite /ui/ / break;
    rewrite (^/ui)$ $1/ permanent;
    proxy_pass http://10.10.10.10:80;
}