7.2. RackHD: Local Docker Based Environment Set-up

This tutorial will walk you through getting an instance of RackHD up and running on your local desktop or laptop, this will enable you to see the hosted API documentation and experiment with the APIs.

7.2.1. Prerequisites

You will need to install Docker and Docker Compose before setting up the environment.

You may also want to consider installing jq which provides a command-line oriented tool for pretty printing and filtering JSON structured data.

../_images/invisible1.png

7.2.2. What We’re Setting up

../_images/vagrant_setup.png

The Docker Compose file will download the latest released versions of the RackHD Services from the RackHD DockerHub. It will create two docker bridge networks to run the services. The rackhd_admin network will be used to connect the services together and to access the RackHD APIs. The rackhd_southbound network will be used by RackHD to connect to the virtual nodes.

The Docker Compose setup also enables port forwarding that allows your localhost to access the RackHD instance:

  • localhost:9090 redirects to rackhd_admin:9090 for access to the REST API
  • localhost:9093 redirects to rackhd_admin:8443 for secure access to the REST API
../_images/invisible1.png

7.2.3. Set up RackHD in Docker using Docker Compose

How to set up these environments is shown as follows.

  1. Clone the RackHD repository

    git clone https://github.com/RackHD/RackHD.git
    cd RackHD/example/rackhd
    
  2. Download and start the RackHD services with the docker-compose up file. This command will load the configuration from the docker-compse.yml file.

    docker-compose -f docker-compose.yml up -d
    
    ../_images/docker_compose_up.png
  3. Now use the docker-compose ps command to check whether the RackHD services are now up and running.

    docker-compose ps
    

    If RackHD is set up successfully, the result will be shown as follows.

    ../_images/docker_compose_ps.png
  4. The command docker-compose logs will output the logs from all the running RackHD services. Additionally, you can stop the services with the command docker-compose stop, or stop and delete the services with docker-compopse down.