Installation

Contact Synchronization server consists of two services: contact server and single sign on server. We provide preconfigured docker images for both services and a docker-compose file for simple deployment.

Requirements

You will need a machine that runs a reasonably new version of docker engine (at least 1.10.0) and a reasonably new version of docker-compose (at least 1.6.0). Please refer to docker installation guide for your system on how to install docker and to docker-compose installation guide for information on how to install docker-compose.

You will also need a TLS certificate for your contact server.

Installation

Start by logging into our docker registry:

docker login -u customer -p Aen1ieB5sh docker.acrobits.net

Create an empty directory called contacts and inside it create a file called docker-compose.yaml with the following content:

---
version: '2'
services:
    sso:
      image: docker.acrobits.net/releases/sso
      links:
        - redis
      ports:
        - "127.0.0.1:8082:8080"
      restart: always

    redis:
      image: redis:3.0
      restart: always

    mongo:
      image: mongo:3.0
      volumes:
        - /data/mongo:/data/db
      restart: always

    contact_server:
      image:  docker.acrobits.net/releases/contact_server
      links:
        - mongo
        - sso
        - redis
      ports:
        - "127.0.0.1:8081:8080"
      restart: always

To start the services , run the following command in the directory:

docker-compose up -d

This will pull all needed docker images from docker registries, start all relevant containers, link them together and make both sso and contact server listen on loopback interface on ports 8082 and 8081 respectively.

Note

If you are deploying the services inside a virtual machine, the services may take long time to start. This is because the machine does not have enough available entropy for random number generation. One way to increase available entropy is using haveged service.

The next step is setting up reverse HTTPS proxy that will expose both these services to your users.

Suppose the machine running the services is example.com. Then you may want to expose sso server at https://example.com/sso and contact server at https://example.com/contacts. Another way is exposing one at https://sso.example.com/ and another at https://contacts.example.com (this will need proper setting of DNS and possibly multiple certificates). You can use the following snippet of nginx configuration as an inspiration.

server {
    listen 443 ssl;
    ssl_certificate /your/cert.pem;
    ssl_certificate_key /your/key.pem;
    server_name example.com;
    client_max_body_size 50m;

    location /contacts/ {
        proxy_pass http://localhost:8081/;
        error_log /var/log/nginx/contacts.error.log;
        access_log /var/log/nginx/contacts.access.log;
    }

    location /sso/ {
        error_log /var/log/nginx/sso.error.log;
        access_log /var/log/nginx/sso.access.log;
        proxy_pass http://localhost:8082/;
    }
}

Note

Nginx by default limits the size of body of POST requests to 1 MB which may not be enough in certain circumstances. We recommend setting it to 50 MB.

Backups

The contacts are saved in Mongo database. The data files of the database are stored in /data/mongo directory on the host computer. This means that data are not lost if you remove mongo container. However, you should not back up these files by simply copying them while mongo is running unless your system provides instantaneous snapshots. To make regular backups of the database, we recommend you run the following command regularly. It will create a timestamped directory with database content inside of /data/mongo/dump which you can then backup normally.

docker exec contacts_mongo_1 mongodump -o /data/db/dump/$(date -I)

contacts_mongo_1 is the name of contacts container that was created when running docker-compose.