Skip to content
Snippets Groups Projects

Build a development API Gateway

  1. Build a new development Docker image:
$ cd gateway/
$ ./build.sh

This creates a Docker image with the name functions/gateway:latest-dev, but if you want to use something else then pass the tag as an argument to the ./build.sh script. I.e. ./build.sh labels-pr.

  1. Now edit the Docker image for the gateway service in your docker-compose.yml file.

  2. Redeploy the stack.

Test. Repeat.

Hack on the UI for the API Gateway

To hack on the UI without rebuilding the gateway mount the assets in a bind-mount like this:

Remove the Docker stack, then create the faas network as "attachable":

$ docker stack rm func
$ docker network create func_functions --driver=overlay --attachable=true

Now edit the docker-compose.yml file and replace the existing networks block with:

networks:
    functions:
        external:
            name: func_functions

Now you can run the gateway as its own container and bind-mount in the HTML assets.

$ docker run -v `pwd`/gateway/assets:/root/assets -v "/var/run/docker.sock:/var/run/docker.sock" \
-p 8080:8080 --network=func_functions -d functions/gateway:latest-dev

Now deploy the rest of the stack with: ./deploy_stack.sh.