I have an application that needs 2 url for frontend and backend server(API) server.
Example:
for this we need 3 urls:
# dns settings
APP_HOST=rmm.example.com
API_HOST=api.example.com
MESH_HOST=mesh.example.com
How can i handle the configurations for all this 3 urls.
For mesh central we can use an external Meshcentral server made by @mrmarkuz .
Any ways to handle and on top use a proxy manager such as traefik or nginx
mrmarkuz
(Markus Neuberger)
2
In build-images.sh
you can allocate ports, see also Port allocation | NS8 dev manual
For example in mattermost 2 TCP ports are allocated:
Set an env variable to an allocated port:
In your case you need create 3 traefik http routes, example for 1 route:
1 Like
So for my case i will have
response = agent.tasks.run(
agent_id=agent.resolve_agent_id('traefik@node'),
action='set-route',
data={
'instance': os.environ['MODULE_ID'],
'url': 'http://127.0.0.1:' + os.environ["TCP_PORT"],
'host': host,
'http2https': h2hs,
'lets_encrypt': le
},
)
response = agent.tasks.run(
agent_id=agent.resolve_agent_id('traefik@node'),
action='set-route',
data={
'instance': os.environ['MODULE_ID'],
'url': 'http://127.0.0.1:' + os.environ["API_TCP_PORT"],
'host': host,
'http2https': h2hs,
'lets_encrypt': le
},
)
something like this
and what of registering the url in traefik eg:
agent.set_env("TRAEFIK_HOST", host)
1 Like
mrmarkuz
(Markus Neuberger)
4
This just sets the environment variable TRAEFIK_HOST to the host variable.
For example to set the http route for apihost:
apihost = data.get("apihost")
agent.set_env("API_HOST", apihost)
response = agent.tasks.run(
agent_id=agent.resolve_agent_id('traefik@node'),
action='set-route',
data={
'instance': os.environ['MODULE_ID'],
'url': 'http://127.0.0.1:' + os.environ["API_TCP_PORT"],
'host': apihost,
'http2https': h2hs,
'lets_encrypt': le
},
)
1 Like