Thursday, April 09, 2015

Running the CloudStack Simulator in Docker

CloudStack comes with a simulator. It is very handy for testing purposes, we use it to run our smoke tests on TravisCI for each commit to the code base. However if you want to run the simulator, you need to compile from source using some special maven profiles. That requires you to check out the code and setup your working environment with the dependencies for a successfull CloudStack build.

With Docker you can skip all of that and simply download the cloudstack/simulator image from the Docker Hub. Start a container from that image and expose port 8080 where the dashboard is being served. Once the container is running, you can use docker exec to configure a simulated data center. This will allow you to start fake virtual machines, create security groups and so on. You can do all of this through the dashboard or using the CloudStack API.

So you want to give CloudStack a try ? Use Docker :)

$ docker pull cloudstack/simulator

The image is a bit big and we need to work on slimming it down but once the image is pulled, starting the container will be almost instant. If you feel like sending a little PR just the Dockerfile, there might be a few obvious things to slim down the image.

$ docker run -d -p 8080:8080 --name cloudstak cloudstack/simulator

The application needs a few minutes to start however, something that I have not had time to check. Probably we need to give more memory to the container. Once you can access the dashboard at http://localhost:8080/client you can configure the simulated data-center. You can choose between a basic network which gives you L3 network isolation or advanced zone which gives you a VLAN base isolation:

$ docker exec -ti cloudstack python /root/tools/marvin/marvin/deployDataCenter.py -i /root/setup/dev/basic.cfg

Once the configuration completes, head over to the dashboard http://localhost:8080/client and check your simulated infrastructure

Enjoy the CloudStack simulator brought to you by Docker.

6 comments:

  1. Anonymous8:43 AM

    Create docker image! Thank you!
    There is a smal typo in your howto. --name cloudstak ;-)

    ReplyDelete
  2. mynameis11:16 AM

    I get this error: "Something went wrong; you may go back and correct any errors: Unable to add the host"

    I just followed your instruction

    ReplyDelete
  3. It ask for authentication at http://localhost:8080/client, what are the credentials?

    ReplyDelete
    Replies
    1. That is not working, I installed docker and ran two commands
      docker pull cloudstack/simulator
      docker run -d -p 8080:8080 --name cloudstak cloudstack/simulator

      and then tried to login using admin/password
      but its not working.

      Delete
    2. can you email dev@cloudstack.apache.org

      Delete