-
Notifications
You must be signed in to change notification settings - Fork 5
Ubuntu
THIS PAGE IS OUTDATED AND WILL BE UPDATED SOON TO REFLECT THE INSTRUCTIONS FOR VERSION 8.x.y INSTRUCTIONS. PLEASE USE DOCKER INSTEAD.
The CDP4-COMET Server, a combination of the CDP4-COMET Web Services and the CDP4-COMET Database, can be deployed on Ubuntu. The following Ubuntu versions have been tested and are therefore supported:
- 18.04.5 LTS (Bionic Beaver)
- 20.04.1 LTS (Focal Fossa)
- 22.04.1 LTS (Jammy Jellyfish)
Other versions may work as well. If you have successfully deployed the CDP4-COMET Web Services on another version of Ubuntu, or other OS, feel free to update this page.
These installation instructions are the same for all supported versions of Ubuntu, unless specified otherwise.
The following high-level steps need to be executed to install a CDP4-COMET Server
- install ssh, wget and unzip
- install PostgreSQL 12
- install mono
- install nginx
- initialize the PostgreSQL 12 cluster
- deploy the CDP4-COMET WebServices
- Configure nginx
One Ubuntu box can host multiple CDP4-COMET Servers. Make use of nginx to act as reverse proxy to route http(s) trafic to the correct instance of the CDP4-COMET Web Services.
Make sure that SSH
is installed so the configiration of the box does not need to be done on the console of the box itself, but via putty. Install wget
to import the PostgreSQL repository signing key and dowload the CDP4-COMET Web Services package. Install unzip
the unzip the CDP4-COMET Web Services pacakge.
sudo apt-get update
sudo apt-get install ssh wget unzip
The CDP4-COMET Database requires PostgreSQL 12. To make sure this version is installed it is necessary to use the PostgreSQL Apt repository.
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
Import the repository signing key, and update the package lists:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
Install PostgreSQL package as well as the contributions package
sudo apt-get install postgresql-12
By default, a new PostgreSQL cluster, named main
is installed. We will delete this cluster. In case you want to host multiple CDP4-COMET Servers on one Linux box we will deploy a cluster per CDP4-COMET Server and provide it with a sensible comet
name.
sudo pg_dropcluster --stop 12 main
Mono is an open source implementation of Microsoft's .NET Framework based on the ECMA standards for C# and the Common Language Runtime. The COMET Web Services are developed using C# and therefore need Mono to run on Linux. The installation instructions are taken from the Mono project download instructions.
First add the Mono repository to your system
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
sudo sh -c 'echo "deb http://download.mono-project.com/repo/ubuntu stable-`lsb_release -cs` main" >> /etc/apt/sources.list.d/mono-official-stable.list'
sudo apt-get update
Install Mono
sudo apt-get install mono-complete
Nginx is an HTTP and reverse proxy server. Multiple instances of the CDP4-COMET Web Services can be deployed on one Ubuntu box. The proxy_pass
directive is used to route traffic intended for a specific hostname to be routed to the proper instance of the CDP4-COMET Web Services. Nginx should also be used to wrap the CDP4-COMET Services with SSL, use Let's Encrypt to get free trusted certificates.
Install Nginx
sudo apt-get install nginx
Multiple versions of PostgreSQL can be installed on the same box. Multiple PostgreSQL clusters can be instantiated on the same box as well. In order to distinguish the different PostgreSQL clusters that are deployed on a server they are given a name
and are exposed a specific port
. The default port for PostgreSQL is port 5432.
Initialize the CDP4-COMET Database cluster with the following settings:
Setting | Value |
---|---|
name | comet |
user | postgres |
version | 12 |
port | 5432 |
locale | UTF-8 |
location | /opt/comet/backtier/postgres/data |
Make sure that when you change any of the settings stated in the table above these are reflected in the following steps as well. The
name
property should not contain spaces, hyphens or other special characters.
sudo mkdir -p /opt/comet/backtier/postgres/data
sudo chown -R postgres:postgres /opt/comet/backtier/postgres
sudo pg_createcluster -u postgres -d /opt/comet/backtier/postgres/data -p 5432 -e UTF8 12 comet
sudo service postgresql start
Download the cdp4server.sql
file and initialize the CDP4-COMET Database.
wget https://raw.githubusercontent.com/STARIONGROUP/COMET-Docker/master/cdp4-database-community-edition/cdp4server.sql --output-document=cometserver.sql
sudo -i -u postgres psql -p 5432 < cometserver.sql
sudo -i -u postgres psql -p 5432 -d cdp4server --command="VACUUM FULL;"
The PostgreSQL configuration for this cluster is located in
/etc/postgresql/12/comet/
. Please refer to the PostgreSQL documentation for further configuration of PostgreSQL.
In order to keep the database fast and responsive, a frequent VACUUM
is required. The CDP4-COMET database keeps track of all changes made to the data in temporal history tables. These tables tend to become large and may slow the database down over time. A cronjob with the following vacummdb
statements will keep the database clean:
use
sudo crontab -e
to edit the crontab
0 0 * * 1-6 su postgres -c "vacuumdb -d cdp4server --analyze"
0 0 * * 7 su postgres -c "vacuumdb -d cdp4server --full --analyze"
It is advisable to create backups of the CDP4-COMET Database. Backups can be stored anywhere on the file system, but we like to keep the files close to the installation. Create a backup
in the installation directory of the CDP4-COMET and place the backup script in this directory.
sudo mkdir -p /opt/comet/backtier/backup
wget https://raw.githubusercontent.com/STARIONGROUP/COMET-WebServices-Community-Edition/master/scripts/cdp4-backup --output-document=comet-backup
sudo mv comet-backup /opt/comet/backtier/backup/
sudo chmod 700 /opt/comet/backtier/backup/comet-backup
sudo chown -R postgres:postgres /opt/comet/backtier/backup
Add a cronjob that runs the backup script using the crontab command: sudo crontab -e
0 19 * * 1-5 /opt/comet/backtier/backup/comet-backup
The CDP4-COMET Web Services can be deployed to the same Linux box. The following table presents the settings that need to be taken into account.
Setting | Value |
---|---|
name | comet |
location | /opt/comet/midtier/nancyfx |
Linux user | comet_host |
hostname | 127.0.0.1 |
port | 5000 |
Download the latest version of the CDP4-COMET Web Services from Github. Visit the releases page to get the copy the Url of the latest version.
wget https://github.com/STARIONGROUP/COMET-WebServices-Community-Edition/releases/download/7.1.1/COMETWebservices-7.1.1.zip
Create the directory where the COMET Web Services will be deployed.
sudo mkdir -p /opt/comet/midtier/nancyfx
Unzip the downloaded package to the installation directory:
sudo unzip COMETWebservices-7.1.1.zip -d /opt/comet/midtier/nancyfx/
Create a daemon user that will run the COMET Web services, and make this user the owner of the COMET Web Services installation directory.
sudo useradd comet_host -r
sudo chown -R comet_host:comet_host /opt/comet/midtier
The configuration file, called config.json
, needs to be updated to reflect the settings chosen for the database.
sudo sed -i 's/HOSTNAMEOFTHEDATABASE/127.0.0.1/g' /opt/comet/midtier/nancyfx/config.json
sudo sed -i 's/POSTGRESPORT/5432/g' /opt/comet/midtier/nancyfx/config.json
After the config.json
has been updated, please verify the contents using your favourite editor such as vi
. The settings of the config.json
are explained here.
Download the initscript and move it to the /etc/init.d
folder:
wget https://raw.githubusercontent.com/STARIONGROUP/COMET-WebServices-Community-Edition/development/scripts/cdp4-web-services --output-document=comet-web-services
The file contains 2 variables that should be updated to reflect the configuration of the current server setup.
name | value |
---|---|
COMET_DIR | /opt/comet/midtier/nancyfx |
COMET_USR | comet_host |
The init script needs to be updated to reflect the installation of the COMET Web Services:
sudo sed -i 's/MIDTIERNANCY/\/opt\/comet\/midtier\/nancyfx/g' comet-web-services
sudo sed -i 's/CDP4USER/cdp4_host/g' comet-web-services
sudo mv comet-web-services /etc/init.d
When multiple COMET Web Services are hosted on the same Linux box don't forget to update the
Provides: comet-web-services
to a name that reflects the intent of any other instance of the services.
sudo chown 0.0 /etc/init.d/comet-web-services
sudo chmod +x /etc/init.d/comet-web-services
cd /etc/init.d
sudo update-rc.d comet-web-services defaults
cd
The cometserver
supports the following commands:
service comet-web-services start
service comet-web-services stop
service comet-web-services restart
service comet-web-services status
Start the COMET Web Services with the following command:
sudo service comet-web-services start
To verify that the COMET Web Services are running and can connect to the COMET Web Server, perform a GET request using wget:
wget --user=admin --password=pass http://127.0.0.1:5000/SiteDirectory
This will save the SiteDirectory
object as a JSON file. You can inspect the contents of the file using cat
.
cat SiteDirectory
The output should look like the following:
[{"classKind":"SiteDirectory","createdOn":"2017-11-11T09:00:00.000Z","defaultParticipantRole":"34585c65-d20c-41de-b17c-40d611618eb8","defaultPersonRole":"e3b2f0f5-3e29-4ba3-94ba-05738e5b3307","domain":["8790fe92-d1fa-42ea-9520-e0ddac52f1ad","6a0f665a-d794-4d3e-9af9-24b336fbad35","26749965-69c5-4ef3-826d-ef45e63c4e15","2696d9eb-7715-4bb1-bf3f-5c44c1cbc5ab","36ca0c70-4e05-4736-8cfa-69b066e2433e","3169ffbe-19ad-4e3c-b655-cdb0159d32db","9f48ef62-7890-4283-aa63-80206d042330","5a938039-cfc2-460a-a306-621c70136b49","e045a98b-6cfe-44dd-86cf-4f9be382487f","7d75fa20-77e3-4b5f-a27c-19653cb08f33","c3bbc2d0-e650-4fc4-af3a-6d4ceddeed3a","18cfb947-980a-451e-8e6f-b740d2327905","d0c432e6-5a1a-45a3-a6d9-bf04d8079c0d","e674c1a2-8fcf-4b88-9c76-9edfdf6073c8","1d354256-7ec6-49cc-97fb-e6c70634c156","309be074-0a9e-46b9-98cd-1ad4ab05c7e4","e5b68ae3-544a-4d81-bf5f-45b3dfe202a1","1f254a92-f165-4020-9dfc-ea015ac492db","53bf20d0-b085-443d-9665-cb01686a2768","42557b89-bfe0-4c72-be94-f0f9002815f3","c52d8b32-6a9c-4ef4-87b6-1e4f97e28e96","9ae8f3d1-7d9d-4223-98c7-cf920ecaaaed","6c374b6b-971a-48ca-a8fe-3a69e4bed7b8","9f61bda9-a808-4baf-b20e-1a1725c31ec1","cf380be6-e400-44fd-abe1-b609229d9a7d","6ec9de88-0dcc-419e-bf02-4ed7c5f11d98","34f26b79-277a-492f-953f-bfd271e5a9b7","4f033a5d-a1c8-45ea-b3db-b43cbbc77447","8eb10ff7-4512-46d5-85a1-f2a91fd57abb","fb2fcc3b-091f-40dc-a5ac-fd7d9b1bf18b"],"domainGroup":[],"iid":"f8a8a10f-6eb2-4ab6-a544-26221066f869","lastModifiedOn":"2017-11-11T09:00:00.000Z","logEntry":[],"model":["c6766dd0-d0c2-4990-95a1-8ce958eba129"],"name":"Starion CDP4 Site Directory","naturalLanguage":[],"organization":["44d1ff16-8195-47d0-abfa-163bbba9bf39","1f57e78a-1ecf-4fdc-ad92-0da32ad3f2e8","f0cd3d14-cd6c-4e0a-98cb-93024cd8a794","c4e6b931-a564-4cb6-a35b-44f114d3dd50","57f04906-8bb8-440e-afb3-0cfc64d65421","4e6b5f26-148a-4c30-9e7c-4320f8af7dac"],"participantRole":["34585c65-d20c-41de-b17c-40d611618eb8","603846ff-8180-404b-a254-1facb7ea80e6","2670c6a0-9d73-432e-a91e-ea8ca5e909a2","4ae99817-87c8-4b1e-8fff-a04cad2abfdd","48a088ba-8aa2-4801-9e5c-183253b146e8","9a7fb66d-4f20-4ec6-b5be-44ec0248a8fb","31691b85-7869-4040-a447-38bf11c2f4ca"],"person":["1c2466ed-ddb9-4546-b458-5b3dbcb58924"],"personRole":["e3b2f0f5-3e29-4ba3-94ba-05738e5b3307","9282040e-a137-4232-ac36-b6643cc2956e","7a528a44-d1e3-4c5a-b43e-2ed7c13875b4"],"revisionNumber":1,"shortName":"Starion-CDP-SiteDir","siteReferenceDataLibrary":["bff9f871-3b7f-4e57-ac82-5ab499f9baf5"]}]
Note: the default username and password for the COMET Web Services is
admin
andpass
. Use the CDP4 IME to connect to the COMET Web Services you just installed, change the password and add more users.
To configure nginx, download the configuration file and update the settings based on the current configuration
wget https://raw.githubusercontent.com/STARIONGROUP/COMET-WebServices-Community-Edition/development/scripts/nginx --output-document=comet-web-services-host
If your server has a hostname replace the SERVERNAME token in the nginx config file with that hostname. Otherwise use the below script to put the IP Address of your server in its place. This script assumes the name of the targeted network card is alled eth0
.
SERVERNAME=`ifconfig eth0 2>/dev/null|awk '/inet addr:/ {print $2}'|sed 's/addr://'`
sed -i 's/SERVERNAME/'"$SERVERNAME"'/g' comet-web-services-host
Now update the ROOTPATH token with the location where the COMET Web Services are installed, in our case this is /opt/comet/midtier/nancyfx
. Update the PROXYPASS token with the Url
and Port
that the installed COMET Web Services are listening on, in our case this is http://127.0.0.1:5000
.
sed -i 's/ROOTPATH/\/opt\/comet\/midtier\/nancyfx/g' comet-web-services-host
sed -i 's/PROXYPASS/http:\/\/127.0.0.1:5000/g' comet-web-services-host
Move the nginx file to the following location: /etc/nginx/sites-available/
and create a symbolic link to the enabled
folder. This will make sure it is picked-up by nginx.
sudo mv comet-web-services-host /etc/nginx/sites-available/
sudo chown 0.0 /etc/nginx/sites-available/comet-web-services-host
sudo ln -s /etc/nginx/sites-available/comet-web-services-host /etc/nginx/sites-enabled/comet-web-services-host
Verify that the nginx configuration has no errors
sudo nginx -t
In case there are no errors in the nginx configuration, reload nginx.
sudo service nginx reload
The COMET Web Services should now be available via the web browser of a device connected to the same network as the COMET Web Services are. Navigate to the following url http://SERVERNAME/SiteDirectory
. You should be prompted for a username and password. The same username and password apply: admin
and pass
. The same JSON content should be displayed in the browser as was downloaded in the earlier using wget
on the linux box hosting the COMET Web Services.
Provided the COMET Web Services have been installed on a Linux box that is exposed to the public internet, it is now possible to install an Let's Encrypt SSL certificate.
It is recommended to always make use of nginx with SSL to expose the COMET Web Services. The COMET Web Services makes use of Basic Authentication, the username and password are transmitten only encoded as a base64 string.
The last step is to clean up the files that were downloaded and are no longer needed.
rm cometserver.sql
rm COMETWebServices-7.1.1.zip
Install Certbot
, an easy-to-use automatic client that fetches and deploys SSL/TLS certificates for your webserver, to acquire SSL/TLS certificates from Let's Encrypt.
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-nginx
After the COMET Server has been installed, it may be that new versions are released and that an upgrade is required. The update process is very simple:
- check whether your PostgreSQL setup is the latest supported version, currently this is version PostgreSQL version 12
- stop the COMET Web Service:
service cdp4-web-services stop
- Create a backup of your database using
pg_dumpall
; we hope you are doing this frequently - Download the latest release of the COMET Web Services
- Replace the files located in the
/opt/comet/midtier/nancyfx
folder (and subfolders) using the updated files from the distribution. You will need to replace the.dll
and.exe
files. Make sure you keep your configuration files, you will still need them. - start the CDP4 Web Service:
service comet-web-services start
Note: The COMET Web Services will make any required updates to the database (schema changes) when it starts.
The COMET has been upgraded to support version 12 of PostgreSQL. In order to upgrade to this version of the database you should install PostgreSQL 12
on your box, this can be installed next to your earlier version (most likely 9.6). Please follow these steps:
- stop the COMET Web Service:
service comet-web-services stop
- Create a backup of your database using
pg_dumpall
; we hope you are doing this frequently. The resulting sql dump will be used to seed the new PostgreSQL 12 cluster - follow the PostgreSQL version 12 installation instructions.
- Initialize a new PostgreSQL cluster using these instructions. Instead of downloading the
cometserver.sql file
to initialize the COMET Database, make use of the sql dump created in an earlier step. Make sure that your new cluster is not listening on the same port as your existing cluster. - update the
config.json
to point to the new PostgreSQL cluster
In case the the installation is not succesful please check the log files of both the following components:
- COMET Web Services: located at /opt/comet/midtier/nancyfx/logs
- nginx: lolcated at /var/logs/nginx
If these do not provide you with a hint on how to resolve installation issues, feel free to raise an issue on GitHub or contact us via Starion Group website contact form
copyright @ Starion Group S.A.