# Trial

[Synadia Platform](https://synadia.com/platform) is a bundled distribution of enterprise-grade components that augment the capabilities of [NATS.io](https://nats.io).

The current components include:

* [NATS](https://nats.io): The core connective technology underlying the platform
* [Control Plane](/platform/1.14/control-plane.md): The unified interface (UI and API) for securing, managing, and monitoring NATS deployments
* [Private Link](/platform/1.14/private-link.md): A lightweight agent for bridging connectivity between NATS and a remote Control Plane instance
* [Connectors](/platform/1.14/connectors.md): The suite of connectors for bridging NATS to external systems
* [Workloads](/platform/1.14/workloads.md): The NATS-native way to deploy and manage workloads across various runtimes
* [HTTP Gateway](/platform/1.14/http-gateway.md): An HTTP API for interacting with NATS data and services

For this trial, the goal is to spin up an isolated stack using Docker in order to evaluate the features of the platform.

note

If you run into any issues during your trial, reply to the trial email, use our [contact form](https://www.synadia.com/contact), or drop a message in the `#synadia` channel in the [NATS.io Slack](https://slack.nats.io)!

## Prerequisites

### Sign up for the trial

[Sign up here](https://synadia.com/platform/trial) if you haven't already. You will receive an email with credentials to access the Synadia image registry. This provides access to OCI-compliant images (e.g. Docker).

### Install Docker

If you don't have Docker installed, refer to the [Get Docker](https://docs.docker.com/get-docker/) documentation for instructions on how to install Docker Desktop or [Docker Engine](https://docs.docker.com/engine/install/) on your plaform.

An alternate option is [Podman](https://podman.io/), which is a daemonless container engine that can be used as a drop-in replacement for Docker. If this is preferred, pass the `--podman` flag to the setup scripts to run the whole stack with Podman. For the manual setup, any reference to `docker` in the commands below can be replaced with `podman`, provided `podman compose` is configured properly.

### Optional: Workloads and Connectors

The setup scripts can also start a Nex node, which runs Workloads and Connectors as containers on your machine. This requires two additional tools:

* [Podman](https://podman.io/docs/installation): Nex uses the Podman socket to run workloads, even when the rest of the stack runs on Docker. On macOS, make sure the Podman machine is running with `podman machine start`.
* [nk](https://docs.nats.io/using-nats/nats-tools/nk): Nex uses `nk` to generate its node seed. Install it with `go install github.com/nats-io/nkeys/nk@latest`.

If either tool is missing, the scripts skip Nex and the rest of the trial works normally.

## Automated setup

### Bootstrapping

If you want to bootstrap the trial with a one-shot command, run the following. It will prompt for your Synadia image registry credentials.

```
curl -fsSL https://raw.githubusercontent.com/synadia-io/platform-trial/refs/heads/main/scripts/bootstrap.sh | bash -s -- --interactive
```

It will do the following:

* Clone the [platform-trial repository](https://github.com/synadia-io/platform-trial)
* Login to the Synadia image registry
* Pull the required images from the registry
* Start Control Plane, NATS cluster, and HTTP Gateway containers
* Bootstrap a Control Plane admin user and system
* Ask whether to start a Nex node for running Workloads and Connectors

The script accepts a few optional flags:

* `--nex`: Start the Nex node without prompting. Nex is skipped automatically if `podman` or `nk` are missing.
* `--podman`: Run the whole stack with Podman instead of Docker.

For example, to bootstrap the trial with a Nex node:

```
curl -fsSL https://raw.githubusercontent.com/synadia-io/platform-trial/refs/heads/main/scripts/bootstrap.sh | bash -s -- --interactive --nex
```

To stop the trial, run the following (add `--podman` if you started the stack with Podman):

```
cd ./platform-trial

./scripts/stop.sh
```

### No bootstrap

If the thought of piping a `curl` command to `bash` makes you shiver, you can still automate most of the trial setup with just a few commands.

#### Login to the image registry

Using the credentials from the previous step, login to the Synadia image registry, following the prompts.

```
docker login registry.synadia.io
```

#### Clone the trial repository

The next step is to clone the `platform-trial` repository which contains the Docker Compose file and pre-defined configuration for the trial.

```
git clone https://github.com/synadia-io/platform-trial.git

cd platform-trial
```

#### Start the trial

Using Linux, macOS, or WSL on Windows, run the `start.sh` script. You can also run the script with `--help` to see optional flags.

This script runs everything the [bootstrap](#bootstrapping) script runs except cloning the repository and authenticating to the Synadia image registry. It accepts the same `--nex` and `--podman` flags.

```
./scripts/start.sh --open
```

To stop the trial, run the following (add `--podman` if you started the stack with Podman):

```
./scripts/stop.sh
```

## Manual setup

The manual steps below cover starting the Synadia Platform stack, one step at a time.

### Login to the image registry

Using the credentials from the previous step, login to the Synadia image registry, following the prompts.

```
docker login registry.synadia.io
```

### Clone the trial repository

The next step is to clone the `platform-trial` repository which contains the Docker Compose file and pre-defined configuration for the trial.

```
git clone https://github.com/synadia-io/platform-trial.git

cd platform-trial
```

### Setup Control Plane and NATS

The first component to setup is Control Plane.

#### Start Control Plane

In your terminal, run the following command from the root of the repository:

```
docker compose up -d control-plane
```

#### Login to Control Plane

To facilitate the setup within Control Plane, review the interactive walkthrough as you progress.

[Control Plane Setup](https://demo.arcade.software/nrjPRwLYGG1foAx3EB1x?embed\&show_copy_link=true)

Open a browser and navigate to `http://localhost:8080`. Enter a username and password to create an admin user. You will be redirected to a page with a button `Add System` to connect your first NATS system.

warning

If you have previously ran the trial and are setting it up from scratch again, you may need to clear the browser cache in order to be prompted to create an admin user.

Open the browser developer tools, navigate to the Storage tab, and clear session storage, local storage, and cookies.

#### Add a NATS system

Click `Add System` and enter the following information with the `Create` option chosen.

* Name: `trial`
* URL: `nats://nats1:4222,nats://nats2:4222,nats://nats3:4222`

In this example, the hostnames of the URL are the names of the NATS containers in the Docker Compose file.

note

Why all three URLs? This is generally a best practice when configuring an application connecting to NATS to provide multiple URLs. If one URL is specified and that server happens to be temporarily unavailable, the application will not be able to connect. By providing multiple URLs, the application can try each one until it successfully connects.

Leave `Enable JetStream` checked and click `Save`. You will be redirected to the `NATS Settings` page.

#### Configure NATS settings

For `Choose a platform...`, select `Docker`. Copy the configuration in the section `2. Create a file named...` and paste it into the file called `shared.conf` in the root of the trial repository. This configuration contains the generated operator and system account JWTs used for preloading in the NATS configuration.

Click `Continue`, then under `Select NATS Connection Method`, choose `Connect Directly to NATS`.

#### Start the NATS cluster

Run the following command to bring up the NATS cluster:

```
docker compose up -d nats1 nats2 nats3
```

#### Test the NATS connection

Back in Control Plane, click `Test Connection`. You should see a success message and click `Submit`.

Finally, click on the `Overview` tab to see the cluster visualization.

#### Create a user and account

Now, let's see how we can create a user and account within Control Plane. Control Plane leverages NATS' [decentralized authentication model](https://docs.nats.io/running-a-nats-service/configuration/securing_nats/auth_intro/jwt) in order to support dynamically managing accounts and users.

note

For those familiar with decentralized auth, all management is done through the Control Plane UI or API rather than needing to [nsc](https://docs.nats.io/using-nats/nats-tools/nsc) and manage keys in a directory.

Click `Accounts` and add a new account called `trial`. Click into the new account and click the `Users` tab and add a new user called `trial`.

Click into the new user and click `Get Connected` and then `Download Credentials`. Save the file and rename it to `trial.creds` and move it to the root of the trial repository.

Using the credentials, you can now connect to the NATS cluster using the [`nats` CLI tool](https://docs.nats.io/using-nats/nats-tools/nats_cli):

```
nats --creds trial.creds --server nats://localhost:4222 pub test "Hello, World!"
```

### Setup HTTP Gateway

HTTP Gateway provides an HTTP interface for interacting with key-value buckets, object stores, and backend microservices. Although this is an optional component to setup, for environments where only an HTTP client is available, this can act as a bridge for those applications.

* For creating an API token see [HTTP Gateway in Synadia Cloud](/cloud/http-gateway.md)
* For usage examples see the [HTTP Gateway preview announcement](https://www.synadia.com/blog/synadia-cloud-http-gateway-preview).

Like above, here is a interactive walkthrough for configuring the HTTP Gateway within Control Plane.

[HTTP Gateway Setup](https://demo.arcade.software/mb25nY2TbIKi1wNKP6wn?embed\&show_copy_link=true)

#### Create an account, user, and KV bucket

The HTTP gateway is a standalone component that utilizes a standard NATS connection. Additionally, it requires a key-value bucket to store state that it requires. It is recommended to create a dedicated account for the user and bucket.

It it a good practice to separate the accounts and users for different components to ensure proper access control and management.

Back on the `Accounts` page 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` and move it to the root of the trial repository.

Next, click the `JetStream` tab and add a new KV bucket called `tokens`.

#### Enable the HTTP Gateway

Back on the `trial` 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`
* Access URL: `http://localhost:8081`

Click the `Submit` button at the top.

The access URL is the endpoint where the HTTP Gateway will be exposed through Docker Compose.

#### Start the HTTP Gateway

Run the following command to bring up the HTTP Gateway:

```
docker compose up -d http-gateway
```

#### Try out the HTTP Gateway

Now that it is running, we can download an HTTP Gateway token to try it out. We can do this by navigating back to our `trial` user we created earlier and clicking `Get Connected`. You will notice there is now an option for `HTTP Gateway`. Click `Generate Token` and copy it.

note

Why can't I use the NATS credential file directly? This token format was developed for brevity and ease of use. Since the HTTP Gateway token is generated for a specific user, it inherits all the same permissions and limits that are set on that user.

Within your terminal, set `TOKEN` variable so it can be referenced in the following commands (be sure to paste the token you copied):

```
TOKEN=nhg_M6YAsbwyF4jsRbkJ_GEWWL7NkEUUqhPtvaCbBwRKz2SNyLhs3t94pk7WdqHEV
```

Using `curl`, here is an example of creating a new KV bucket called `users`:

```
curl -X POST \

    -H "Authorization: Bearer $TOKEN" \

    -H "Content-Type: application/json" \

    -d '{"max_bytes": 1048576, "history": 10}' \

    http://localhost:8081/v1/kvm/buckets/users
```

And then putting a key-value pair into the bucket:

```
curl -X PUT \

  -H "Authorization: Bearer $TOKEN" \

  -d '{"color": "blue"}' \

  http://localhost:8081/v1/kv/users/john.doe
```

Check out the full API documentation in your browser: <http://localhost:8081/api/>

### Setup Workloads

[Workloads](/platform/1.14/workloads.md) run on a [Nex CE](/platform/1.14/workloads/nex.md) node. Control Plane tells the node what to run, so you set up both sides: enable the Workloads platform component in Control Plane, then point a Nex CE node at it with the platform component token that Control Plane gives you.

The [automated scripts](#automated-setup) do all of this when you pass the `--nex` flag. The steps below do the same work by hand.

#### Enable Workloads in Control Plane

1. In Control Plane, open your NATS system and go to Settings.
2. Scroll to Enable Workloads, nested under the Platform section, and turn it on. Click Submit at the top.
3. Click the Component Token button below Enable Workloads and copy the token. Nex CE uses it to register with Control Plane.

* In Control Plane, go to `Settings` for your NATS system.
* Scroll to `Enable Workloads`, nested under the Platform section, and turn it on. Click `Submit` at the top.
* Click the `Component Token` button below `Enable Workloads` and copy the token. Nex CE uses it to register with Control Plane.

#### Configure the Nex CE node

Create a `nex-ce.config.json` file. Set `platform.token` to the component token you copied, and generate a unique `node_seed` with [nk](https://docs.nats.io/using-nats/nats-tools/nk):

```
$ nats auth nkey gen server  # or `nk -gen=server`

<your node seed>
```

```
{

  "name": "nex",

  "node_seed": "<your node seed>",

  "nexlets": {

    "containers-podman": {

      "enabled": true,

      "registerType": "container",

      "podmanSocketPath": "unix:///podman.sock"

    }

  },

  "platform": {

    "enabled": true,

    "url": "http://control-plane:8080",

    "token": "<your workloads component token>"

  }

}
```

Control Plane supplies the NATS servers and the control account, so the config omits them. For every option, see the [Nex CE deployment guide](/platform/1.14/workloads/nex/deployment.md).

#### Start the Nex CE node

Run the following command to bring up the node:

```
docker compose up -d nex
```

The node registers with Control Plane on start.

#### Enable Workloads on an account

Workloads are enabled per account, which lets you control who can deploy them.

1. Open the account you deploy to, go to Settings, and turn on Enable Workloads. Click Save.
2. A Workloads tab appears in the account navigation, ready for your first workload.
3. Optional: on the JetStream tab, click Create Stream, choose Stream, and name it workload-logs. Give it any subject to satisfy the form.
4. Optional: back in account Settings, choose the stream under Workloads Log Stream and click Save. Control Plane adds the workload log subject to the stream.

* Open the account you deploy to, go to `Settings`, and turn on `Enable Workloads`. Click `Save`.
* A `Workloads` tab appears in the account navigation.

##### Optional: capture the workload logs in a stream

Workloads publish their output to NATS subjects, which you can subscribe to at any time. To keep the logs for later, point the account at a stream:

* On the account `JetStream` tab, click `Create Stream` and choose `Stream`.
* Name it `workload-logs`. The form needs at least one subject, so enter any subject, such as `workload.logs.>`. Click `Save`.
* Back in account `Settings`, choose the stream under `Workloads Log Stream` and click `Save`.

Control Plane adds the workload log subject to the stream for you, so you do not need to enter the `$NEX` subjects by hand.

note

For more detail on per account settings and workload logs, see [Enable Workloads](/platform/1.14/workloads/getting-started/enable.md).

#### Deploy your first workload

Follow the [Workloads getting started guide](/platform/1.14/workloads/getting-started/deploy.md) to deploy a container or a function.

### Setup Connectors

[Connectors](/platform/1.14/connectors.md) run on the same [Nex CE](/platform/1.14/workloads/nex.md) node as Workloads, so set up [Workloads](#setup-workloads) first. On top of that node, Connectors need a catalog: Control Plane holds the catalog platform component, and the node pulls the connector catalog from it on first start.

The [automated scripts](#automated-setup) do all of this when you pass the `--nex` flag. The steps below do the same work by hand.

#### Enable the catalog in Control Plane

The catalog needs an ID that both sides agree on. Generate one with the [NATS CLI](https://docs.nats.io/using-nats/nats-tools/nats_cli):

```
$ nats auth nuid gen

isROOqW7qvtk7Jx3qvjvK0
```

1. In your NATS system Settings, turn on Enable Catalog and paste the NUID you generated into Catalog ID. Workloads is already on from the previous section. Click Submit at the top.
2. Click the Component Token button below Catalog ID and copy the token. The Nex CE node uses it to pull the connector catalog.

* In Control Plane, go to `Settings` for your NATS system.
* Scroll to `Enable Catalog`, nested under the Platform section, and turn it on.
* Paste the NUID you generated into `Catalog ID`. Click `Submit` at the top.
* Click the `Component Token` button below `Catalog ID` and copy the token.

#### Add the catalog to the Nex CE node

Extend the `nex-ce.config.json` you wrote for Workloads. Add a `connectors-podman` nexlet, and a `catalog` block holding the catalog ID and the component token you just copied:

```
 {

   "name": "nex",

   "node_seed": "<your node seed>",

   "nexlets": {

     "containers-podman": {

       "enabled": true,

       "registerType": "container",

       "podmanSocketPath": "unix:///podman.sock"

-    }

+    },

+    "connectors-podman": {

+      "enabled": true,

+      "registerType": "connector",

+      "podmanSocketPath": "unix:///podman.sock"

+    }

   },

   "platform": {

     "enabled": true,

     "url": "http://control-plane:8080",

     "token": "<your workloads component token>"

-  }

+  },

+  "catalog": {

+    "enabled": true,

+    "id": "<your catalog ID>",

+    "token": "<your catalog component token>"

+  }

 }
```

Set `YES_SEED=true` in the node's environment. That setting and the `catalog` block above are what populate the connector catalog on first start.

#### Restart the Nex CE node

Restart the node to pick up the new nexlet and catalog:

```
docker compose up -d --force-recreate nex
```

#### Enable Connectors on an account

Connectors are enabled per account, which lets you control who can deploy them.

1. Open the account you deploy to, go to Settings, and turn on Enable Connectors. Click Save.
2. A Connectors tab appears in the account navigation, ready for your first connector.

* Open the account you deploy to, go to `Settings`, and turn on `Enable Connectors`. Click `Save`.
* A `Connectors` tab appears in the account navigation.

Connectors write their logs to the same subject as Workloads. When both are enabled on an account, the `Connectors Log Stream` follows the `Workloads Log Stream`, so set it under `Optional: capture the workload logs in a stream` above.

#### Deploy your first connector

Follow the [Connectors documentation](/platform/1.14/connectors.md) to deploy your first source or sink connector.

### Stop the trial

Run the following command from the root of the repository to stop all the containers and remove their volumes:

```
docker compose down --volumes
```

### Next steps

You have successfully set up Synadia Platform!

Head over to the [getting started](/platform/1.14/control-plane/guides.md) guide to learn more about the features of Control Plane and watch an intro video.

If you started a Nex node, deploy your first workload with the [Workloads getting started guide](/platform/1.14/workloads/getting-started.md) or move data in and out of NATS with [Connectors](/platform/1.14/connectors.md).

If you have any questions or feedback, please reach out to us at [Synadia](https://www.synadia.com/contact) or in the `#synadia` channel in the [NATS.io Slack](https://slack.nats.io)!
