Development Environment

Unlike the production environment, the dev environment builds the images for Cyphon using local files. You’ll need to download the Cyphon GitHub repository into the /opt/cyphon/cyphon directory so these files are available to Docker Compose:

$ git clone https://github.com/dunbarcyber/cyphon.git /opt/cyphon/cyphon

Settings for the dev environment are contained in the docker-compose.dev.yml file. To use the dev environment, you must specify both the base configuration file and the dev configuration file when starting the containers:

$ cd /opt/cyphon/cyphondock
$ sudo docker-compose -f docker-compose.yml -f docker-compose.dev.yml up

Use the -d flag if you want to start the containers in the background.

Superuser

The dev environment will create a Cyphon superuser using the CYPHON_USERNAME and CYPHON_PASSWORD settings defined in your .config/env/cyphon.env file, if that user does not already exist.

Ports

The dev environment maps the exposed ports in the containers to random free ports on the host. This prevents any problems with ports already in use on the host. Once the docker containers are running, you can list the containers to see which ports on the host are being used for the various services:

$ sudo docker ps -a

For example, the Kibana container exposes port 5601, but that port will be mapped to a random port on the host machine. If the port mapping for the Kibana container is 0.0.0.0:32775->5601/tcp, you would visit http://localhost:32775 in your web browser to access Kibana.

Data Volumes

Unlike the production environment, the dev environment does not assign any specific host directories to store data from PostgreSQL, Elasticsearch, or MongoDB. Instead, it allows those services to automatically configure the locations for their data volumes. This prevents any confusion of dev and production data if the production environment is used at a later time. See Docker’s documentation to learn more about data volumes.

Container Overrides

Cyphon

This override for the base Cyphon service will create a Docker container using the Cyphon dev image. It will also create a superuser using the settings in the Cyphon environment file, and load starter settings from Fixtures.

YAML:

cyphon:
  extends:
    file: common-services.yml
    service: cyphon-dev
  environment:
    CYPHON_SUPERUSER: "YES"
    LOAD_EXAMPLE_FIXTURES: "YES"
  ports:
    - "8000"

Celerybeat

This override for the base Celerybeat service will create a Docker container using the Cyphon dev image.

YAML:

celerybeat:
  extends:
    file: common-services.yml
    service: cyphon-dev

Celeryworker

This override for the base Celeryworker service will create a Docker container using the Cyphon dev image.

YAML:

celeryworker:
  extends:
    file: common-services.yml
    service: cyphon-dev

LogChutes

This override for the base LogChutes service will create a Docker container using the Cyphon dev image.

YAML:

logchutes:
  extends:
    file: common-services.yml
    service: cyphon-dev

Monitors

This override for the base Monitors service will create a Docker container using the Cyphon dev image.

YAML:

monitors:
  extends:
    file: common-services.yml
    service: cyphon-dev

Watchdogs

This override for the base Watchdogs service will create a Docker container using the Cyphon dev image.

YAML:

watchdogs:
  extends:
    file: common-services.yml
    service: cyphon-dev

Nginx

This override for the base Nginx service will map the ports used by Cyphon, Kibana, and RabbitMQ to random ports on the host machine.

YAML:

nginx:
  ports:
    - "80"     # Cyphon
    - "443"    # Cyphon
    - "5601"   # Kibana
    - "15672"  # RabbitMQ management plugin

RabbitMQ

This override for the base RabbitMQ service will map port 15672 of the Logstash container to a random port on the host machine. This port is used for the RabbitMQ management web interface.

YAML:

rabbit:
  ports:
    - "15672"  # RabbitMQ management plugin

Logstash

This override for the base Logstash service will map ports 5044-5045 of the Logstash container to random ports on the host machine.

YAML:

logstash:
  ports:
    - "5044"
    - "5045"

Kibana

This override for the base Kibana service will map port 5601 of the Kibana container to a random port on the host machine.

YAML:

kibana:
  ports:
    - "5601"