0

I am writing this question because I couldn't find a way to change the default Hasura console port when using Hasura docker image.

The page I'm referring is this

enter image description here

There is no variable defined to change the Hasura default console port in the above page.

The reason I'm requesting this feature is to separate query histories of my two hasura projects. If I could manage to run these two consoles on two different ports I will be able to save the query/mutation history seperately.

Dulara Malindu
  • 1,477
  • 4
  • 18
  • 37

2 Answers2

1

I have not used Hasura image previously, but I have used docker a lot to run MySQL instances etc. What I typically do depends on whether or not I am using docker-compose or just plain docker run.

If using docker compose you can specify a port mapping for each container, e.g. map 9695 -> 9005 would look like so:

    hasura:
        image: hasura
        ports:
            - 9005:9695

or if using docker run following these docs e.g. docker run --expose 9695:9005 hasura ...

wilson208
  • 346
  • 2
  • 7
  • setting the port will change the hasura api endpoint, not the hasura console. and also I'm using network-mode host. so that I will not be able to use port forwarding like that – Dulara Malindu May 29 '21 at 05:01
0

Hasura's Dockerfile has graphql-engine serve as its CMD. You can override this default command by your own command and pass --server-port or any config to serve, as per the reference page.

setting the port will change the hasura api endpoint, not the hasura console

That's not entirely true. If HASURA_GRAPHQL_ENABLE_CONSOLE=true Hasura will serve the console on the /console route of the server API endpoint. However, for production, it's recommended to disable the console and run Hasura CLI locally, connected to the production instance.

Renato
  • 826
  • 9
  • 9