Skip to content

Commit

Permalink
chore: update notebooks to use demo endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mtth committed Sep 7, 2024
1 parent 3b1d325 commit a176139
Show file tree
Hide file tree
Showing 15 changed files with 7,579 additions and 3,730 deletions.
427 changes: 226 additions & 201 deletions resources/examples/bin-packing.ipynb

Large diffs are not rendered by default.

737 changes: 529 additions & 208 deletions resources/examples/consecutive-shift-scheduling.ipynb

Large diffs are not rendered by default.

1,305 changes: 934 additions & 371 deletions resources/examples/debt-simplification.ipynb

Large diffs are not rendered by default.

1,023 changes: 705 additions & 318 deletions resources/examples/doctor-scheduling.ipynb

Large diffs are not rendered by default.

1,484 changes: 1,134 additions & 350 deletions resources/examples/fantasy-premier-league.ipynb

Large diffs are not rendered by default.

481 changes: 291 additions & 190 deletions resources/examples/job-shop-scheduling.ipynb

Large diffs are not rendered by default.

652 changes: 433 additions & 219 deletions resources/examples/lot-sizing.ipynb

Large diffs are not rendered by default.

823 changes: 602 additions & 221 deletions resources/examples/portfolio-optimization.ipynb

Large diffs are not rendered by default.

862 changes: 585 additions & 277 deletions resources/examples/product-allocation.ipynb

Large diffs are not rendered by default.

1,287 changes: 904 additions & 383 deletions resources/examples/sudoku.ipynb

Large diffs are not rendered by default.

628 changes: 376 additions & 252 deletions resources/guides/managing-modeling-complexity.ipynb

Large diffs are not rendered by default.

520 changes: 262 additions & 258 deletions resources/guides/uploading-a-model.ipynb

Large diffs are not rendered by default.

204 changes: 100 additions & 104 deletions resources/guides/using-a-self-hosted-api-server.ipynb
Original file line number Diff line number Diff line change
@@ -1,106 +1,102 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "ae17559e",
"metadata": {},
"source": [
"# Using a self-hosted API server\n",
"\n",
"In this notebook we go over the steps required to set up and connect to a self-hosted [API server](https://hub.docker.com/r/opvious/api-server), allowing you to host your own Opvious platform.\n",
"\n",
"<div class=\"alert alert-block alert-warning\">\n",
" &#9888; The API server's image is subject to the <a href=\"https://www.opvious.io/end-user-license-agreements/api-image\">Opvious API image EULA</a>. Commercial use requires a separate license which can be requested <a href=\"https://forms.gle/8ZP2zr91TY9TPcp66\">here</a>.\n",
"</div>\n",
"\n",
"\n",
"## Starting the server\n",
"\n",
"### With the CLI\n",
"\n",
"The simplest way to download and run the API server is with the [Opvious CLI](https://www.npmjs.com/package/opvious-cli#starting-an-api-server). The CLI will take care of setting up the server's dependencies automatically before starting it:\n",
"\n",
"```sh\n",
"npm install -g opvious-cli # Install the CLI\n",
"opvious api start # Start the API server along with its dependencies\n",
"```\n",
"\n",
"Refer to the CLI's README or run `opvious api --help` to view the list of available commands. You may also be interested in the server's telemetry configuration options described [here](https://hub.docker.com/r/opvious/api-server).\n",
"\n",
"\n",
"### From the Docker image\n",
"\n",
"Alternatively, you can download and run the [`opvious/api-server`](https://hub.docker.com/r/opvious/api-server) Docker image directly. This allows you to use it with your own database and/or cache:\n",
"\n",
"```\n",
"docker run -p 8080:8080 \\\n",
" -e DB_URL=postgres:// \\\n",
" -e REDIS_URL=redis:// \\\n",
" -e OPVIOUS_API_IMAGE_EULA \\\n",
" opvious/api-server\n",
"```\n",
"\n",
"Refer to the image's documentation for more information.\n",
"\n",
"\n",
"## Connecting to the server\n",
"\n",
"Once the API server is running, the next step is to use it from the SDKs. To do so, simply set the `OPVIOUS_ENDPOINT` environment variable to the server's endpoint (http://localhost:8080 if started via the CLI with default options). For example from your Bash configuration:\n",
"\n",
"```\n",
"# ~/.bashrc\n",
"OPVIOUS_ENDPOINT=http://localhost:8080\n",
"```\n",
"\n",
"You may also find it useful to create a [dedicated configuration profile](https://www.npmjs.com/package/opvious-cli#configuration-profiles) pointing to it:\n",
"\n",
"```\n",
"# ~/.config/opvious/cli.yml\n",
"profiles:\n",
" - name: local\n",
" endpoint: http://localhost:8080\n",
"```\n",
"\n",
"\n",
"## Authenticating requests\n",
"\n",
"The server's `STATIC_TOKENS` environment variable is used to specify a comma-separated list of static API tokens for authenticating API requests. Each entry's format is `<email>=<token>`, where `<email>` is the associated account's email. When using the CLI, this variable is set with the `-t` option:\n",
"\n",
"```sh\n",
"opvious api start -t [email protected]=secret-token\n",
"```\n",
"\n",
"These tokens can then be used as regular API tokens in SDKs by prefixing them with `static:`. For example requests to the server started with the command just above can be authenticated as `[email protected]` by setting `OPVIOUS_TOKEN=static:secret-token`."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "75b0bdbb",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
}
"cells": [
{
"cell_type": "markdown",
"id": "ae17559e",
"metadata": {},
"source": [
"# Using a self-hosted API server\n",
"\n",
"In this notebook we go over the steps required to set up and connect to a self-hosted [API server](https://hub.docker.com/r/opvious/api-server), allowing you to host your own Opvious platform.\n",
"\n",
"\n",
"## Starting the server\n",
"\n",
"### With the CLI\n",
"\n",
"The simplest way to download and run the API server is with the [Opvious CLI](https://www.npmjs.com/package/opvious-cli#starting-an-api-server). The CLI will take care of setting up the server's dependencies automatically before starting it:\n",
"\n",
"```sh\n",
"npm install -g opvious-cli # Install the CLI\n",
"opvious api start # Start the API server along with its dependencies\n",
"```\n",
"\n",
"Refer to the CLI's README or run `opvious api --help` to view the list of available commands. You may also be interested in the server's telemetry configuration options described [here](https://hub.docker.com/r/opvious/api-server).\n",
"\n",
"\n",
"### From the Docker image\n",
"\n",
"Alternatively, you can download and run the [`opvious/api-server`](https://hub.docker.com/r/opvious/api-server) Docker image directly. This allows you to use it with your own database and/or cache:\n",
"\n",
"```\n",
"docker run -p 8080:8080 \\\n",
" -e DB_URL=postgres:// \\\n",
" -e REDIS_URL=redis:// \\\n",
" -e OPVIOUS_API_IMAGE_EULA \\\n",
" opvious/api-server\n",
"```\n",
"\n",
"Refer to the image's documentation for more information.\n",
"\n",
"\n",
"## Connecting to the server\n",
"\n",
"Once the API server is running, the next step is to use it from the SDKs. To do so, simply set the `OPVIOUS_ENDPOINT` environment variable to the server's endpoint (http://localhost:8080 if started via the CLI with default options). For example from your Bash configuration:\n",
"\n",
"```\n",
"# ~/.bashrc\n",
"OPVIOUS_ENDPOINT=http://localhost:8080\n",
"```\n",
"\n",
"You may also find it useful to create a [dedicated configuration profile](https://www.npmjs.com/package/opvious-cli#configuration-profiles) pointing to it:\n",
"\n",
"```\n",
"# ~/.config/opvious/cli.yml\n",
"profiles:\n",
" - name: local\n",
" endpoint: http://localhost:8080\n",
"```\n",
"\n",
"\n",
"## Authenticating requests\n",
"\n",
"The server's `STATIC_TOKENS` environment variable is used to specify a comma-separated list of static API tokens for authenticating API requests. Each entry's format is `<email>=<token>`, where `<email>` is the associated account's email. When using the CLI, this variable is set with the `-t` option:\n",
"\n",
"```sh\n",
"opvious api start -t [email protected]=secret-token\n",
"```\n",
"\n",
"These tokens can then be used as regular API tokens in SDKs by prefixing them with `static:`. For example requests to the server started with the command just above can be authenticated as `[email protected]` by setting `OPVIOUS_TOKEN=static:secret-token`."
]
},
"nbformat": 4,
"nbformat_minor": 5
}
{
"cell_type": "code",
"execution_count": 1,
"id": "75b0bdbb",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit a176139

Please sign in to comment.