Server Configuration

To deploy Cyphon using Cyphondock, you’ll need to install Docker and Docker Compose, and configure virtual memory on the host machine.

Minimum System Requirements

Cyphon requires that the server (either dedicated machine or virtual machine) hosting Docker has a minimum of 2 cores and at least 8GB of RAM. Docker-based installation will require at least 20GB of storage space. Expect an increase over time due to Docker’s snapshot system. For production environments, you may want to map data folders to a separate volume with much larger storage capacity.

Install Docker

The following instructions are for installing Docker Community Edition (CE) x86_64 on Ubuntu. For other editions, versions, or operating systems, see Docker’s documentation.

Unistall Older Versions

If you have an older version of Docker already installed, such as docker or docker-engine, uninstall it before proceeding:

$ sudo apt-get remove docker docker-engine

Extra packages for Trusty 14.04

If you’re installing on Ubuntu 14.04 (Trusty), Docker strongly recommends installing the linux-image-extra-* packages:

$ sudo apt-get update

$ sudo apt-get install \
    linux-image-extra-$(uname -r) \
    linux-image-extra-virtual

Install Docker CE

To install Docker Community Edition x86_64:

$ sudo apt-get update
$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository \
    "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
    $(lsb_release -cs) \
    stable"

$ sudo apt-get update
$ sudo apt-get install docker-ce

See Docker’s Ubuntu documentation for more information on this installation procedure. You can also refer to Digital Ocean’s tutorial for Ubuntu 16.04.

Install Docker Compose

To install Docker Compose on Ubuntu, first install pip:

$ sudo apt-get install python-pip

Then install Docker Compose:

$ sudo pip install docker-compose

To install Docker Compose on other operating systems, see Docker’s documentation.

Configure Virtual Memory

This project uses the official Elasticsearch docker repository. These images require a Linux host to allow a process to have at least 262,144 memory-mapped areas (see Elasticsearch’s documentation for more info).

To increase the memory map count:

$ sudo sysctl -w vm.max_map_count=262144

Make this setting permanent by editing /etc/sysctl.conf:

$ echo "vm.max_map_count = 262144" | sudo tee -a /etc/sysctl.conf

Bash Script to Auto Install on Host

You can use the following bash script to auto install the project on an Ubuntu 16.04 server. To install on other operating systems, please modify it accordingly.

#!/bin/bash

# Uninstall older version of Docker if present
sudo apt-get remove docker docker-engine

# Update the apt package index
sudo apt-get update

# Install packages to allow apt to use a repository over HTTPS
sudo apt-get -y install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

# Add Docker’s official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

# Set up the stable repository
sudo add-apt-repository \
    "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
    $(lsb_release -cs) \
    stable"

# Update the apt package index
sudo apt-get update

# Install the latest version of Docker Community Edition
sudo apt-get -y install docker-ce

# Install pip
sudo apt-get -y install python-pip

# Install Docker Compose
sudo pip install docker-compose

# Increase the memory map count for Elasticsearch
sudo sysctl -w vm.max_map_count=262144

# Make this setting permanent by editing /etc/sysctl.conf
echo "vm.max_map_count = 262144" | sudo tee -a /etc/sysctl.conf

# Download the Cyphondock Git repository into the /opt/cyphon directory
sudo git clone https://github.com/dunbarcyber/cyphondock.git /opt/cyphon/cyphondock

# Copy generic settings to the `config` directory for this project instance
cd /opt/cyphon/cyphondock/
sudo cp -R config-COPYME config

# Set up Elasticsearch and PostgreSQL data directories
sudo mkdir -p /opt/cyphon/data/elasticsearch
sudo mkdir /opt/cyphon/data/postgresql
sudo chown -R 1000:1000 /opt/cyphon/data/elasticsearch
sudo chown -R 999:999 /opt/cyphon/data/postgresql

# Build production environment
sudo docker-compose up -d

echo "Loading configurations"
sudo docker exec -it cyphondock_cyphon_1 sh -c "python manage.py loaddata ./fixtures/starter-fixtures.json"

echo "Create a user account for Cyphon"
echo "sudo docker exec -it cyphondock_cyphon_1 sh -c "python manage.py createsuperuser""

echo "Note: To get Twitter working, don't forget to enable the reservoir!"
echo "Note: You will need to add the index pattern on http://ip_addr:5601/ (cyphon-*)"