Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions OdtkContainerization/linux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ Further information can be found in the [ODTK Help](https://help.agi.com/odtk/#o
> [!IMPORTANT]
> If you are building these images on Windows, you need to ensure the git config setting [`core.autocrlf=input`](https://docs.github.com/en/get-started/git-basics/configuring-git-to-handle-line-endings) when cloning this repository. Since the base image is a Linux distribution, shell scripts in your workspace need to have Linux line endings when they are copied into the docker image.

## Security

ODTK Runtime can be started with various authentication modes including Unix domain socket ("uds"), Mutual Transport Layer Security ("mtls"), and "insecure". For demonstration purposes only, these code examples use the "insecure" mode. In a production environment, make sure that the connection is properly secured by using an appropriate authentication method.

## [Custom Environment](custom-environment)

Provides the environment required to communicate with the Yum and Pip package managers in your organization. This is optional if you are directly connected to the internet. It is required if you are using a proxy/firewall or isolated network requiring different certificates, settings, or both.
Expand Down
2 changes: 1 addition & 1 deletion OdtkContainerization/linux/configuration/licensing.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ANSYSLMD_LICENSE_FILE=<<PORT>>@<<FQDN>>
ANSYSLMD_LICENSE_FILE=<<PORT>>@<<FQDN>>
2 changes: 1 addition & 1 deletion OdtkContainerization/linux/custom-environment/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ ENV PIP_CERT=/etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt
# Directs python pip installs to pull packages from a specified repository.
# Delete the following two lines if you do not need to override the default pip repository URL.
ARG pipIndexUrl=''
ENV PIP_INDEX_URL=${pipIndexUrl}
ENV PIP_INDEX_URL=${pipIndexUrl}
2 changes: 1 addition & 1 deletion OdtkContainerization/linux/custom-environment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ If you don't need to override the default `pip` repository URL to download Pytho
docker compose build
```

This will produce an image on top of the `redhat/ubi8:latest` baseline image that is needed to build the code samples using `yum` or `pip`.
This will produce an image on top of the `redhat/ubi8:latest` baseline image that is needed to build the code samples using `yum` or `pip`.
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ services:
# Uncomment the line below if you want to use the UBI image from ironbank
# baseImage: registry1.dso.mil/ironbank/redhat/ubi/ubi8:latest
baseImage: redhat/ubi8:latest
pipIndexUrl: '' # Edit this value to be the index URL of your internal pip repository if you have one.
pipIndexUrl: '' # Edit this value to be the index URL of your internal pip repository if you have one.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
If your network requires special CA certificates to download packages, copy your CA certificate (`*.crt`) files to this folder.
If your network requires special CA certificates to download packages, copy your CA certificate (`*.crt`) files to this folder.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
If you need to override the default `yum` repository configuration to download RPM packages, copy your repository configuration (`*.repo`) files to this folder.
If you need to override the default `yum` repository configuration to download RPM packages, copy your repository configuration (`*.repo`) files to this folder.
2 changes: 1 addition & 1 deletion OdtkContainerization/linux/odtk-jupyter/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG baseImage=ansys/odtk/odtk-python:13.0.0-ubi8
ARG baseImage=ansys/odtk/odtk-python:13.0.1-ubi8
FROM ${baseImage}

LABEL JUPYTER_LAB_TOKEN='The token used to initially authenticate with the jupyter lab application. Required.'
Expand Down
6 changes: 3 additions & 3 deletions OdtkContainerization/linux/odtk-jupyter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This Docker image code sample demonstrates how to run ODTK Runtime for Linux usi
1. Run the following in a command line from this directory:

```
docker build -t ansys/odtk/odtk-jupyter:13.0.0-ubi8 .
docker build -t ansys/odtk/odtk-jupyter:13.0.1-ubi8 .
```

### Run the Container
Expand All @@ -27,7 +27,7 @@ The entrypoint of this container starts the Jupyter Lab server in the foreground
1. Run the following in a command line from this directory:

```
docker run -d -e JUPYTER_LAB_TOKEN=ansys-odtk -p 8888:8888 -v <ABSOLUTE PATH TO THIS DIRECTORY>/notebooks:/home/odtk/notebooks -v <ABSOLUTE PATH TO THIS DIRECTORY>/data:/home/odtk/data --env-file ../configuration/licensing.env --init --name odtk-jupyter --rm ansys/odtk/odtk-jupyter:13.0.0-ubi8
docker run -d -e JUPYTER_LAB_TOKEN=ansys-odtk -p 8888:8888 -v <ABSOLUTE PATH TO THIS DIRECTORY>/notebooks:/home/odtk/notebooks -v <ABSOLUTE PATH TO THIS DIRECTORY>/data:/home/odtk/data --env-file ../configuration/licensing.env --init --name odtk-jupyter --rm ansys/odtk/odtk-jupyter:13.0.1-ubi8
```

* If port `8888` is already in use on your machine, map a different port (e.g. `1234:8888`).
Expand Down Expand Up @@ -74,4 +74,4 @@ If you changed the host port mapping in the `docker-compose.yml`, use that port

```
docker compose down
```
```
6 changes: 3 additions & 3 deletions OdtkContainerization/linux/odtk-jupyter/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
services:
odtk-jupyter:
image: ansys/odtk/odtk-jupyter:13.0.0-ubi8
image: ansys/odtk/odtk-jupyter:13.0.1-ubi8
build:
context: .
args:
baseImage: ansys/odtk/odtk-python:13.0.0-ubi8
baseImage: ansys/odtk/odtk-python:13.0.1-ubi8
ports:
- 8888:8888
init: true # This enables the "tini" init tool for the entrypoint as recommended by Jupyter Lab
Expand All @@ -13,4 +13,4 @@ services:
- ./data:/home/odtk/data
env_file: ../configuration/licensing.env
environment:
JUPYTER_LAB_TOKEN: ansys-odtk
JUPYTER_LAB_TOKEN: ansys-odtk
57 changes: 45 additions & 12 deletions OdtkContainerization/linux/odtk-jupyter/notebooks/example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "45f7eb84-fb95-4b12-9520-b04672dde303",
"metadata": {},
"outputs": [],
"source": [
"import subprocess\n",
"odtkProcess = subprocess.Popen(['odtkruntime'], stderr=subprocess.PIPE)\n",
"odtkProcess = subprocess.Popen(['odtkruntime', '--auth-mode=insecure'], stderr=subprocess.PIPE)\n",
"while True:\n",
" if b'ODTK initialized' in odtkProcess.stderr.readline():\n",
" break"
Expand All @@ -32,13 +32,24 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "0b2d3697-fb11-492a-9bf1-e9e613d020a0",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"'13.0.1'"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from odtk import Client\n",
"client = Client()\n",
"client = Client.create_insecure_client()\n",
"odtk = client.get_root()\n",
"odtk.application.appVersion.eval()"
]
Expand All @@ -53,7 +64,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "7a5745cd-7035-4f72-b8fb-1c34174e3f79",
"metadata": {},
"outputs": [],
Expand All @@ -74,10 +85,21 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"id": "29194b49-4df5-44f6-bdc7-359d0899d3ca",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"simulator = odtk.application.createObj(scenario, 'Simulator', 'TestSimulator')\n",
"simulator.Go()"
Expand All @@ -93,10 +115,21 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"id": "a6d39a62-8cbd-43a4-a405-345589450dd7",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"filter = odtk.application.createObj(scenario, 'Filter', 'TestFilter')\n",
"filter.Go()"
Expand All @@ -112,7 +145,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"id": "80a6eecc-86a3-4108-a1d3-2bee20004c97",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -201,7 +234,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
"version": "3.13.5"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions OdtkContainerization/linux/odtk-python/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Builder stage
ARG baseImage=ansys/odtk/odtk-runtime:13.0.0-ubi8
ARG baseImage=ansys/odtk/odtk-runtime:13.0.1-ubi8
FROM ${baseImage} AS builder

# Add the ODTK Code Samples package to the builder stage
Expand All @@ -24,4 +24,4 @@ ENV PATH="${ODTK_USER_HOME}/.local/bin:${PATH}" \
COPY --chown=odtk docker-entrypoint.sh "${ODTK_USER_HOME}/bin/docker-entrypoint.sh"
COPY --chown=odtk start-odtk.sh "${ODTK_USER_HOME}/bin/start-odtk.sh"
RUN chmod +x "${ODTK_USER_HOME}/bin/docker-entrypoint.sh"
ENTRYPOINT [ "docker-entrypoint.sh" ]
ENTRYPOINT [ "docker-entrypoint.sh" ]
14 changes: 7 additions & 7 deletions OdtkContainerization/linux/odtk-python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ This Docker image code sample demonstrates how to install the ODTK Runtime Pytho
### Build the Image

1. Download version 13.0.0 or later of ODTK for Linux from [AGI Downloads](https://support.agi.com/downloads).
1. Unzip this file and copy the `odtk_codesamples_v13.0.0.tgz` into the [`distributions`](./distributions) folder at
1. Unzip this file and copy the `odtk_codesamples_v13.0.1.tgz` into the [`distributions`](./distributions) folder at
the same level as this file.
1. Run the following in a command line from this directory:

```
docker build -t ansys/odtk/odtk-python:13.0.0-ubi8 .
docker build -t ansys/odtk/odtk-python:13.0.1-ubi8 .
```


Expand All @@ -31,14 +31,14 @@ This image starts the `python` interpreter when starting the container. You can
1. Run the following in a command line from this directory:

```
docker run -it --env-file ../configuration/licensing.env --name odtk-python --rm ansys/odtk/odtk-python:13.0.0-ubi8
docker run -it --env-file ../configuration/licensing.env --name odtk-python --rm ansys/odtk/odtk-python:13.0.1-ubi8
```

1. Execute the following Python commands and verify it returns a valid response:

```python
from odtk import Client
client = Client()
client = Client.create_insecure_client()
root = client.get_root()
print(root.application.appVersion.eval())
```
Expand All @@ -50,7 +50,7 @@ This image starts the `python` interpreter when starting the container. You can
### Build the Image

1. Download version 13.0.0 or later of ODTK for Linux from [AGI Downloads](https://support.agi.com/downloads).
1. Unzip this file and copy the `odtk_codesamples_v13.0.0.tgz` into the [`distributions`](./distributions) folder at the same level as this file.
1. Unzip this file and copy the `odtk_codesamples_v13.0.1.tgz` into the [`distributions`](./distributions) folder at the same level as this file.
1. Run the following in a command line from this directory:

```
Expand All @@ -71,9 +71,9 @@ This image starts the `python` interpreter when starting the container. You can

```python
from odtk import Client
client = Client()
client = Client.create_insecure_client()
root = client.get_root()
print(root.application.appVersion.eval())
```

1. Quit the Python interpreter and the container by executing the command `quit()`
1. Quit the Python interpreter and the container by executing the command `quit()`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Copy the file `odtk_codesamples_v13.0.0.tgz` into this folder.
Copy the file `odtk_codesamples_v13.0.1.tgz` into this folder.
6 changes: 3 additions & 3 deletions OdtkContainerization/linux/odtk-python/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
services:
odtk-python:
image: ansys/odtk/odtk-python:13.0.0-ubi8
image: ansys/odtk/odtk-python:13.0.1-ubi8
build:
context: .
args:
baseImage: ansys/odtk/odtk-runtime:13.0.0-ubi8
env_file: ../configuration/licensing.env
baseImage: ansys/odtk/odtk-runtime:13.0.1-ubi8
env_file: ../configuration/licensing.env
4 changes: 2 additions & 2 deletions OdtkContainerization/linux/odtk-python/start-odtk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ create_log_file() {

start_odtk() {
echo "Initializing ODTK..."
odtkruntime > "${STARTUP_LOG}" 2>&1 &
odtkruntime --auth-mode=insecure > "${STARTUP_LOG}" 2>&1 &
}

wait_for_startup_complete() {
while true; do
if grep -q 'App running' "${STARTUP_LOG}"; then
if grep -q 'ODTK initialized' "${STARTUP_LOG}"; then
break
fi

Expand Down
2 changes: 1 addition & 1 deletion OdtkContainerization/linux/odtk-runtime/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ WORKDIR "${ODTK_USER_HOME}"
# Expose port for ODTK
EXPOSE 9393/tcp

ENTRYPOINT odtkruntime --address=0.0.0.0
ENTRYPOINT odtkruntime --auth-mode=insecure --allow-remote-hosts --address=0.0.0.0
10 changes: 5 additions & 5 deletions OdtkContainerization/linux/odtk-runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This Docker image code sample demonstrates how to install ODTK Runtime for Linux
* Docker must be installed and running on your system.
* By default, this sample uses the `redhat/ubi8:latest` Docker image as its baseline. If you are not able to pull images directly from Dockerhub on your system, you must load the baseline OS image on your system before building this image.
* Access to an Ansys Licensing Server with a valid ODTK license. Edit the [`licensing.env`](../configuration/licensing.env) file to ensure the `ANSYSLMD_LICENSE_FILE` environment variable has your Ansys License Server information.
* Download version 13.0.0 or later of ODTK for Linux from [AGI Downloads](https://support.agi.com/downloads). Unzip this file and copy the `odtk_binaries_v13.0.0.tgz` and `odtk_data_v13.0.0.tgz` into the [`distributions`](./distributions) folder at the same level as this file.
* Download version 13.0.1 or later of ODTK for Linux from [AGI Downloads](https://support.agi.com/downloads). Unzip this file and copy the `odtk_binaries_v13.0.1.tgz` and `odtk_data_v13.0.1.tgz` into the [`distributions`](./distributions) folder at the same level as this file.
* Download Python source code from https://www.python.org/ftp/python/3.13.5/Python-3.13.5.tgz and copy the file into the [`distributions`](./distributions) folder at the same level as this file.
> [!NOTE]
> ODTK requires Python version 3.9 or later to run properly. We recommend using a 3.13.X version, since we test with 3.13.5. Follow instructions on downloading the Python source code below. If you do not want to use the default version, you can do one of the following:
Expand All @@ -28,13 +28,13 @@ This image is built using the `yum` and `pip` tools to install package dependenc
1. If you did not build the `custom-environment` image described above, run the following in a command line from this directory:

```
docker build -t ansys/odtk/odtk-runtime:13.0.0-ubi8 .
docker build -t ansys/odtk/odtk-runtime:13.0.1-ubi8 .
```

1. If you did build the `custom-environment` image described above, run the following in a command line from this directory:

```
docker build -t ansys/odtk/odtk-runtime:13.0.0-ubi8 --build-arg baseImage=ansys/odtk/custom/redhat/ubi8:latest .
docker build -t ansys/odtk/odtk-runtime:13.0.1-ubi8 --build-arg baseImage=ansys/odtk/custom/redhat/ubi8:latest .
```


Expand All @@ -45,7 +45,7 @@ This image starts the ODTK runtime application listening for connections on port
1. Run the following in a command line from this directory:

```
docker run -d -it -p 9393:9393 --env-file ../configuration/licensing.env --name odtk-runtime --rm ansys/odtk/odtk-runtime:13.0.0-ubi8
docker run -d -it -p 9393:9393 --env-file ../configuration/licensing.env --name odtk-runtime --rm ansys/odtk/odtk-runtime:13.0.1-ubi8
```

* If port `9393` is already in use on your machine, map a different port (e.g. `1234:9393`).
Expand Down Expand Up @@ -86,4 +86,4 @@ This image starts the ODTK runtime application listening for connections on port

```
docker compose down
```
```
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Copy the files `odtk_binaries_v13.0.0.tgz` and `odtk_data_v13.0.0.tgz` into this folder.
Download the Python source files from https://www.python.org/ftp/python/3.10.9/Python-3.10.9.tgz into this folder.
Copy the files `odtk_binaries_v13.0.1.tgz` and `odtk_data_v13.0.1.tgz` into this folder.
Download the Python source files from https://www.python.org/ftp/python/3.10.9/Python-3.10.9.tgz into this folder.
4 changes: 2 additions & 2 deletions OdtkContainerization/linux/odtk-runtime/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
odtk-runtime:
image: ansys/odtk/odtk-runtime:13.0.0-ubi8
image: ansys/odtk/odtk-runtime:13.0.1-ubi8
build:
context: .
args:
Expand All @@ -11,4 +11,4 @@ services:
baseImage: redhat/ubi8:latest
ports:
- 9393:9393
env_file: ../configuration/licensing.env
env_file: ../configuration/licensing.env
4 changes: 2 additions & 2 deletions OdtkContainerization/linux/odtk-webservice/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG baseImage=ansys/odtk/odtk-python:13.0.0-ubi8
ARG baseImage=ansys/odtk/odtk-python:13.0.1-ubi8
FROM ${baseImage}

# Install Flask
Expand All @@ -17,4 +17,4 @@ ENV FLASK_APP=odtk-webservice.py \
EXPOSE 5000/tcp

# Run Flask application
ENTRYPOINT flask run --host=0.0.0.0
ENTRYPOINT flask run --host=0.0.0.0
Loading