4 Installation¶
The Remote Optimization Server is available in two flavors: light and full.
The light version (OptServerLight) is a stateless in-memory solver service, which can be started and run from the command line with no configuration.
The full version (OptServer) additionally provides job storage, user authentication, web interface and similar administrative tools.
4.1 OptServerLight¶
4.1.1 Requirements and files¶
The OptServerLight consists of binaries and shared libraries present in the
bin
folder of the MOSEK distribution, namely:optserverlight
,mosekpipe
,solconv
andlibmosek
(with appropriate extensions as per the operating system and version). The most convenient option is to runoptserverlight
directly from thebin
folder of MOSEK.OptServerLight distributed with MOSEK version 11.0 is compatible with and optimized for MOSEK clients of version 11.0. Supporting clients from other major.minor MOSEK versions is not guaranteed. The general REST API is always supported.
The service runs in-memory and does not create any files on disk, except a logfile, if requested.
4.1.2 Starting OptServerLight¶
To start OptServerLight launch the binary optserverlight
or optserverlight.exe
from the bin
folder of the MOSEK installation:
optserverlight
That will start the OptServerLight with the default options. A typical installation should at least customize the following most important options:
optserverlight -port 34567 -solver-timeout 10 -max-task 50 -size-limit 100000000
where:
-port
is the port number where the application listens for jobs,-solver-timeout
is the time limit for one job (in seconds), after which the solver will be terminated,-max-task
is the maximum number of jobs solved at once, if more jobs arrive they will be kept waiting,-size-limit
is the maximal size (in bytes) of the file that will be accepted.
Full list of configuration options with descriptions can be obtained with:
optserverlight -h
4.2 OptServer¶
4.2.1 Try it out¶
It is possible to quickly try out the OptServer without going through the full installation process. The two options are:
Use the public instance running at https://solve.mosek.com. It is a demo with size limitations suited for testing small problems. The website has instructions and coordinates of access points.
Use the Docker image available from https://github.com/MOSEK/Dockerfiles/tree/master/optserver-demo . It will install the simplest stand-alone OptServer container with latest MOSEK version and with all dependencies installed internally.
The rest of this section describes the complete installation process.
4.2.2 Requirements¶
The following are prerequisites to run OptServer:
OptServer is only available for 64bit Linux.
Access to a PostgreSQL database is required.
MOSEK binaries are required. If the OptServer is installed from a standard MOSEK distribution, then it will naturally contain the necessary files, however an external MOSEK installation can also be used.
4.2.3 Locating files¶
The relevant files of the Optimization Server are organized as reported below
Relative Path |
Description |
---|---|
|
Scripts and binaries |
|
Configuration files and certificates |
|
Runtime directory, Web interface |
where <MSKHOME>
is the folder in which the MOSEK Optimization Suite has been installed.
4.2.4 Installation¶
To install OptServer and test the installation perform the following steps.
4.2.4.1 Run install script¶
Run the script <MSKHOME>/mosek/11.0/opt-server/bin/install_MosekServer
to configure the server. The full list of supported options can be obtained via
./install_MosekServer --help
As a reasonable minimum the configuration should specify where to install the server, the port to listen on, the database connection string and the location of an available MOSEK installation. For example:
./install_MosekServer --inplace \
--port $PORT \
--mosekdir ../../.. \
--database-resource "host=/var/run/postgresql user=$USER dbname=$DBNAME sslmode=disable"
The install script creates a configuration file <MSKHOME>/mosek/11.0/opt-server/etc/Mosek/server.conf
which can be edited by hand if necessary.
4.2.4.2 Initialize the database¶
Run
./MosekServer --create-database
to initialize the database. It will use the information provided in the database connection string specified in the previous step. This step is not necessary if the database exists from a previous installation.
4.2.4.3 Initialize admin password (optional)¶
If the Web interface to the OptServer is to be used, run
./MosekServer --reset-admin
to set the password for the admin
user. This step is not required if the Web GUI will not be used. Note that the GUI will only be available with SSL enabled, see Sec. 6.3 (Security).
4.2.4.4 Run the server¶
Start the server by running the script
./MosekServer
The server will print its initial configuration and continue writing the log to a file. To obtain the full list of server options run
./MosekServer --help
For debugging purposes it is convenient to use the options
./MosekServer --debug --logfile -
This will increase the amount of debug output and redirect it to standard output.
4.3 Test the installation¶
To test that the OptServer or OptServerLight is working properly locate, compile (if necessary) and run the example opt_server_sync.*
for either C, Python, Java or C#. Examples and sample data files can be found in the distribution package under <MSKHOME>/mosek/11.0/tools/examples
.
For example, assuming that MOSEK was installed in Python, one can go to the folder with Python examples and run
python opt_server_sync.py ../data/25fv47.mps $SERVER $PORT
where $SERVER:$PORT
points to the OptServer. If the configuration is correct the example will print a log from solving the problem and a solution summary. In case of issues the log output of the OptServer should be consulted to determine the cause.
This example also demonstrates how to use the OptServer from the MOSEK API.