Learn how to set up databases and other pieces of third-party software upon which your preview environment depends.
docker-compose.yml
you’re using for Ergomake environments.
These pieces of third-party software are usually available on Docker Hub images already. Therefore, you can just tell Docker Compose to pull them and fill the necessary environment variables.
docker-compose.yml
file, you can run docker-compose up
to ensure your application works on your machine. If it does, you’re ready to commit your docker-compose.yml
file and start using preview environments. Remember: whatever you can run locally with Docker Compose, you can also run on the cloud.
Now, whenever you open a pull-request, Ergomake will spin-up a cloud environment that’s just like your local one. Then, the Ergomake Bot will add a comment to your pull-request containing a link to that environment.
From there on, you can already cURL
your API using the URL sent by the Ergomake Bot or connect a local front-end app to it, for example.
localhost
port, just as you’d do with a local docker-compose.yml
.
Once you do that, Ergomake will always expose the first bound port in your service’s ports
attribute.
In the example above, our back-end’s port 3001
is publicly accessible because it’s the first bound port for the backend
service. On the other hand, that MongoDB instance isn’t exposed to the internet.
27017
port to a localhost
port, as shown below.