Guide for using Garnet with Zeet

Step 1: Dockerfile

This method embeds the Garnet CLI in a Dockerfile which requires the GARNET_SERVICE_KEY environment variable. For example, save this as Dockerfile:

FROM alpine
# Install cURL (if not installed)
RUN apk add -U curl
# Install the Garnet CLI
RUN curl -LO https://garnet.jfrog.io/artifactory/garnet-release/garnet-v0.1.0-linux-amd64
RUN chmod +x ./garnet-v0.1.0-linux-amd64
RUN mv ./garnet-v0.1.0-linux-amd64 /usr/bin/garnet
# Fetched variables can be viewed using the env command, for testing.
# In a real use case, this can be replaced with an actual command e.g. npm start
CMD garnet run --service-key=${GARNET_SERVICE_KEY} -- env

After you have a Dockerfile, you can build and run the container in any deployment environment. Note that the value for GARNET_SERVICE_KEY is expected during build time. You can supply this value in your deployment platform of choice. Below, we illustrate the use case for Zeet, a popular deployment platform.

Step 2: Configure the Zeet deployment

While configuring your deployment in Zeet, the options tab in the UI provides a way to supply environment variables for the deployment. You only need to add one variable there:

  1. GARNET_SERVICE_KEY Your Garnet service key can be generated in the Garnet Dashboard. Using a service key ensures that your container pulls only the environment variables under the defined configuration scope.

Voila! now you can use Garnet as a central source of truth for your all your configuration for Zeet. Instead of defining and updating the environment variables manually in the Zeet UI every time you make a change, you can now manage them in Garnet and all your config parameters will be synchronized automatically at buildtime and runtime.

You can switch between environments and configuration contexts by editing the GARNET_SERVICE_KEYvalue.

Configuration your app with Garnet also allows you maintain a single manifest (eg. Dockerfile) across your various environments (eg. dev, staging, prod), without having to manually update the files and configuration locally in case of changes.