Skip to main content

Introduction

Ergomake generates on-demand environments for you and your team to develop and test changes.

You can also integrate Ergomake with GitHub to automatically create preview links for each pull-request.

Getting started

  1. Install the Ergomake CLI.

    npm i -g ergomake
  2. Create a docker-compose.yml file in your repository's root folder. Ergomake will use this file to generate environments.

    note

    When running from the CLI, Ergomake will ignore images that need to be built.

    # Here's an example docker-compose.yml file
    version: "3.8"
    services:
    # Ergomake will ignore this service
    api:
    build: ./backend
    ports:
    - "3001:3001"

    database:
    image: mongo
    ports:
    # Expose mongo's default port at localhost:9027
    - "9027:27017"
    environment:
    MONGODB_INITDB_ROOT_USERNAME: username
    MONGODB_INITDB_ROOT_PASSWORD: password
  3. Run ergomake up on your terminal to start the remote environment.

    $ ergomake up
    ✔ Found no existing remote environments.
    ✔ Environment ready. Remote services are now bound to localhost.

    [ Press CTRL+C to terminate the environment ]
  4. You can now talk to exposed services in your remote environment just as if they were running on localhost.

    mongosh localhost:9027

Generate pull-request previews

  1. Install the Ergomake Preview GitHub App.

  2. During the installation process, you'll be prompted to give it access to the repository for which you want to generate previews. Make sure to select all the repositories you need.

    ⚠️ Ergomake can't generate previews if it doesn't have access to a repository.

  3. Create a docker-compose.yml file in your repository's root folder. Ergomake will use this file to generate preview environments.

    tip

    If you want environments different from the ones described by the root docker-compose.yml, create a .ergomake folder in your repository's root and add a docker-compose.yml there.

    # Here's an example docker-compose.yml file
    version: "3.8"
    services:
    # On pull-requests, Ergomake can build your own images
    web:
    build: ./frontend
    ports:
    - "8080:8080"

    api:
    build: ./backend
    ports:
    - "3001:3001"

    database:
    image: mongo
    environment:
    MONGODB_INITDB_ROOT_USERNAME: username
    MONGODB_INITDB_ROOT_PASSWORD: password
  4. Open a pull-request and wait for the Ergomake Bot's comment. That comment contains a link to all the applications running within your preview environment.