Building and running SDC using Docker for OSX

These instructions have been verified on OSX High Sierra 10.13.4 using Docker for Mac Version 18.05.0-ce-rc1-mac63 (24246), which is latest edge version, stable channel will work as well.

Requirements:

  1. Recent Docker for Mac (tested with latest edge and stable release)
  2. Docker for Mac has to be sized to allow running all SDC containers, see instructions.
  3. Basic development utils for building the source code (Git, java, maven etc..)


Instructions:

Make sure your docker is up and running, and is fully updated. Once docker is up and running (you can pull images and run them, ie docker pull ubuntu && docker run -it ubuntu /bin/bash), set resources for docker to something like this(these work on my MacBook Pro 15 Retina):

Save settings and restart docker.

Building the source code

Change directory to SDC project and run:

Building source code
mvn clean install -Pdocker

This will build entire project and all docker containers. Note that this might take a while.

Preparing the configuration files

These instructions are taken from: Deploying SDC on a Linux VM for Development and slightly modified to facilitate for OSX specifics.

  1. Inside SDC project root directory, create new folder called data
  2. Add above created data directory to gitignore, as we don't want this to be included with any commits.
  3. Inside data directory, do following:
    1. create opt/config/ 
    2. place the following files in this data/opt/config/ folder:
    3. Configuration files
      nexus_username.txtenv_name.txtnexus_docker_repo.txtnexus_password.
    4. Inside data directory, create environments directory 
    5. Copy the file from here: https://git.onap.org/sdc/tree/sdc-os-chef/environments/Template.json into data/environments/AUTO.json
    6. Edit AUTO.json file, replace yyy with your en0 IP address (your laptop's IP address), and update name and description xxx with AUTO
      1. #brew install iproute2mac # uncomment if needed for following commands
         
        IP=`ip route get 8.8.8.8 | awk '/src/{ print $7 }'`
        sed -i '' -e"s/yyy/${IP}/g" ./AUTO.json
         
        sed -i '' -e"s/xxx/AUTO/g" ./AUTO.json

Example file looks like this after editing:

AUTO.json
{
  "name": "AUTO",
  "description": "OpenSource-AUTO",
  "cookbook_versions": {
    "Deploy-SDandC": "= 1.0.0"
  },
  "json_class": "Chef::Environment",
  "chef_type": "environment",

  "default_attributes": {
    "disableHttp": false,
    "CS_VIP": "159.107.152.117",
    "BE_VIP": "159.107.152.117",
    "ONBOARDING_BE_VIP": "159.107.152.117",
    "FE_VIP": "159.107.152.117",
    "ES_VIP": "159.107.152.117",
    "KB_VIP": "159.107.152.117",
    "DCAE_BE_VIP": "159.107.152.117",
    "DCAE_FE_VIP": "159.107.152.117",
    "interfaces": {
      "application": "eth0",
      "private": "eth1"
    },
    "ECompP": {
      "ecomp_rest_url": "http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/auxapi",
      "ueb_url_list": "10.0.11.1,10.0.11.1",
      "app_secret": "XftIATw9Jr3VzAcPqt3NnJOu",
      "app_key": "x9UfO7JsDn8BESVX",
      "inbox_name": "ECOMP-PORTAL-INBOX",
      "ecomp_redirect_url": "http://portal.api.simpledemo.openecomp.org:8989/ECOMPPORTAL/login.htm",
      "app_topic_name": "ECOMP-PORTAL-OUTBOX-SDC1",
      "decryption_key": "AGLDdG4D04BKm2IxIWEr8o=="
    },
    "UEB": {
      "PublicKey": "iPIxkpAMI8qTcQj8",
      "SecretKey": "Ehq3WyT4bkif4zwgEbvshGal",
      "fqdn": ["10.0.11.1", "10.0.11.1"]
    },
    "Nodes": {
      "CS": [
        "159.107.152.117"
      ],
      "BE":            "159.107.152.117",
      "ONBOARDING_BE": "159.107.152.117",
      "FE":            "159.107.152.117",
      "ES": [
        "159.107.152.117"
      ],
      "KB":            "159.107.152.117"
    },
    "Plugins": {
      "DCAE": {
        "dcae_discovery_url": "159.107.152.117",
        "dcae_source_url": "159.107.152.117"
      },
      "WORKFLOW": {
        "workflow_discovery_url": "159.107.152.117",
        "workflow_source_url": "159.107.152.117"
      }
    },
    "VnfRepo": {
      "vnfRepoPort": "8702",
      "vnfRepoHost": "192.168.50.5"
    }
  },
  "override_attributes": {
    "FE": {
      "http_port": "8181",
      "https_port": "9443"
    },
    "BE": {
      "http_port": "8080",
      "https_port": "8443"
    },
    "ONBOARDING_BE": {
      "http_port": "8081",
      "https_port": "8445"
    },
    "elasticsearch": {
      "cluster_name": "SDC-ES-",
      "ES_path_home": "/usr/share/elasticsearch",
      "ES_path_data": "/usr/share/elasticsearch/data",
      "num_of_replicas": "0",
      "num_of_shards": "1"
    },

    "cassandra": {
      "concurrent_reads": "32",
      "num_tokens": "256",
      "data_dir": "/var/lib/cassandra/data",
      "hinted_handoff_enabled": "true",
      "cassandra_user": "asdc_user",
      "cassandra_password": "Aa1234%^!",
      "concurrent_writes": "32",
      "cluster_name": "SDC-CS-",
      "multithreaded_compaction": "false",
      "cache_dir": "/var/lib/cassandra/saved_caches",
      "log_file": "/var/lib/cassandra/log/system.log",
      "phi_convict_threshold": "8",
      "commitlog_dir": "/var/lib/cassandra/commitlog",
      "socket_read_timeout": "20000",
      "socket_connect_timeout": "20000",
      "titan_connection_timeout": "10000"
    }
  }
}


Running containers:

Change directory to SDC project and export WORKSPACE env variable:

WORKSPACE ENV VAR
export WORKSPACE=$(pwd)

and you can start locally built containers now with:

Running SDC containers
sdc-os-chef/scripts/docker_run.sh -e AUTO -l

It takes a while to start them all and init cassandra, elastic and import normatives, but after sometime you should have:


All containers will be exposed (as per Docker for OSX) on localhost and your machine IP (en0 interface).

Troubleshooting:

  1. All scripts are located here: sdc-os-chef/scripts/, in case something isnt going right, modify first line /bin/bash to /bin/bash -xv for additional debugging.
  2. Make sure docker_run.sh command is executed only after WORKSPACE env var is defined, otherwise scripts will use / as path for data directory (look for files in /data and /opt)