-
Language:
English
-
Language:
English
4.2. TCP Endpoint Example
This section provides an example
Endpoints entry in a $cartridge_name/metadata/manifest.yml file, and demonstrates how OpenShift Enterprise uses this entry to create environment variables, public proxy port mappings, and httpd routes.
Example 4.3. Endpoints Entry
Name: CustomCart
Cartridge-Short-Name: CUSTOMCART
...
Endpoints:
- Private-IP-Name: HTTP_IP
Private-Port-Name: WEB_PORT
Private-Port: 8080
Public-Port-Name: WEB_PROXY_PORT
Protocols: [ws]
Mappings:
- Frontend: '/web_front'
Backend: '/web_back'
- Frontend: '/socket_front'
Backend: '/socket_back'
Options: { "websocket": true }
- Private-IP-Name: HTTP_IP
Private-Port-Name: ADMIN_PORT
Private-Port: 9000
Public-Port-Name: ADMIN_PROXY_PORT
Protocols: [http]
Mappings:
- Frontend: '/admin_front'
- Backend: '/admin_back'
- Private-IP-Name: INTERNAL_SERVICE_IP
Private-Port-Name: 5544
Public-Port-Name: INTERNAL_SERVICE_PORT
Environment Variables
Several environment variables are created for the cartridge using the information in the Endpoints entry.
Example 4.4. Environment Variables
# Internal IP/port allocations OPENSHIFT_CUSTOMCART_HTTP_IP=<assigned internal IP 1> OPENSHIFT_CUSTOMCART_WEB_PORT=8080 OPENSHIFT_CUSTOMCART_ADMIN_PORT=9000 OPENSHIFT_CUSTOMCART_INTERNAL_SERVICE_IP=<assigned internal IP 2> OPENSHIFT_CUSTOMCART_INTERNAL_SERVICE_PORT=5544 # Public proxy port mappings OPENSHIFT_CUSTOMCART_WEB_PROXY_PORT=<assigned public port 1> OPENSHIFT_CUSTOMCART_ADMIN_PROXY_PORT=<assigned public port 2>
Proxy Port Mapping
Proxy port mapping is assigned using the information in the Endpoints entry.
Example 4.5. Proxy Port Mapping
<assigned external IP>:<assigned public port 1> => OPENSHIFT_CUSTOMCART_HTTP_IP:OPENSHIFT_CUSTOMCART_WEB_PORT <assigned external IP>:<assigned public port 2> => OPENSHIFT_CUSTOMCART_HTTP_IP:OPENSHIFT_CUSTOMCART_ADMIN_PORT
httpd Routing
The httpd routes are assigned using the Endpoints entry.
Example 4.6. httpd Routing
http://<app dns>/web_front => http://OPENSHIFT_CUSTOMCART_HTTP_IP:8080/web_back http://<app dns>/socket_front => http://OPENSHIFT_CUSTOMCART_HTTP_IP:8080/socket_back http://<app dns>/admin_front => http://OPENSHIFT_CUSTOMCART_HTTP_IP:9000/admin_back