Skip to main content

Expose a mosek license via a nginx server

Project description

Mosek License Server

PyPI version Apache 2.0 License Downloads pre-commit.ci status Coverage Status

Using a nginx image we expose a Mosek license on a server to be accessible from various research machines without sharing the actual license file in the underlying repositories.

This repository serves two purposes. It exposes the server but it is also the home for a little Python package to inject the license into your programs.

We solve a common problem here. Assume $20$ researchers work on $50$ different strategies. Using local copies of the same license file is a tedious exercise as the file needs to get updated once a year. Rather, each strategy would connect to the server to fetch a license using the mosek_license Python package. Once the strategy expires we only need to update the server. No change for the strategies is required.

License server

Copy your license file into folder

Copy the license file you have received (from Mosek) into the web folder. Name it mosek.

The file should look like

START_LICENSE
VENDOR MOSEKLM
# PSN-4183
FEATURE PTS MOSEKLM 10 31-jan-2024 uncounted ...
# PSN-4182
FEATURE PTON MOSEKLM 10 31-jan-2024 uncounted ...
END_LICENSE

Start the nginx server

Share the web folder (after you have copied your personal Mosek license into) via

docker run --name mosek -v $PWD/web:/usr/share/nginx/html:ro -p 8080:80 -d nginx

The license will now be exposed via http://localhost:8080/mosek

As an alternative you can run the script

./start_server.sh

The mosek_license module

Install via

pip install mosek-license-server

and then

import mosek

from mosek_license import license

license.upsert(server="http://localhost:8080/mosek")

Problems

In case you experience problems please check:

  • the license file is named mosek
  • the license file starts with START_LICENSE
  • the license file ends with END_LICENSE
  • the dates in the license file are still in the future
  • the server is running, e.g. docker ps -all (and check for mosek)
  • you can download a license file from the server, e.g.
curl <http://localhost:8080/mosek>

works.

  • you can run the demo in the demo folder

Still lost? Please open an issue.

Poetry

We assume you share already the love for Poetry. Once you have installed poetry you can perform

make install

to replicate the virtual environment we have defined in pyproject.toml and locked in poetry.lock.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mosek_license_server-1.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

mosek_license_server-1.1.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file mosek_license_server-1.1.0.tar.gz.

File metadata

  • Download URL: mosek_license_server-1.1.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for mosek_license_server-1.1.0.tar.gz
Algorithm Hash digest
SHA256 ae5953e27995f683cb495e2ba7c79039a825a949bd0a64a3689f1e1f3fcd7e1c
MD5 5cab8df98c4697676c31ff1692443919
BLAKE2b-256 f4fed9c6b1b5b0b2ac0e0b12f41c806ce51faaa739c8f75c8f32aa70a1041db6

See more details on using hashes here.

File details

Details for the file mosek_license_server-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mosek_license_server-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3fcbc1a22ca43ac5acf9dec91aac8b395dca609f9502e1884ae47e8e9f8c1394
MD5 8de46aa72aac1b4ab7f768eef770f9d5
BLAKE2b-256 de7327deb31877be97d34a963d43cb886070c2e97037c2bda15c06899c755568

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page