Installation

Basic Setup

In this particular installation example, we are bringing up the default configuration of a stand-alone SMASHDOCs installation. Larger environments with the requirement of high availability and the need for multiple nodes will be covered in the high availability installation.

Hint

In this example we use an IP address of 10.0.0.100 so that containers can communicate with each other - YOURS WILL MOST PROBABLY DIFFER. At SMASHDOCs, we have actively chosen not to use container linking for a variety of reasons. If you do choose to, please do at your own risk.

The following list are the services necessary to run SMASHDOCs.

  1. MongoDB
  2. Backend
  3. Frontend
  4. NGINX

Hint

To ensure data integrity its recommended to separate the data from docker containers. This can be done by using data volumes as described in the Docker official documentation (https://docs.docker.com/engine/userguide/containers/dockervolumes/)

MongoDB

Before using the data volumes the mounted folder needs to be created on the host machine.

$(Host) mkdir -p /opt/docker/mongodb

Setup the mongodb docker container with the following commands:

$(Host) docker pull mongo:3.2
$(Host) docker run -d \
    --name smashdocs-mongodb \
    -v '/opt/docker/mongodb:/data/db:rw' \
    -p '10.0.0.100:27017:27017' \
    mongo:3.2 --storageEngine wiredTiger

Create a logical database in mongodb by creating a dummy collection to persist the database.

$(Host) docker exec -it smashdocs-mongodb mongo

$(Container) > use my-db-name
$(Container) > db.test.insert({})

Backend

The Backend service runs the SMASHDOCSs API:

It is important that backends also have access to the disk where for example assets are stored. To ensure that assets are available to the backend service, it is necessary to also use docker data volumes.

Therefor a directory on the host needs to be created and mounted into the container.

$(Host) mkdir -p /opt/docker/data/assets/tmp

Replace the API_URL_API_URL with your own endpoint and version 1.3.0.2 with the latest SMASHDOCs version you require.

Hint

Please refer to Services for all configuration options.

$(Host) docker pull smashdocs/partnerbackend:1.3.0.2
$(Host) docker run -d --name smashdocs-backend \
    -v '/opt/docker/data/assets:/usr/local/data:rw' \
    -e 'DATABASE_ADDRESS=10.0.0.100' \
    -e 'DATABASE_PORT=27017' \
    -e 'DATABASE_DATABASE=my-db-name' \
    -e 'API_URL_API_URL=https://app-api.smashdocs.local' \
    -e 'HTTP_SERVER_ADDRESS=http://app.smashdocs.local' \
    -e 'HTTP_SERVER_SSL_ADDRESS=https://app.smashdocs.local' \
    -e 'EMAIL_SMTP_SERVER_ADDRESS=mail.local' \
    -e 'EMAIL_SMTP_SERVER_PORT=587' \
    -e 'EMAIL_SMTP_USERNAME=smtp_user' \
    -e 'EMAIL_SMTP_PASSWORD=smtp_password' \
    -p '10.0.0.100:9100:8080' \
  smashdocs/partnerbackend:1.3.0.2

A successful SMASHDOCs backend setup can be validated by checking the logs which should yield the successful spawning of the backend processes:

$(Host) docker logs -tf smashdocs-backend

(...)*** uWSGI is running in multiple interpreter mode ***
...
(...) spawned uWSGI worker 1 (pid: 7, cores: 1)
(...) spawned uWSGI worker 2 (pid: 15, cores: 1)
(...) spawned uWSGI worker 3 (pid: 16, cores: 1)
(...) spawned uWSGI worker 4 (pid: 17, cores: 1)

Please refer to the Configuration for the functional setup of the Backend. To complete with the setup is is necessary to:

  • create a party
  • create an organization

Frontend

The frontend service runs the SMASHDOCs web UI.

Hint

Please refer to Services for all configuration options

Important

It is necessary to finish the configuration of the Backend before beginning with the setup of the Frontend.

The next step is dependent from the mode in which SMASHDOCs should be run. In normal mode user registration and viewing the document list is working for the user directly in SMASHDOCs. In partner mode, these functions are realised via backend-to-backend-calls of the partner system, so that the direct connection between user and SMASHDOCs is only established for writing and changing documents.

Normal Mode

Run the follow commands with docker:

$(Host) docker pull smashdocs/partnerfrontend:1.3.0.2
$(Host) docker run -d --name smashdocs-frontend \
    -e 'API_KEY_SMASHDOCS=2e62fdc970abc4e5bbcba5baf4ecd3f8fe16b4231401d6b1df089d0f750b544f' \
    -e 'BASE_URL=https://app-api.smashdocs.local' \
    -e 'MODE=normal' \
    -p '10.0.0.100:9200:80' \
    smashdocs/partnerfrontend:1.3.0.2

Note, that the API_KEY_SMASHDOCS value has to be replaced by the Party User API Key generated by create party in Configuration.

Partner Mode

Run the follow commands with docker:

$(Host) docker pull smashdocs/partnerfrontend:1.3.0.2
$(Host) docker run -d --name smashdocs-frontend \
    -e 'API_KEY_EXAMPLEPARTNER=2e62fdc970abc4e5bbcba5baf4ecd3f8fe16b4231401d6b1df089d0f750b544f' \
    -e 'BASE_URL=https://app-api.smashdocs.local' \
    -e 'MODE=partner' \
    -p '10.0.0.100:9200:80' \
    smashdocs/partnerfrontend:1.3.0.2

Note, that key and value of API_KEY_EXAMPLEPARTNER have to be replaced with the values according to create party in Configuration: In API_KEY_EXAMPLEPARTNER, EXAMPLEPARTNER has to be replaced by the PARTY_NAME that was chosen in create party, written in uppercase. The value of the api key has to be taken from returned Party User API Key of create party.

NginX

Hint

If you dont have SSL certs and quickly need to create some selfsigned ones try:

openssl req -x509 -newkey rsa:2048 -keyout wildcard.key -out wildcard.crt -days XXX -nodes -subj “/C=DE/ST=Bayern/L=Muenchen/O=Smashdocs Example/OU=Org/CN=*.smashdocs.local”

The SSL certificates need to be in the a folder on the host system, which is also mounted to the docker container.

$(Host) mkdir -p /opt/docker/ssl/
$(Host) cp -R /path/to/ssl/* /opt/docker/ssl/

Furthermore the NGINX configuration (sample nginx config) needs to be available inside the container.

$(Host) mkdir -p /opt/docker/nginx/
$(Host) cp -R /path/to/nginx/nginx_sample.conf /opt/docker/nginx/

%(Host) vim /opt/docker/nginx/nginx_sample.conf

With your favorite texteditor change the following parameters of the NGINX config:

Variable Description
server_name provide the subdomain of your installation (e.g. app.*; or app-api.*;)
$backend_address the configured backend ip address (“10.0.0.100”;)
$frontend_address the configured frontend ip address (“10.0.0.100”;)

Run the follow commands with docker:

$(Host) docker pull smashdocs/nginx:1.2
$(Host) docker run -d --name smashdocs-nginx \
  -p 80:80 \
  -p 443:443 \
  -v '/opt/docker/data/assets:/usr/local/data:rw' \
  -v '/opt/docker/nginx/nginx_sample.conf:/etc/nginx/nginx.conf' \
  -v '/opt/docker/ssl/wildcard.crt:/etc/nginx/www_cert.crt' \
  -v '/opt/docker/ssl/wildcard.key:/etc/nginx/www_cert.key' \
  -v '/opt/docker/ssl/wildcard.crt:/etc/nginx/api_cert.crt' \
  -v '/opt/docker/ssl/wildcard.key:/etc/nginx/api_cert.key' \
  smashdocs/nginx:1.2
important:The NGINX docker container prepares new Diffie–Hellman keys which might take a few minutes on startup.

Redundant

To be written - please contact us

Service Discovery

To be written - please contact us