├── .gitignore ├── images ├── run_test.png ├── create_test.png ├── jaeger_traces.png └── test_creation.png ├── tracetest ├── config.yml ├── tests │ ├── go-server-test.yml │ ├── otel-demo.yml │ ├── recommendation-service-test.yml │ └── cart-service-test.yml ├── jobspec │ ├── go-server.nomad │ ├── jaeger.nomad │ ├── postgres.nomad │ ├── traefik.nomad │ ├── tracetest.nomad │ └── otel-collector.nomad ├── README.md └── tracetest.yaml ├── temporal ├── README.md └── jobspec │ ├── my-sql.nomad │ ├── traefik.nomad │ └── temporal.nomad ├── k0s ├── config │ └── nomad.config.hcl ├── resources │ ├── docker-compose.yaml │ └── k0sctl.yaml ├── k8s_test │ └── jaeger.yaml ├── README.md └── jobspec │ └── k0s.nomad ├── README.md └── otel-demo-app ├── jobspec ├── redis.nomad ├── currencyservice.nomad ├── emailservice.nomad ├── adservice.nomad ├── shippingservice.nomad ├── paymentservice.nomad ├── cartservice.nomad ├── productcatalogservice.nomad ├── quoteservice.nomad ├── jaeger.nomad ├── ffspostgres.nomad ├── loadgenerator.nomad ├── featureflagservice.nomad ├── checkoutservice.nomad ├── recommendationservice.nomad ├── traefik.nomad ├── frontendproxy.nomad ├── frontend.nomad ├── prometheus.nomad ├── grafana.nomad ├── otel-collector.nomad └── otel-collector-with-LS.nomad ├── README.md └── resources └── docker-compose-otel-demo-rendered.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | **.DS_Store 2 | *scratchpad* -------------------------------------------------------------------------------- /images/run_test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avillela/nomad-conversions/HEAD/images/run_test.png -------------------------------------------------------------------------------- /tracetest/config.yml: -------------------------------------------------------------------------------- 1 | scheme: http 2 | endpoint: tracetest.localhost 3 | analyticsEnabled: false 4 | -------------------------------------------------------------------------------- /images/create_test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avillela/nomad-conversions/HEAD/images/create_test.png -------------------------------------------------------------------------------- /images/jaeger_traces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avillela/nomad-conversions/HEAD/images/jaeger_traces.png -------------------------------------------------------------------------------- /images/test_creation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avillela/nomad-conversions/HEAD/images/test_creation.png -------------------------------------------------------------------------------- /temporal/README.md: -------------------------------------------------------------------------------- 1 | # Temporal on Nomad 2 | 3 | For details on how to deploy [Temporal](https://temporal.io) on Nomad, check out [my blog post on Medium](https://faun.pub/just-in-time-nomad-running-temporal-on-nomad-5fee139f37ea). -------------------------------------------------------------------------------- /k0s/config/nomad.config.hcl: -------------------------------------------------------------------------------- 1 | # Nomad config file if you want to run Nomad locally in dev mode 2 | client { 3 | host_volume "k0s" { 4 | # If the directory doesn't already exist, run: mkdir -p ~/k0s 5 | path = "~/k0s" 6 | } 7 | } 8 | 9 | plugin "docker" { 10 | config { 11 | allow_privileged = true 12 | 13 | volumes { 14 | enabled = true 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tracetest/tests/go-server-test.yml: -------------------------------------------------------------------------------- 1 | type: Test 2 | spec: 3 | name: Go Server Example 4 | description: Go Server Example 5 | trigger: 6 | type: http 7 | httpRequest: 8 | url: http://go-server.service.consul:9000 9 | method: GET 10 | specs: 11 | - selector: span[tracetest.span.type="general" name="signing up"] 12 | assertions: 13 | - attr:name = "signing up" 14 | - attr:registrant.name = "Kathryn Janeway" 15 | -------------------------------------------------------------------------------- /k0s/resources/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: "3.9" 2 | services: 3 | k0s: 4 | container_name: k0s 5 | image: docker.io/k0sproject/k0s:latest 6 | # command: k0s controller --config=/etc/k0s/config.yaml --enable-worker 7 | command: k0s controller --enable-worker 8 | hostname: k0s 9 | privileged: true 10 | volumes: 11 | - "/var/lib/k0s" 12 | tmpfs: 13 | - /run 14 | - /var/run 15 | ports: 16 | - "6443:6443" 17 | network_mode: "bridge" 18 | environment: 19 | ETCD_UNSUPPORTED_ARCH: arm64 20 | # K0S_CONFIG: |- 21 | # apiVersion: k0s.k0sproject.io/v1beta1 22 | # kind: ClusterConfig 23 | # metadata: 24 | # name: k0s 25 | # # Any additional configuration goes here ... -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Nomad Conversions 2 | 3 | Repo of Docker Compose and/or Kubernetes manifests converted to Nomad Jobspecs. 4 | 5 | If I'm feeling extra-adventurous, I will try creating Nomad Packs for these. 6 | 7 | This is work in progress. 8 | 9 | ## Nomad binary 10 | 11 | You can download the Nomad binary [here](https://developer.hashicorp.com/nomad/downloads). 12 | 13 | ## Running the examples 14 | 15 | You can run all of these examples on [Hashiqube](https://hashiqube.com). I have a fork of Hashiqube with all of the configs required to run jobspecs in this repo, which you can check out [here](https://github.com/avillela/hashiqube/README.md). 16 | 17 | ## Readmes 18 | 19 | * [OTel Demo App on Nomad](otel-demo-app/README.md) 20 | * [Temporal on Nomad](temporal/README.md) 21 | * [Tracetest on Nomad](tracetest/README.md) 22 | * [K0s on Nomad](k0s/README.md) 23 | -------------------------------------------------------------------------------- /otel-demo-app/jobspec/redis.nomad: -------------------------------------------------------------------------------- 1 | job "redis" { 2 | type = "service" 3 | datacenters = ["dc1"] 4 | 5 | group "redis" { 6 | count = 1 7 | 8 | network { 9 | mode = "host" 10 | 11 | port "db" { 12 | static = 6379 13 | } 14 | } 15 | 16 | service { 17 | name = "redis-service" 18 | port = "db" 19 | 20 | check { 21 | interval = "10s" 22 | timeout = "5s" 23 | type = "script" 24 | task = "redis" 25 | command = "redis-cli" 26 | args = [ 27 | "-h", "${NOMAD_IP_db}", 28 | "-p", "${NOMAD_PORT_db}", 29 | "PING" 30 | ] 31 | } 32 | } 33 | 34 | 35 | task "redis" { 36 | driver = "docker" 37 | 38 | config { 39 | image = "redis:alpine" 40 | image_pull_timeout = "25m" 41 | ports = ["db"] 42 | } 43 | 44 | restart { 45 | attempts = 10 46 | delay = "15s" 47 | interval = "2m" 48 | mode = "delay" 49 | } 50 | 51 | resources { 52 | cpu = 55 53 | memory = 150 54 | } 55 | 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /temporal/jobspec/my-sql.nomad: -------------------------------------------------------------------------------- 1 | job "mysql-server" { 2 | datacenters = ["dc1"] 3 | type = "service" 4 | 5 | group "mysql-server" { 6 | count = 1 7 | 8 | volume "mysql" { 9 | type = "host" 10 | read_only = false 11 | source = "mysql" 12 | } 13 | 14 | restart { 15 | attempts = 10 16 | interval = "5m" 17 | delay = "25s" 18 | mode = "delay" 19 | } 20 | 21 | task "mysql-server" { 22 | driver = "docker" 23 | 24 | volume_mount { 25 | volume = "mysql" 26 | destination = "/var/lib/mysql" 27 | read_only = false 28 | } 29 | 30 | env = { 31 | "MYSQL_ROOT_PASSWORD" = "password" 32 | } 33 | 34 | config { 35 | image = "hashicorp/mysql-portworx-demo:latest" 36 | 37 | ports = ["db"] 38 | } 39 | 40 | resources { 41 | cpu = 500 42 | memory = 1024 43 | } 44 | 45 | service { 46 | name = "mysql-server" 47 | port = "db" 48 | 49 | check { 50 | type = "tcp" 51 | interval = "10s" 52 | timeout = "2s" 53 | } 54 | } 55 | } 56 | network { 57 | port "db" { 58 | static = 3306 59 | } 60 | } 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /tracetest/jobspec/go-server.nomad: -------------------------------------------------------------------------------- 1 | job "go-server" { 2 | 3 | datacenters = ["dc1"] 4 | 5 | group "go-server" { 6 | count = 1 7 | 8 | 9 | network { 10 | 11 | port "app-port" { 12 | to = 9000 13 | static = 9000 14 | } 15 | 16 | } 17 | 18 | service { 19 | name = "go-server" 20 | tags = [ 21 | "traefik.http.routers.go-server.rule=Host(`go-server.localhost`)", 22 | "traefik.http.routers.go-server.entrypoints=web", 23 | "traefik.http.routers.go-server.tls=false", 24 | "traefik.enable=true", 25 | ] 26 | 27 | port = "app-port" 28 | 29 | } 30 | 31 | task "go-server" { 32 | driver = "docker" 33 | 34 | config { 35 | image = "ghcr.io/avillela/go-sample-server:1.0.0" 36 | force_pull = true 37 | image_pull_timeout = "20m" 38 | ports = [ 39 | "app-port", 40 | ] 41 | } 42 | 43 | env { 44 | COLLECTOR_ENDPOINT = "otelcol-http.service.consul:4318" 45 | } 46 | 47 | restart { 48 | attempts = 10 49 | delay = "15s" 50 | interval = "2m" 51 | mode = "delay" 52 | } 53 | 54 | resources { 55 | cpu = 40 56 | memory = 150 57 | } 58 | 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /otel-demo-app/jobspec/currencyservice.nomad: -------------------------------------------------------------------------------- 1 | job "currencyservice" { 2 | type = "service" 3 | datacenters = ["dc1"] 4 | 5 | group "currencyservice" { 6 | count = 1 7 | 8 | network { 9 | mode = "host" 10 | 11 | port "containerport" { 12 | to = 7001 13 | } 14 | } 15 | 16 | service { 17 | name = "currencyservice" 18 | port = "containerport" 19 | 20 | check { 21 | type = "tcp" 22 | interval = "10s" 23 | timeout = "5s" 24 | } 25 | } 26 | 27 | task "currencyservice" { 28 | driver = "docker" 29 | 30 | config { 31 | image = "otel/demo:v1.1.0-currencyservice" 32 | image_pull_timeout = "10m" 33 | ports = ["containerport"] 34 | } 35 | 36 | restart { 37 | attempts = 10 38 | delay = "15s" 39 | interval = "2m" 40 | mode = "delay" 41 | } 42 | 43 | env { 44 | CURRENCY_SERVICE_PORT = "${NOMAD_PORT_containerport}" 45 | OTEL_RESOURCE_ATTRIBUTES = "service.name=currencyservice" 46 | } 47 | 48 | template { 49 | data = < 🚨🚨 **IMPORTANT NOTE:** Nomad doesn't currently have support for `cgroupsns`, so Luiz, who happens to be a developer on the Nomad team, created a special build for this. Note that it's not an official build...yet...maybe? You can download the binaries [here](https://github.com/hashicorp/nomad/actions/runs/5312709136). 12 | 13 | This is based on the official k0s docs for [running k0s with Docker](https://docs.k0sproject.io/v1.27.2+k0s.0/k0s-in-docker/#start-k0s). 14 | 15 | **NOTES:** 16 | * If you are using Docker Desktop as the runtime, starting from 4.3.0 version it's using cgroups v2 in the VM that runs the engine. This means you have to add some extra flags to the above command to get kubelet and containerd to properly work with cgroups v2. More info [here](https://docs.k0sproject.io/v1.27.2+k0s.0/k0s-in-docker/#1-initiate-k0s). 17 | * If you are running a Mac with a Silicon processor, you need to include the environment variable `-e ETCD_UNSUPPORTED_ARCH=arm`, as documented [here](https://docs.k0sproject.io/v1.27.2+k0s.0/troubleshooting/#k0s-controller-fails-on-arm-boxes). 18 | 19 | ```bash 20 | docker run -it --rm \ 21 | --name k0s --hostname k0s \ 22 | --privileged \ 23 | --cgroupns=host -v /sys/fs/cgroup:/sys/fs/cgroup:rw \ 24 | -v /var/lib/k0s \ 25 | -p 6443:6443 \ 26 | -e ETCD_UNSUPPORTED_ARCH=arm \ 27 | docker.io/k0sproject/k0s:v1.27.2-k0s.0 k0s controller --enable-worker --no-taint 28 | 29 | # Check pod and node status 30 | docker exec k0s kubectl get pods -A -w 31 | docker exec k0s kubectl get nodes -w 32 | 33 | # Try some kubectl commands 34 | docker exec k0s kubectl get ns 35 | docker exec k0s kubectl get svc 36 | 37 | # Get kubeconfig file 38 | docker exec k0s cat /var/lib/k0s/pki/admin.conf 39 | ``` 40 | 41 | ## Running Nomad 42 | 43 | If you prefer to run this example locally using the Nomad binary instead of on [Hashiqube](README.md#Running-the-examples), all you need to do is start up Nomad using command below: 44 | 45 | ```bash 46 | # Assuming you're in the nomad-conversions root directory 47 | nomad agent -dev -config k0s/config/config.hcl 48 | ``` 49 | 50 | 51 | ## Run k0s in Nomad 52 | 53 | 1. Deploy the job to Nomad 54 | 55 | ```bash 56 | nomad job run k0s/jobspec/k0s.nomad 57 | ``` 58 | 59 | 2. Update your `kubeconfig` to access k0s 60 | 61 | This allows you to use `kubectl` to access your k0s cluster. You'll also need to have `kubectl` installed on your machine. Installation isntructions can be found [here](https://kubernetes.io/docs/tasks/tools/#kubectl). 62 | 63 | ```bash 64 | export ALLOCATION_ID=$(nomad job allocs -json k0s | jq -r '.[0].ID') 65 | 66 | # Add the k0s cluster to kubeconfig 67 | nomad alloc exec $ALLOCATION_ID cat /var/lib/k0s/pki/admin.conf > ~/.kube/config 68 | 69 | # Check readiness of k0s cluster (open each in new terminal window) 70 | kubectl get nodes -w 71 | kubectl get pods -A -w 72 | ``` 73 | 74 | 3. Deploy Jaeger to the cluster 75 | 76 | >**NOTE:** This does not work, due to the Kubelet issue mentioned above. I mean, it creates the Kubernetes resources, but the deployment is perpetually left in a `pending` state. 77 | 78 | ```bash 79 | # Deploy test app 80 | kubectl apply -f k0s/k8s_test/jaeger.yaml 81 | ``` 82 | 83 | 4. Test Jaeger 84 | 85 | Set up port-forwarding 86 | 87 | ```bash 88 | # Set up port-forwarding 89 | kubectl port-forward -n opentelemetry svc/jaeger-all-in-one-ui 16686:16686 90 | ``` 91 | 92 | Jaeger should be available at http://localhost:16686. 93 | -------------------------------------------------------------------------------- /tracetest/README.md: -------------------------------------------------------------------------------- 1 | # Tracetest on Nomad 2 | 3 | **Assumption:** You have a Nomad/Vault/Consul HashiCorp environment running in a DC or locally using [HashiQube](https://github.com/avillela/hashiqube) set up. These jobspecs are set up assuming you are running Nomad locally via HashiQube. Please update accordingly for a setup in a Data Center. 4 | 5 | ## Converstion Process from Helm to Jobspec Template 6 | 7 | This conversion was started by using the Tracetest Helm chart output to create the Tracetest jobspecs. 8 | 9 | For details on how to convert Kubernetes manifests to Nomad Jobspecs, check out my blog post [here](https://medium.com/dev-genius/how-to-convert-kubernetes-manifests-into-nomad-jobspecs-7a58d2fa07a0). 10 | 11 | Some additional info: 12 | 13 | * Rendering the Tracetest Helm charts to Kubernetes YAML manifests: 14 | 15 | ```bash 16 | helm repo add kubeshop https://kubeshop.github.io/helm-charts 17 | helm repo update 18 | helm template tracetest kubeshop/tracetest > tracetest.yaml 19 | ``` 20 | 21 | * Base64 decode k8s secrets 22 | 23 | I do this so that I can find out the credentials to pass to Postgres when defining the `postgres.nomad` job. Right now, they're hard-coded. You will want to use Vault to store these credentials in a real-life scenario. 24 | 25 | ```bash 26 | # postgres password 27 | echo bEtjeTdlWHRIdg== | base64 -d 28 | 29 | # password 30 | echo bm90LXNlY3VyZS1kYXRhYmFzZS1wYXNzd29yZA== | base64 -d 31 | ``` 32 | 33 | ## Deploying Tracetest on Nomad 34 | 35 | Please note that this example sends traces to both Lightstep and Jaeger. In order to send traces to Lightstep, you will need: 36 | 37 | * A Lightstep Account. You can create a free account [here](https://app.lightstep.com/signup/developer?signup_source=docs) 38 | * A [Lightstep Access Token](https://docs.lightstep.com/docs/create-and-manage-access-tokens) 39 | 40 | > **NOTE:** Jaeger is currently disabled from the OTel pipeline (need to fix a connectivity bug). We are sending traces to Lightstep only. 41 | 42 | 1. Start up [HashiQube](https://rubiksqube.com/#/) per the instuctions [here](https://github.com/avillela/hashiqube) 43 | 44 | 2. Set up Vault 45 | 46 | Follow the instructions [here](https://github.com/avillela/hashiqube#vault-setup). You will need this to add your Lightstep Access Token to Vault, so that you can send traces to Lightstep. 47 | 48 | 3. Add your Lightstep Access Token to Vault 49 | 50 | ```bash 51 | vault kv put kv/otel/o11y/lightstep ls_token="" 52 | ``` 53 | 54 | Where `` is your [Lightstep Access Token](https://docs.lightstep.com/docs/create-and-manage-access-tokens) 55 | 56 | 4. Update `/etc/hosts` 57 | 58 | Add the following entries: 59 | 60 | ```text 61 | 127.0.0.1 tracetest.localhost 62 | 127.0.0.1 jaeger-ui.localhost 63 | 127.0.0.1 go-server.localhost 64 | ``` 65 | 66 | This will enable you to access various endpoints in this example. 67 | 68 | 5. Deploy to Nomad 69 | 70 | ```bash 71 | cd tracetest 72 | nomad job run -detach jobspec/traefik.nomad 73 | nomad job run -detach jobspec/jaeger.nomad 74 | nomad job run -detach jobspec/postgres.nomad 75 | nomad job run -detach jobspec/tracetest.nomad 76 | nomad job run -detach jobspec/otel-collector.nomad 77 | nomad job run -detach jobspec/go-server.nomad 78 | ``` 79 | 80 | 6. Access the Tracetest and Jaeger UIs 81 | 82 | * Tracetest: `http://tracetest.localhost` 83 | * Jaeger: `http://jaeger-ui.localhost` 84 | 85 | ## Tracetest setup 86 | 87 | Now that you've installed Tracetest, let's configure and run a test. 88 | 89 | 1. Configure Tracetest 90 | 91 | ```bash 92 | tracetest configure --endpoint http://tracetest.localhost --analytics=false 93 | ``` 94 | 95 | This creates a `config.yml` file in the folder from which you run the `tracetest configure` command. 96 | 97 | > **NOTE:** There's already a `config.yml` file in this repo, so running the above command will overwrite it. 98 | 99 | 2. Run the sample test 100 | 101 | ```bash 102 | tracetest test run --definition tests/go-server-test.yml 103 | ``` 104 | 105 | Sample output: 106 | 107 | ```bash 108 | ✔ Go Server Example (http://tracetest.localhost/test/QUQB0jc4g/run/1/test) 109 | ``` 110 | 111 | ## Nukify Jobs 112 | 113 | ```bash 114 | nomad job stop -purge traefik 115 | nomad job stop -purge jaeger 116 | nomad job stop -purge postgres 117 | nomad job stop -purge tracetest 118 | nomad job stop -purge otel-collector 119 | nomad job stop -purge go-server 120 | ``` 121 | 122 | # Gotchas 123 | 124 | When you first run a test in Tracetest, the UI doesn't necessarily refresh the `Trace` and `Test` tabs automagically, so to get around this, you might need to refresh these pages yourself manually until you see the trace diagram. 125 | -------------------------------------------------------------------------------- /otel-demo-app/jobspec/otel-collector.nomad: -------------------------------------------------------------------------------- 1 | job "otel-collector" { 2 | region = "global" 3 | 4 | datacenters = ["dc1"] 5 | namespace = "default" 6 | 7 | type = "service" 8 | 9 | 10 | constraint { 11 | attribute = "${attr.kernel.name}" 12 | value = "linux" 13 | } 14 | 15 | group "otel-collector" { 16 | count = 1 17 | network { 18 | mode = "host" 19 | port "healthcheck" { 20 | to = 13133 21 | } 22 | port "jaeger-compact" { 23 | to = 6831 24 | // UDP??? 25 | } 26 | port "jaeger-grpc" { 27 | to = 14250 28 | } 29 | port "jaeger-thrift" { 30 | to = 14268 31 | } 32 | port "metrics" { 33 | to = 8888 34 | } 35 | port "otlp" { 36 | to = 4317 37 | } 38 | port "otlp-http" { 39 | to = 4318 40 | } 41 | port "prometheus" { 42 | to = 9464 43 | } 44 | port "zipkin" { 45 | to = 9411 46 | } 47 | } 48 | 49 | 50 | task "otel-collector" { 51 | driver = "docker" 52 | 53 | config { 54 | image = "otel/opentelemetry-collector-contrib:0.64.1" 55 | image_pull_timeout = "25m" 56 | entrypoint = [ 57 | "/otelcol-contrib", 58 | "--config=local/config/otel-collector-config.yaml", 59 | ] 60 | ports = [ 61 | "otlp-http", 62 | "zipkin", 63 | "healthcheck", 64 | "jaeger-compact", 65 | "jaeger-grpc", 66 | "jaeger-thrift", 67 | "prometheus", 68 | "metrics", 69 | "otlp" 70 | ] 71 | } 72 | 73 | restart { 74 | attempts = 10 75 | delay = "15s" 76 | interval = "2m" 77 | mode = "delay" 78 | } 79 | 80 | env { 81 | HOST_DEV = "/hostfs/dev" 82 | HOST_ETC = "/hostfs/etc" 83 | HOST_PROC = "/hostfs/proc" 84 | HOST_RUN = "/hostfs/run" 85 | HOST_SYS = "/hostfs/sys" 86 | HOST_VAR = "/hostfs/var" 87 | } 88 | 89 | template { 90 | data = <` is your [Lightstep Access Token](https://docs.lightstep.com/docs/create-and-manage-access-tokens#create-an-access-token) 88 | 89 | The OTel Collector job [pulls this value from Vault, into the Collector’s config YAML](https://github.com/avillela/nomad-conversions/blob/cefe9b9b12d84fb47be8aa5fc67b1b221b7b599b/otel-demo-app/jobspec/otel-collector.nomad-with-LS#L125-L128), so that we can also send Traces and Metrics to Lightstep: 90 | 91 | ``` 92 | otlp/ls: 93 | endpoint: ingest.lightstep.com:443 94 | headers: 95 | "lightstep-access-token": "{{ with secret "kv/data/otel/o11y/lightstep" }}{{ .Data.data.ls_token }}{{ end }}" 96 | ``` 97 | 98 | 4. Run the version of the OTel Collector jobspec that contains the Lightstep configurations by replacing `nomad job run -detach otel-demo-app/jobspec/otel-collector.nomad` with `nomad job run -detach otel-demo-app/jobspec/otel-collector-with-LS.nomad` 99 | 100 | ## Nuke deployments 101 | 102 | ```bash 103 | nomad job stop -purge traefik 104 | nomad job stop -purge redis 105 | nomad job stop -purge ffspostgres 106 | nomad job stop -purge otel-collector 107 | nomad job stop -purge adservice 108 | nomad job stop -purge cartservice 109 | nomad job stop -purge currencyservice 110 | nomad job stop -purge emailservice 111 | nomad job stop -purge featureflagservice 112 | nomad job stop -purge paymentservice 113 | nomad job stop -purge productcatalogservice 114 | nomad job stop -purge quoteservice 115 | nomad job stop -purge shippingservice 116 | nomad job stop -purge checkoutservice 117 | nomad job stop -purge recommendationservice 118 | nomad job stop -purge frontend 119 | nomad job stop -purge frontendproxy 120 | nomad job stop -purge loadgenerator 121 | nomad job stop -purge grafana 122 | nomad job stop -purge jaeger 123 | nomad job stop -purge prometheus 124 | ``` 125 | 126 | ## Running Tracetest for OTel Demo App 127 | 128 | 1. Deploy 129 | 130 | ```bash 131 | nomad operator scheduler set-config -memory-oversubscription true 132 | 133 | nomad job run -detach tracetest/jobspec/traefik.nomad 134 | nomad job run -detach tracetest/jobspec/postgres.nomad 135 | nomad job run -detach tracetest/jobspec/tracetest.nomad 136 | nomad job run -detach tracetest/jobspec/otel-collector.nomad 137 | nomad job run -detach tracetest/jobspec/go-server.nomad 138 | nomad job run -detach otel-demo-app/jobspec/redis.nomad 139 | nomad job run -detach otel-demo-app/jobspec/ffspostgres.nomad 140 | 141 | nomad job run -detach otel-demo-app/jobspec/adservice.nomad 142 | nomad job run -detach otel-demo-app/jobspec/cartservice.nomad 143 | nomad job run -detach otel-demo-app/jobspec/currencyservice.nomad 144 | nomad job run -detach otel-demo-app/jobspec/emailservice.nomad 145 | nomad job run -detach otel-demo-app/jobspec/featureflagservice.nomad 146 | nomad job run -detach otel-demo-app/jobspec/paymentservice.nomad 147 | nomad job run -detach otel-demo-app/jobspec/productcatalogservice.nomad 148 | nomad job run -detach otel-demo-app/jobspec/quoteservice.nomad 149 | nomad job run -detach otel-demo-app/jobspec/shippingservice.nomad 150 | nomad job run -detach otel-demo-app/jobspec/checkoutservice.nomad 151 | nomad job run -detach otel-demo-app/jobspec/recommendationservice.nomad 152 | nomad job run -detach otel-demo-app/jobspec/frontend.nomad 153 | nomad job run -detach otel-demo-app/jobspec/loadgenerator.nomad 154 | nomad job run -detach otel-demo-app/jobspec/frontendproxy.nomad 155 | nomad job run -detach otel-demo-app/jobspec/grafana.nomad 156 | nomad job run -detach otel-demo-app/jobspec/jaeger.nomad 157 | nomad job run -detach otel-demo-app/jobspec/prometheus.nomad 158 | ``` 159 | 160 | 2. Run tests 161 | 162 | Cart Service test 163 | 164 | ```bash 165 | tracetest test run --definition tracetest/tests/cart-service-test.yml 166 | ``` 167 | 168 | Sample output: 169 | 170 | ```bash 171 | ✔ CartService gRPC Test (http://tracetest.localhost/test/avtest123/run/3/test) 172 | ``` 173 | 174 | 175 | Recommendation Service test 176 | 177 | ```bash 178 | tracetest test run --definition tracetest/tests/recommendation-service-test.yml 179 | ``` 180 | 181 | Sample output: 182 | 183 | ```bash 184 | ✔ RecommendationService test (http://tracetest.localhost/test/avtest456/run/4/test) 185 | ``` 186 | 187 | Note that in order to get these to run, I had to set static ports for both [`recommendationservice.nomad`](recommendationservice.nomad) and [`cartservice.nomad`](cartservice.nomad). 188 | 189 | 3. Nukify 190 | 191 | ```bash 192 | nomad job stop -purge traefik 193 | nomad job stop -purge postgres 194 | nomad job stop -purge tracetest 195 | nomad job stop -purge otel-collector 196 | nomad job stop -purge go-server 197 | nomad job stop -purge redis 198 | nomad job stop -purge ffspostgres 199 | 200 | nomad job stop -purge adservice 201 | nomad job stop -purge cartservice 202 | nomad job stop -purge currencyservice 203 | nomad job stop -purge emailservice 204 | nomad job stop -purge featureflagservice 205 | nomad job stop -purge paymentservice 206 | nomad job stop -purge productcatalogservice 207 | nomad job stop -purge quoteservice 208 | nomad job stop -purge shippingservice 209 | nomad job stop -purge checkoutservice 210 | nomad job stop -purge recommendationservice 211 | nomad job stop -purge frontend 212 | nomad job stop -purge loadgenerator 213 | nomad job stop -purge frontendproxy 214 | nomad job stop -purge grafana 215 | nomad job stop -purge jaeger 216 | nomad job stop -purge prometheus 217 | ``` 218 | 219 | ## Notes 220 | 221 | ### Communication Between Services 222 | 223 | In order for services to communicate between each other, you need to use Consul templating. For example: 224 | 225 | ```hcl 226 | template { 227 | data = <