Install Worker

Learn how to install the Skyramp Worker in your environment

The Skyramp Worker acts as the essential foundation for both Mocker, enabling service mocking capabilities, and Tester, facilitating the execution of in-cluster tests.

Prerequisites

If you don’t have Docker Compose installed, refer to Docker’s documentation to install it. Then, follow these two steps to run the Skyramp Worker using Docker Compose:

1. Add Docker Compose for Skyramp

Add the following to an existing docker-compose.yaml or create a new one with the following services and volumes necessary for updating the Docker network:

services:
  skyramp:
    image: public.ecr.aws/j1n2c2p2/rampup/worker:latest
    volumes:
      - skyramp:/etc/skyramp
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - "35142:35142"
    restart: always
  # The services below (dashboard-server, dashboard-client, and mongodb)
  # can be included optionally for Skyramp Dashboard bring up
  dashboard-server:
    image: public.ecr.aws/j1n2c2p2/rampup/dashboard-server:latest
    environment:
      NODE_ENV: production
      DOCKER_ENV: true 
    ports:
      - "4000:4000"
    restart: always
  dashboard-client:
    image: public.ecr.aws/j1n2c2p2/rampup/dashboard-client:latest
    environment:
      NODE_ENV: production
    ports:
      - "3000:3000"
    restart: always
  mongodb:
    image: mongo:6.0.6
    container_name : mongo-datastore-svc
    ports:
      - "27017:27017"
    environment:
      MONGO_INITDB_ROOT_USERNAME: admin
      MONGO_INITDB_ROOT_PASSWORD: skyramp
      MONGO_INITDB_DATABASE: dashboarddb
    volumes:
      - mongodb:/data/db
    restart: always
volumes:
  mongodb:
  skyramp:

2. docker compose up

Deploy the Skyramp Worker by running the following:

docker compose up -d --wait

Installing Worker with Python Modules (Optional)

If you need to include additional Python modules in your Skyramp Worker for running dynamic requests and responses, you can follow these steps to build a custom Worker image with the required modules and then deploy it using Docker Compose.

Building the Worker Image with Python Modules

  1. Create a Dockerfile in your project directory or modify the existing one if you have it.

    FROM --platform=linux/amd64 public.ecr.aws/j1n2c2p2/rampup/worker:latest
    COPY requirements.txt /
    RUN pip3 install -r /requirements.txt
    

    This Dockerfile uses the base Skyramp Worker image and copies your requirements.txt file into it, then installs the Python modules specified in requirements.txt. Make sure to replace requirements.txt with the actual name of your requirements file.

  2. Build the custom Worker image using the docker build command. Replace <image-name> with a suitable name for your custom image and <image-tag> with the desired tag:

    docker build -t <image-name>:<image-tag> .
    

Using the Custom Worker Image

Now that you have built the custom Worker image with your Python modules, you can update your docker-compose.yaml file to use the new custom image. Replace public.ecr.aws/j1n2c2p2/rampup/worker:latest with <image-name>:<image-tag> in the image field under the skyramp service:

services:
  skyramp:
    image: <image-name>:<image-tag>
    volumes:
      - skyramp:/etc/skyramp
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - 35142:35142
    restart: always
volumes:
  skyramp:

Continue to How to Mock Services » to learn how to generate and apply service mocks, or to How to Test Services » to learn how to write and start functional and load tests.