Linux Docker image - SV server

This topic describes how to install the Service Virtualization server on Linux using a Docker image.


Run the SV server

The Service Virtualization server requires a PostgreSQL, Oracle, or MS SQL database. Since you will be running the database and the Service Virtualization server on the same host, you can create a common docker network:

 docker network create sv

The following is an example of additional database related environment variables which must be set when running the SV Server image:

docker run -e SV_DB_TYPE=mssql --network sv --memory 2g \

-e SV_DB_DATASOURCE=sv-db \

-e SV_DB_NAME=SvDb -e SV_DB_USERNAME=sa \

-e SV_DB_PASSWORD=Changeit123 \

… virtualization/sv-server

Environment Variables

The Service Virtualization server accepts the following optional environment variables:

  • SV_USER - the username account which is created or updated before the server is started
  • WAIT_FOR_DB - the database host and port (like sv-db:5432) which the server waits for before starting
  • SV_PASSWORD - the password of the user above
  • SV_GROUPS - the SV groups for the user above (like SVM Users, SV Server Administrators)
  • SV_SERVER_AGENT_PORTS - the port range which the server uses for agent ports (like 7000-7019)
  • SV_DB_TYPE – type of the database used by the SV Server. Either "oracle" or "postgresql"

  • SV_DB_DATASOURCE – a database connection string

  • SV_DB_USERNAME – the database username

  • SV_DB_PASSWORD – the database password

  • SV_DB_NAME – the database name

  • SV_DB_PROPERTIES – additional database properties

  • SV_DB_RECREATE – when set, the database schema will be recreated before the server starts.

  • SV_LICENSE_SERVER_URL – the license server URL

  • SV_SERVER_PARAMS – additional SV server parameters

Ports

The Service Virtualization server uses these ports:

  • 6085 - secure server management REST API
  • ${SV_SERVER_AGENT_PORTS} - see the SV_SERVER_AGENT_PORTS variable above.

The Service Virtualization server has several directories which should persist data using docker volumes:

  • /opt/microfocus/sv-server/logs - server logs

  • /opt/microfocus/sv-server/work - certificates, credentials, users, etc.

  • /opt/microfocus/sv-server/work/Config, /opt/microfocus/sv-server/work/app.config - server configuration files
  • /opt/microfocus/sv-server/work/Agents - agent configuration files
  • /opt/microfocus/sv-server/tmp - cache files

The following example runs the SV Server with most of the available parameters:

docker run -d --name sv-server --memory 2g \

-e SV_SERVER_AGENT_PORTS=7000-7019 \

-e SV_USER=demo \ -e SV_PASSWORD=changeit \

-e SV_GROUPS="SVM Users,SV Server Administrators" \

-e SV_DB_TYPE=postgresql \

-e SV_DB_DATASOURCE=sv-db \

-e SV_DB_RECREATE=true \

-e SV_LICENSE_SERVER_URL=https://license.server.com:5814 \

--network sv -p 6085:6085 -p 7000-7019:7000-7019 -h $(hostname) \

-v /opt/microfocus/sv-server/work \

-v /opt/microfocus/sv-server/logs \

virtualization/sv-server

Back to top

SV server configuration

The Service Virtualization server configuration files are stored in the /opt/microfocus/sv-server/work/Config and /opt/microfocus/sv-server/work/app.config directories. If you need to edit a configuration file you can use the following docker command, for example for the server configuration file (you may need to restart the server after some configuration changes):

docker run -it --volumes-from sv-server --rm --memory 2g \
-u root \
virtualization/sv-server: \
vi /opt/microfocus/sv-server/work/app.config/HP.SV.StandaloneServer.dll.config

docker restart sv-server

Back to top

How to run the SV server with the default Oracle XE Docker image

For non-production cases, Oracle XE is sufficient. You can use a prepared docker image such as wnameless/oracle-xe-11gimage, to run a database instance:

docker run -d --name sv-db \

--network sv \

-v /u01/app/oracle/ \

wnameless/oracle-xe-11g

The default Oracle XE database configuration is:

userName: system

userPass: oracle

dbDataSource: sv-db:1521/xe

To change the SV server database configuration to point to the Oracle XE Docker image run:

docker run --volumes-from sv-server --rm --memory 2g \

virtualization/sv-server \

/opt/microfocus/sv-server/sv-ConfigTool db-setProperties server oracle "sv-db:1521/xe" "" "" SqlAuth system oracle

Back to top

How to run SV server with an existing PostgreSQL database

The database configuration is stored in /opt/microfocus/sv-server/work/app.config/HP.SV.StandaloneServer.database.config and can be changed using sv-ConfigTool in the following way:

docker run --volumes-from sv-server --rm --memory 2g \
virtualization/sv-server \
/opt/microfocus/sv-server/sv-ConfigTool db-setProperties server postgresql
" ;Host=mypostgresql.mycompany.net;Database=db1" "" "" SqlAuth UserName Password

Back to top

How to run the SV server with an existing Oracle Database

The database configuration is stored in /opt/microfocus/sv-server/work/app.config/HP.SV.StandaloneServer.database.config and can be changed using sv-ConfigTool in the following way:

docker run --volumes-from sv-server --rm --memory 2g \
virtualization/sv-server \
/opt/microfocus/sv-server/sv-ConfigTool db-setProperties server oracle "myoracle.mycompany.net:1521/db1" "" "" SqlAuth UserName Password

Alternatively, you can change database settings by specifying environment variables when running the sv-server image:

docker run

-e "SV_DB_TYPE=oracle" \

-e "SV_DB_DATASOURCE=myOracle.hostname:1521/xe;" \

--volumes-from sv-server --rm --memory 2g \

virtualization/sv-server

The available database related environment variables are:

SV_DB_TYPE: “oracle"|”postgresql“

SV_DB_DATASOURCE: database connection string

SV_DB_PROPERTIES: database properties

SV_DB_NAME: database name

SV_DB_USERNAME: username

SV_DB_PASSWORD: password

To recreate the database when the Service Virtualization Server starts, the use SV_DB_PARAMS option. The parameters are applied to the Service Virtualization Server executable upon startup.

docker run

-e "SV_SERVER_PARAMS=recreateDatabase=true" \

-e "SV_DB_TYPE=oracle" \

-e "SV_DB_DATASOURCE=myOracle.hostname:1521/xe;"

--volumes-from sv-server --rm --memory 2g \

virtualization/sv-server

Optionally, you can use the shortcut option SV_DB_RECREATE:

docker run

-e "SV_DB_RECREATE=true" \

-e "SV_DB_TYPE=oracle" \

-e "SV_DB_DATASOURCE=myOracle.hostname:1521/xe;"

--volumes-from sv-server --rm --memory 2g \

virtualization/sv-server

Back to top

How to use your own server certificate

The Service Virtualization server (and Service Virtualization Management) use self-signed "localhost" certificate/key for HTTPS by default. To use own certificate/key which will work correctly with your domain, you need to have the following files:

  • server-cert.p12 - server certificate and private key in PKCS12 format.
  • server-key.pass - password in plain text for the server private key.

To replace the default certificate/key by your ones, you need to import these files into the Service Virtualization server certificates directory in the /opt/microfocus/sv-server/work volume using sv-ImportCertificates script. For example, if you have server-cert.p12 and server-key.pass in the certificates directory, run the following:

docker run --volumes-from sv-server --rm --memory 2g \
-v $(pwd)/certificates/:/opt/microfocus/sv-server/my-certificates/ \
virtualization/sv-server \
sv-ImportCertificates /opt/microfocus/sv-server/my-certificates/

docker restart sv-server

How to enable LDAP authentication

To enable LDAP authentication, edit HP.SV.StandaloneServer.dll.config and change the membershipProvider to Ldap. Edit the config file in the following way:

docker run -it --volumes-from sv-server --rm --memory 2g \
-u root \
virtualization/sv-server \
vi /opt/microfocus/sv-server/work/app.config/HP.SV.StandaloneServer.dll.config

Then you need to edit HP.SV.StandaloneServer.ldap.config with your LDAP configuration:

docker run -it --volumes-from sv-server --rm --memory 2g \
-u root
virtualization/sv-server \
vi /opt/microfocus/sv-server/work/app.config/HP.SV.StandaloneServer.ldap.config

Back to top

How to run SV with Docker Compose

The following example illustrates how to run PostgreSQL DB, Service Virtualization Server container, Service Virtualization Lab Server container, and the Service Virtualization Management container using the docker-compose tool. Create a docker-compose.yml file with the following content:

version: '3'

volumes:
  work:
  logs:
  db:
  lab_logs:

services:
  sv-server:
    image: virtualization/sv-server
    container_name: sv-server
    hostname: ${HOST_NAME}
    tty: true
    environment:
      - WAIT_FOR_DB=sv-db:5432
      - SV_SERVER_AGENT_PORTS=7000-7019
      - SV_USER=demo
      - SV_PASSWORD=changeit
      - SV_GROUPS=SVM Users,SV Server Administrators
      - SV_LICENSE_SERVER_URL=https://autopass.example.com:5814
    ports:
      - 6085:6085 # secure REST
      - 7000-7019:7000-7019 # SV agents
    volumes:
      - work:/opt/microfocus/sv-server/work
      - logs:/opt/microfocus/sv-server/logs
        # SV Agent binaries
#      - ./some-library.so:/opt/sv-server/bin/some-library.so
#      - ./another-library.dll:/opt/sv-server/bin/another-library.dll
    stop_grace_period: 2m
    depends_on:
      - sv-db
  sv-lab-server:
    image: virtualization/sv-lab-server
    container_name: sv-lab-server
    hostname: ${HOST_NAME}
    environment:
      - SV_LAB_SERVER_CONNECTOR_PORTS=9000-9019
    ports:
      - 8445:8445 # secure REST
      - 9000-9019:9000-9019 # SV connectors
    volumes:
      - lab_logs:/opt/LabServer/log/
    stop_grace_period: 2m
  sv-svm:
    image: virtualization/sv-svm
    container_name: sv-svm
    hostname: ${HOST_NAME}
    tty: true
    ports:
      - 6086:6086 # secure web
    volumes:
      - work:/opt/microfocus/sv-server/work
      - logs:/opt/microfocus/sv-server/logs
    stop_grace_period: 2m
  sv-db:
    image: postgres
    volumes:
      - db:/var/lib/postgresql/data
    container_name: sv-db

The Dockerfile and the files used there must be placed in a directory, for example my-sv-server. To build the new docker image use the docker build command:

docker build ./my-sv-server -t my/sv-server:latest

How to run SV tools

You can use the following command to run SV tools which are part of the SV Server distribution, for example running SVConfigurator tool:

docker run --rm --memory 2g \
virtualization/sv-server \
/opt/microfocus/sv-server/Tools/SVConfigurator/bin/SVConfigurator.sh <command>

Back to top

See also: