Skip to content

Install Development Environment

Robert Hafner edited this page Jul 29, 2018 · 6 revisions

One of the main goals of Nebula is to make development easy. Although Nebula has a lot of dependencies it should be easy to throw away and recreate the development environment.

To accomplish this Nebula uses docker-compose for managing the developer environment. Once installing the docker tools we'll need to edit our configuration with the details and credentials from AWS, and then we can

Besides the Nebula Worker and Nebula App services it also builds the Postgres, RabbitMQ, OpenLDAP, and phpLDAPAdmin services- complete with already created user accounts. This means that you can essentially ignore all of these services while developing for Nebula.

This tutorial is going to focus on building out those configuration details.

Configuring

Docker and Docker Compose

To run the development environment you will need both docker and docker-compose.

Settings File

Before building the environment you will need to alter the settings file docker/app/settings.yaml and add your AWS region, subnets, and security group.

If you don't know what those values are or have not yet set up an account with AWS then this tutorial might be a good place to start.

AWS Credentials

You will need to add your AWS Credentials to your machine before building the environment. The easiest way to do that is with the aws cli configure command, which will add give you an interactive prompt to enter the your credentials and create the needed files. The docker-compose.yaml configuration is already setup to share the AWS configuration files from the host machine.

Controlling the Environment

Launching

Now that it's configured launching the entire environment can be done with a single command from inside the Nebula directory-

docker-compose up --build

This will build and launch the containers that run each of the services. You will see the output logs from each container in the terminal you ran the command in.

Now you can open the Nebula app in your computer's browser at http://127.0.0.1. If the page doesn't load immediately it may be that the services need another minute to load.

Stopping and Destroying

Stopping the docker-compose up --build command (by pressing ctrl-c or closing the terminal that is running it) also stops the containers themselves. Running docker-compose up will bring those same containers back up again.

To actually destroy the existing containers run docker-compose down. Since this is a development environment no care is spent on preserving data between runs, so any database or LDAP changes you made will be gone. Running instances, however, will still exist- make sure you clear out any test machines either with Nebula or using the AWS Console to avoid a surprise bill.

Helpful Hints

  • Individual containers can be restarted by running docker-compose restart servicename (ie, docker-compose restart app).
  • docker-compose exec -u root servicename /bin/bash will launch a shell as root for that service.

Accessing the Application

Emulating Production

The web application portion of Nebula should be available through 127.0.0.1.

Development Server

Running Flask in debug mode makes development easier, as it provides much more detailed logs and will reload the application when files change.

docker-compose exec -u nebula app /bin/bash
./bin/devserv.sh

When run this debug server is available at 127.0.0.1:5000.

Users

There are two users in the LDAP directory-

  • admin (password: admin)
  • user (password: user)