Metropolis Microservices/RidgeRun Services/PTZ: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 21: Line 21:
You can run this microservice with the following command:
You can run this microservice with the following command:


<pre>
<syntaxhighlight lang="bash">
docker run --runtime nvidia -it --privileged --net=host --ipc=host --name ptz-service  ridgerun/ptz-service:latest --host=0.0.0.0
docker run --runtime nvidia -it --privileged --net=host --ipc=host --name ptz-service  ridgerun/ptz-service:latest --host=0.0.0.0
</pre>
</syntaxhighlight>


This will run PTZ in port 5020
This will run PTZ in port 5020
Line 47: Line 47:
For convenience, a docker image is available in dockerhub which as of today is available for Jetpack 6.0. Use the following command to pull it.
For convenience, a docker image is available in dockerhub which as of today is available for Jetpack 6.0. Use the following command to pull it.


<pre>
<syntaxhighlight lang="bash">
docker pull ridgerun/ptz-service
docker pull ridgerun/ptz-service
</pre>
</syntaxhighlight>


====Build your image (Dockerfile)====
====Build your image (Dockerfile)====
Line 57: Line 57:
You can get the source code with the following command:
You can get the source code with the following command:


<pre>
<syntaxhighlight lang="bash">
git clone https://gitlab.ridgerun.com/open/ridgerun-microservices/ptz.git
git clone https://gitlab.ridgerun.com/open/ridgerun-microservices/ptz.git
</pre>
</syntaxhighlight>


First, we need to prepare the context directory for this build, please create a directory and include all the necessary repositories (listed below). The Dockerfile will look for all the source code in the context directory and copy them to the container.
First, we need to prepare the context directory for this build, please create a directory and include all the necessary repositories (listed below). The Dockerfile will look for all the source code in the context directory and copy them to the container.
Line 76: Line 76:
Then build the container image running the the following command from the folder containing the Dockerfile and context directory:
Then build the container image running the the following command from the folder containing the Dockerfile and context directory:


<pre>
<syntaxhighlight lang="bash">
sudo docker build \
sudo docker build \
--network=host \
--network=host \
-f Dockerfile \
-f Dockerfile \
-t ridgerun/ptz-service:latest ptz-context/
-t ridgerun/ptz-service:latest ptz-context/
</pre>
</syntaxhighlight>


Change '''ptz-context''' to your context's path and the tag (-t) to the name you want to give to your image.
Change '''ptz-context''' to your context's path and the tag (-t) to the name you want to give to your image.
Line 97: Line 97:
Here we are creating a container called '''ptz-service''' that will start the ptz-service application in the default address and port and use the default output resolution. If a different address, port, or output resolution has to be used, you can do it by running:
Here we are creating a container called '''ptz-service''' that will start the ptz-service application in the default address and port and use the default output resolution. If a different address, port, or output resolution has to be used, you can do it by running:


<pre>
<syntaxhighlight lang="bash">
sudo docker run --runtime nvidia -it --privileged --net=host --ipc=host --name ptz-service  ridgerun/ptz-service:latest --host=HOST --port=PORT --ptz-window-size=PTZ_WINDOW_SIZE
sudo docker run --runtime nvidia -it --privileged --net=host --ipc=host --name ptz-service  ridgerun/ptz-service:latest --host=HOST --port=PORT --ptz-window-size=PTZ_WINDOW_SIZE
</pre>
</syntaxhighlight>


===As a standalone application===
===As a standalone application===
Line 116: Line 116:
The project is configured (via setup.py) to install the service with the name '''ptz'''. So to install it run:
The project is configured (via setup.py) to install the service with the name '''ptz'''. So to install it run:


<pre>
<syntaxhighlight lang="bash">
cd ptz
cd ptz
pip install .
pip install .
</pre>
</syntaxhighlight>


Then you will have the service with the following options:
Then you will have the service with the following options:


<pre>
<syntaxhighlight lang="bash">
usage: ptz [-h] [--port PORT] [--host HOST] [--ptz-window-size PTZ_WINDOW_SIZE]
usage: ptz [-h] [--port PORT] [--host HOST] [--ptz-window-size PTZ_WINDOW_SIZE]


Line 132: Line 132:
   --ptz-window-size PTZ_WINDOW_SIZE
   --ptz-window-size PTZ_WINDOW_SIZE
                         Size of the PTZ output window in pixels. The final resolution will be (Size x Size)
                         Size of the PTZ output window in pixels. The final resolution will be (Size x Size)
</pre>
</syntaxhighlight>


After this, the service will be available under the name '''ptz'''.
After this, the service will be available under the name '''ptz'''.
Line 151: Line 151:
You can get and install '''rrms-utils''' by running:
You can get and install '''rrms-utils''' by running:


<pre>
<syntaxhighlight lang="bash">
git clone https://gitlab.ridgerun.com/open/ridgerun-microservices/rrms-utils.git
git clone https://gitlab.ridgerun.com/open/ridgerun-microservices/rrms-utils.git
cd rrms-utils
cd rrms-utils
pip install .
pip install .
</pre>
</syntaxhighlight>
}}
}}