# Dev Environment

In this guide, we will walk you through the process of setting up a development environment for Sodot Relay Server.\
Its purpose is to allow you to run the Relay locally, with minimal resources and effort, so you can start integrating it with your code without the need to deploy it on a cloud provider first.

:::tip
If you are looking for a ready-to-use Relay server, you can use the `us1.sodot.dev` as your Relay server address. This server does not validate API keys and is intended for testing purposes only.
:::

## Requirements

Before starting the setup process, make sure you have the following installed:

* Docker - [Install Docker](https://docs.docker.com/get-docker/)

TLS certificate:

* You should obtain a *valid* TLS certificate for the desired domain. Self signed certificates are not supported as the SDKs and Vertex wouldn't accept it.

You will also need to have the following credentials:

* Artifactory User and Token - Follow the instructions in the [Artifactory User and Token](/relay-server/obtaining-artifacts-credentials) page to create a user and token.

:::note[Registry Update]
Sodot has migrated to a new Docker registry, so DockerHub credentials are no longer required and all new updates will be pushed to the new registry.
If you can't access the new registry, please contact the Sodot team.
:::

<br />

## Setup Process

The setup process is made of the following steps:

1. Login to the Sodot Docker registry using the generated user and token
2. Pull the latest Relay Docker image
3. Run the Relay Docker container with the TLS certificate and key mounted

<br />

<br />

### 1. Login to the Sodot Docker registry

To login to the Sodot Docker registry, run the following command:

```bash
docker login -u <ARTIFACTORY_USER> -p <ARTIFACTORY_TOKEN> repo.sodot.dev
```

### 2. Pulling the latest Relay Docker image

To pull the latest Relay Docker image, run the following command:

```bash
docker pull repo.sodot.dev/sodot-docker-oci/sodot-relay-server:latest
```

### 3. Running the Relay Docker container

```bash
docker run -d -p 443:443 -e "RUST_LOG=debug" \
    -e "RELAY_LISTEN_ADDRESS=0.0.0.0:443" \
    -v ${TLS_CERT_LOCATION}:/etc/fullchain.pem \
    -v ${TLS_PRIVKEY_LOCATION}:/etc/privkey.pem \
    repo.sodot.dev/sodot-docker-oci/sodot-relay-server:latest \
    /sodot-relay-server -c /etc/fullchain.pem --key-path /etc/privkey.pem --insecure-api-keys-not-enforced
```

### Optional: Map the domain to localhost

To map the domain to localhost, you can add the following line to your `/etc/hosts` file (Linux/Mac) or `C:\Windows\System32\drivers\etc\hosts` file (Windows):

```bash
127.0.0.1 ${RELAY_DOMAIN}
```

You can now access the Relay at `https://${RELAY_DOMAIN}`.

### Optional: Run the Relay as a http server

To run the relay as an http server, do not pass the `-c /etc/fullchain.pem` and `--key-path /etc/privkey.pem` arguments (or their `RELAY_FULLCHAIN_PATH` and `RELAY_PRIVKEY_PATH` environment-variable equivalents).
Without TLS the Relay listens on port 80 by default, so also change the port settings to `-p 80:80` and `-e "RELAY_LISTEN_ADDRESS=0.0.0.0:80"`.
This is for development purposes and not recommended for production.

SDKs do not support using a Relay without TLS at all.
To setup a vertex to work with http Relay check out the [Vertex Dev environment](/vertex/deployment/vertex_dev_env) page.

If you followed this step you can now access the Relay at `http://${RELAY_DOMAIN}`.

## Next Steps

Now that you have a running Relay instance, you can start integrating with it using the SDKs and Vertex.

## Production Deployment

For production deployment, you can follow the deployment guide of the supported cloud providers:

* [AWS](/relay-server/relay_aws)
* [GCP](/relay-server/relay_gcp)
* [Azure](/relay-server/relay_azure)
