Skip to content
samatstarion edited this page Aug 28, 2024 · 25 revisions

Introduction

The easiest way to deploy the CDP4-COMET Web Services Community Edition is to make use of Docker and Docker Compose. This is the case for both the deployment in a production environment and for development purposes.

Please specify the tagged version of the docker image to use and refrain from using the latest tag. Especially for the database container. Major versions of PostgreSQL are not binary compatible. Upgrading to a newer major version requires upgrading the data as well. This can be achieved using a logical dump and restore or using the pg_upgrade command.

Docker Compose Deployment

The easiest way to deploy the CDP4-COMET backend (WebServices, Database, MessageBroker) is to make use of Docker-Compose. We provide multiple Docker Compose files for deployment, development and testing:

  • Deployment: deployment including PostgreSQL database, CDP4-COMET Application Server, RabbitMQ using volumes for storing data and logs. This compose file does not incldue a reverse proxy such as Nginx. Nginx (or other reverse proxy) should be installed to enable featuers such as SSL. The host machine can have Nginx installed and proxy multiple docker-compose deployed CDP4-COMET servers.
  • Deployment with Nginx: deployment including PostgreSQL database, CDP4-COMET Application Server, RabbitMQ using volumes for storing data and logs. This compose file also includes an Nginx reverse proxy.
  • Development: deployment used while developing the CDP4-COMET Application Server. This includes a PostgreSQL database and a RabbitMQ message broker. It uses volumes for storing data and logs.

Make sure to tune your PostgreSQL database using the suggestions at PostgreSQL Tuning.

To deploy using docker compose make sure the docker engine and docker compose are installed on the host. Copy the Deployment compose file and execute docker compose:

docker compose -f docker-compose.yml up -d

The configuration settings stored in the appsettings.json file can be overwritten using Environment Variables in the compose file. Add an environment section to override a setting:

    environment:
      - Kestrel__Endpoints__Http__Url=http://localhost:5001
      - Midtier__UploadDirectory=uploads

Please note the double underscore notation to navigate to the nested configuration settings. In the example the port has been updated from 5000to 5001 and the upload directory from upload to uploads.

MAKE SURE TO SETUP A BACKUP STRATEGY that suits your enviroment

Docker Deployment

The Starion Group maintains multiple docker images on Docker Hub. Two docker images are required:

Perform the following steps to deploy using Docker

docker network create cdp4-comet

docker pull stariongroup/cdp4-database-community-edition:3.4.0
// Please be sure to update the default postgres admin users password {mysecretpassword} in the statement below with your own preferred password. You need this password for example to connect to the database using PgAdmin.
docker run -p 5432:5432 -it -d --name cdp4-database-community-edition -e POSTGRES_PASSWORD={mysecretpassword} --net cdp4-comet stariongroup/cdp4-database-community-edition:3.4.0

docker pull stariongroup/comet-webservices-community-edition:8.0.0
docker run -p 5000:5000 -it -d --name cdp4-services-community-edition --net cdp4-comet stariongroup/comet-webservices-community-edition:8.0.0

Make use of Nginx or Apache to act as a reverse proxy using SSL. Forward port 443 to port 5000 and verify that the Web Services are running by navigating to https://your-host-name/SiteDirectory. The default username and password are admin and pass

MAKE SURE TO SETUP A BACKUP STRATEGY that suits your enviroment

Docker based development

This repository includes a handy script to run the webservices in a dockerized fashion. This is intended for development use. The script makes a release build of the source code, creates an image, pulls the latest database image and fires up the containers in a linked fashion.

Prerequisites

MSBuild should be available through command line on your system. If you have Visual Studio installed this means you simply need to add a path to it (e.g. C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin) to your user Environmental Variables.

You can also have standalone msbuild installed if you dont have Visual Studio for ease of use from here: https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16 Make sure to install .NET Desktop Build Tools when presented with the choice.

Add the tool installation path (e.g. C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin) to your PATH environment variable, and restart your command line.

Usage

To compose the containers use the provided compose.bat file in a cmd environment like so:

C:\path\to\CDP4-WebServices-Community-Edition>compose.bat [command]

Available commands:

  • build - (default) builds the solution, creates the images and runs the containers.
  • strt - starts the containers if they already have been run and stopped.
  • stp - stops the running containers without removing them.
  • up - runs containers without rebuilding them.
  • down - stops and removes the containers. Volume information is not lost.
  • reboot - performs the down and up commands in sequence.
  • rebuild - performs the down and rebuild commands in sequence.
  • nginx - builds the latest from solution and launches it behind an nginx container with basic setup. The services are accessible through http://localhost:8088 and no longer through port 5000.
  • nginxdown - stops and removes all containers in the nginx configuration.

For Developers

Runs only the database, webservices should be running alongside in e.g. Visual Studio

  • dev - Spins up database only.
  • devbg - Same as dev but the container is run in background mode.
  • devdown - stops and removes the container. Volume information is not lost.

For Testing

Runs only the bare database, webservices should be running alongside in e.g. Visual Studio. To be used to execute ecss-10-25-annexc-integration-tests

  • devtest - Spins up bare database only.
  • devtestbg - Same as devtest but the container is run in background mode.
  • devtestdown - stops and removes the container. Volume information is not lost.

To verify that the services are running navigate to localhost:5000/SiteDirectory you should be prompted for standard credentials which are admin/pass.