Jump to content

Metropolis Microservices/RidgeRun Services/Engagement Analytics: Difference between revisions

Line 157: Line 157:
==== Pre-build Image ====
==== Pre-build Image ====


{{message|[https://www.ridgerun.com/contact Contact Ridgerun] if you want an evaluation version of the display service docker image.}}
{{message|[https://www.ridgerun.com/contact Contact Ridgerun] if you want an evaluation version of the engagement analytics service docker image.}}


Once you have obtained the display-service docker image, you can install it in your jetson with the following command:
Once you have obtained the engagement-analytics-service docker image, you can install it in your jetson with the following command:
   
   
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
docker load < display-service.tar.gz
docker load < engagement-analytics-service.tar.gz
</syntaxhighlight>
</syntaxhighlight>


==== Build Image ====
==== Build Image ====


{{message|[https://www.ridgerun.com/contact Contact Ridgerun] if you want access to the display service source code.}}
{{message|[https://www.ridgerun.com/contact Contact Ridgerun] if you want access to the engagement analytics service source code.}}


You can build the display service image using the Dockerfile in the docker directory.  First, we need to prepare the context directory for this build. You need to create a directory and include this repository and the remaining dependencies. The Dockerfile will look for all the packages in the context directory and copy them to the container.
You can build the engagement analytics service image using the Dockerfile in the docker directory.  First, we need to prepare the context directory for this build. You need to create a directory and include this repository and the remaining dependencies. The Dockerfile will look for all the packages in the context directory and copy them to the container.


After this, your context directory should look like this:
After this, your context directory should look like this:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
display-context/
analytics-context/
├── display
├── engagement-analytics
└── rrms-utils
└── rrms-utils
</syntaxhighlight>
</syntaxhighlight>
Line 187: Line 187:
}}
}}


Then build the container image with the following command:
Then, build the container image with the following command:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
docker build \
docker build \
--network=host \
--network=host \
-f Dockerfile \
--tag ridgerun/engagement-analytics-service \
-t ridgerun/display-service:latest \
-f Dockerfile analytics-context/
display-context/
</syntaxhighlight>
</syntaxhighlight>


Change display-context/ to your context's path and the tag to the name you want to give to the image.
Change analytics-context/ to your context's path and the tag to the name you want to give to the image.


====  Launch the container ====  
====  Launch the container ====  
Line 211: Line 210:
nvidia@ubuntu:~$ docker images
nvidia@ubuntu:~$ docker images
REPOSITORY                                  TAG
REPOSITORY                                  TAG
ridgerun/display-service                  latest
ridgerun/engagement-analytics-service                  latest
</syntaxhighlight>
</syntaxhighlight>


Line 217: Line 216:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
DISPLAY=:1 xhost +local:docker
docker run -it \
docker run \
-e DISPLAY=:1 \
--runtime nvidia \
-it \
--network host \
--network host \
-v /tmp/argus_socket:/tmp/argus_socket \
--volume <path to directory containing your configuration file>:/configs \
--name display-service \
-e INFLUXDB_TOKEN=<your influx db token> \
ridgerun/display-service:latest
--name engagement-analytics-service \
ridgerun/engagement-analytics-service:latest \
--config-file /configs/<your configuration file name> \
--retry
</syntaxhighlight>
</syntaxhighlight>


Here we are creating a container called display-service that will start the display service application (check [[Metropolis_Microservices/RidgeRun_Services/Display#Using_Standalone_Application|Using Standalone Application]]), launching the server in 127.0.0.1 and port 5052.By default, the service will try to communicate with the [https://developer.ridgerun.com/wiki/index.php/Metropolis_Microservices/RidgeRun_Services/Camera camera] and [https://developer.ridgerun.com/wiki/index.php/Metropolis_Microservices/RidgeRun_Services/Media] services to obtain the URI for the streams to be shown.
In order to start the display service with your own configuration you can use the following command.


<syntaxhighlight lang="bash">
Here we are creating a container called engagement-analytics-service that will start the engagement analytics service application (check [[Metropolis_Microservices/RidgeRun_Services/Engagement Analytics#Using_Standalone_Application|Using Standalone Application]]), launching the server in 127.0.0.1 and port 5053. When the service starts, it will communicate with both redis and influxdb, so make sure both services are running.
DISPLAY=:1 xhost +local:docker
docker run \
-e DISPLAY=:1 \
--runtime nvidia \
-it \
--network host \
-v /tmp/argus_socket:/tmp/argus_socket \
-v <configuration file path on host>:/init_config.json \
--name display-service \
ridgerun/display-service:latest \
--config_file /init_config.json --host=<host to be used> --port=<port to be used>
</syntaxhighlight>
 
Just change '''<configuration file path on host>''' with the path to your configuration file in local host.
 
You can verify the container is running with:
<syntaxhighlight lang="bash">
docker ps
</syntaxhighlight>
 
{{message|
Make sure the '''DISPLAY''' variable has the right content. You can verify by running the following command in your Jetson board:
<syntaxhighlight lang="bash">
echo $DISPLAY
</syntaxhighlight>
}}


You should see an entry with the display-service container:
After starting the service, you should see an entry with the engagement-analytics-service container:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
nvidia@ubuntu:~$ docker ps
nvidia@ubuntu:~$ docker ps
CONTAINER ID  IMAGE                                            COMMAND                  CREATED          STATUS          PORTS    NAMES
CONTAINER ID  IMAGE                                            COMMAND                  CREATED          STATUS          PORTS    NAMES
429b11d89523   ridgerun/display-service                      "display --config…13 hours ago    Up 3 minutes            display-service
258b111a9721   ridgerun/engagement-analytics-service                      "engagement-analytics…2 hours ago    Up 5 minutes            engagement-analytics-servvice
</syntaxhighlight>
</syntaxhighlight>


Cookies help us deliver our services. By using our services, you agree to our use of cookies.