Platform

HTTP Gateway Deployment and Configuration

Docker

This deployment guide leverages Docker and Docker Compose

This deployment method has the following prerequisites:

Control Plane

Synadia Platform components support a simplified process for connecting to Control Plane using what's called a "platform component token". This process removes the need to create a dedicated account, NATS user, and download NATS user credentials. Instead, you simply enable the platform component in the system settings and Control Plane uses a dedicated platform component account. You then use the platform component token when deploying HTTP Gateway to connect to Control Plane. Control Plane will tell the HTTP Gateway what NATS servers to connect to.

You can also follow the manual method of creating a dedicated account, NATS user, and downloading NATS user credentials. If you would like to follow this method, continue to Manual Configuration.

Platform Component

1/3Navigate to the system settings.
  • In Control Plane, go to Settings for your system
  • Scroll to Enable HTTP Gateway, nested under the Platform section.
  • Enable it, add an access URL, and click Save at the top.
  • Scroll down to Component Token and copy the token to your clipboard. We'll need it for docker compose.

Continue to Login to Registry.

Manual Configuration

  • Prepare the NATS access URL and make sure the NATS system is reachable from the deployment location. For example, if the NATS system is running on the same machine as the HTTP Gateway and using the default NATS server port, the access URL would be nats://localhost:4222.
  • Select the port one which HTTP Gateway should be accessible. The default is port 80, but you may want to use a different port when testing locally.

Here is a interactive walk-through for configuring the HTTP Gateway within Control Plane. Written steps are also available below.

Configure resources in Control Plane

  • In Control Plane, go to Accounts and add a new account called http-gateway.
  • Click into the new account and click the Users tab and add a new user called http-gateway.
  • Click into the new user and click Get Connected and then Download Credentials. Save the file and rename it to http-gateway.creds.
  • Click on the JetStream tab and add a new KV bucket called tokens.

Enable HTTP Gateway in Control Plane

Back on system page, click on the Settings page and under the HTTP Gateway section do the following:

  • Enable it
  • Account: choose http-gateway
  • Token Bucket: tokens
  • External access URL: http://<server>:<port>

Click the Submit button at the top.

Login to Registry

Using the registry credentials you were given, login to:

docker login registry.synadia.io

Docker Compose file

Create a file called docker-compose.yaml with the following settings, depending on the configuration method you chose above.

http-gateway:
  image: registry.synadia.io/http-gateway:latest
  environment:
    NHG_PORT: '8080'
    NHG_TOKENS_BUCKET: 'tokens'
    NHG_DISABLE_LOGGING: 'false'
    NHG_PLATFORM_TOKEN: '<COMPONENT_TOKEN_FROM_CONTROL_PLANE>'
    NHG_CONTROL_PLANE_URL: '<CONTROL_PLANE_UI_URL_FOR_API_ACCESS>'
  ports:
    - 8080:8080
  command:
    - 'run'
Environment VariableUsage
NHG_PORTListen port of HTTP Gateway
NHG_URLNATS URL
NHG_TOKENS_BUCKETKV bucket name for state management - do not change!
NHG_PLATFORM_TOKENConnect to Control Plane with this platform component token
NHG_CONTROL_PLANE_URLURL for Control Plane when registering with a platform component token
NHG_PROVIDER_CREDSPath to HTTP Gateway provider credentials

Start the containers

Run the following command to bring up the stack.

docker compose up -d

Upgrade the image

To upgrade Control Plane's image and restart, use the following commands:

docker compose pull http-gateway
docker compose up -d

Stop the containers

docker compose down

The container volume data can be deleted by including the -v option:

docker compose down -v

Basic usage

Issue an API token as shown here: https://docs.synadia.com/cloud/resources/http-gateway

curl -H "Authorization: Bearer <API_TOKEN>" \
    https://<your gateway>:<port>/v1/kvm/buckets