diff --git a/.gitignore b/.gitignore index b10da17..3f6901c 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,8 @@ build/ # Deps deps/boost/ deps/jsoncpp/ -mysql-connector/ \ No newline at end of file +mysql-connector/ + +# Test +test/cameradartest.conf.json +test/cameradar_*_Debug_Linux.tar.gz \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..8f7b42a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,42 @@ +language: generic +sudo: required +dist: trusty + +before_install: +- sudo apt-get update -qq +- sudo apt-get install -y software-properties-common +- sudo add-apt-repository -y ppa:mc3man/trusty-media +- sudo add-apt-repository -y ppa:george-edison55/cmake-3.x +- sudo apt-get update -qq +- sudo apt-get install -y nmap +- sudo apt-get install -y ffmpeg +- sudo apt-get install -y cmake +- sudo apt-get install -y libboost-all-dev +- sudo apt-get install -y libgstreamer1.0-dev +- sudo apt-get install -y gstreamer1.0-plugins-base +- sudo apt-get install -y gstreamer1.0-plugins-good +- sudo apt-get install -y libcurl4-openssl-dev +- sudo apt-get install -y libmysqlclient18 +- sudo apt-get install -y mysql-client + +matrix: + include: + - os: linux + env: COMPILER_NAME=gcc CXX=g++-5 CC=gcc-5 CMAKE_CXX_COMPILER=g++-5 + addons: + apt: + packages: + - g++-5 + sources: &sources + - llvm-toolchain-precise-3.8 + - ubuntu-toolchain-r-test + +script: +- cd deployment +- ./build_last_package.sh Debug +- tar xvf cameradar_*_Debug_Linux.tar.gz +- cp /home/travis/build/EtixLabs/cameradar/deps/jsoncpp/src/deps.jsoncpp/src/lib_json/libjsoncpp*.so* cameradar_*_Debug_Linux/libraries/ +- cp /home/travis/build/EtixLabs/cameradar/deps/mysql-connector/lib/libmysqlcppconn.so* cameradar_*_Debug_Linux/libraries/ +- tar -czvf cameradar_*_Debug_Linux.tar.gz cameradar_*_Debug_Linux +- docker build -t cameradar . +- docker run -v /tmp/thumbs:/tmp/thumbs cameradar diff --git a/CHANGELOG.md b/CHANGELOG.md index a8cba53..9c96fef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ This file lists all versions of the repository and precises all changes. +## v1.1.2 + +#### Minor changes : +* Added travis integration +* Added default environment value for Docker deployment +* Updated docker image description with new easy usage +* Updated README badges style (replaced flat with square-flat) +* Build last package can now also generate a debug package if given the `Debug` command-line argument + +#### Known issues : +* There is still the issue with Camera Emulation Server, see the [previous version's patchnote](#v1.1.1) for more information. + ## v1.1.1 #### Minor changes : diff --git a/CMakeLists.txt b/CMakeLists.txt index b93b4af..1c5b70c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ project (${PROJECT_NAME}) set (${PROJECT_NAME}_VERSION_MAJOR 1) set (${PROJECT_NAME}_VERSION_MINOR 1) -set (${PROJECT_NAME}_VERSION_PATCH 1) +set (${PROJECT_NAME}_VERSION_PATCH 2) set (${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}${${PROJECT_NAME}_SUFFIX}") find_package(Git REQUIRED) @@ -102,7 +102,6 @@ set (${CAMERADAR_LIBRARIES} "") # Build cache managers add_subdirectory (deps) -message ("Debug") add_subdirectory (cameradar_standalone) add_subdirectory (cache_managers) diff --git a/README.md b/README.md index 5b093bb..e63665c 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,10 @@ ## An RTSP surveillance camera access multitool -[![cameradar License](https://img.shields.io/badge/license-Apache-blue.svg)](#license) -[![Docker Pulls](https://img.shields.io/docker/pulls/ullaakut/cameradar.svg)](https://hub.docker.com/r/ullaakut/cameradar/) -[![Latest release](https://img.shields.io/badge/release-1.1.1-green.svg)](https://github.com/EtixLabs/cameradar/releases/latest) +[![cameradar License](https://img.shields.io/badge/license-Apache-blue.svg?style=flat-square)](#license) +[![Docker Pulls](https://img.shields.io/docker/pulls/ullaakut/cameradar.svg?style=flat-square)](https://hub.docker.com/r/ullaakut/cameradar/) +[![Build](https://img.shields.io/travis/EtixLabs/cameradar/master.svg?style=flat-square)](https://travis-ci.org/EtixLabs/cameradar) +[![Latest release](https://img.shields.io/badge/release-1.1.2-green.svg?style=flat-square)](https://github.com/EtixLabs/cameradar/releases/latest) #### Cameradar allows you to: @@ -54,17 +55,15 @@ Run ``` docker run \ -v /tmp/thumbs/:/tmp/thumbs \ - -e CACHE_MANAGER=your_manager \ - -e CAMERAS_PORTS=your_ports \ -e CAMERAS_SUBNETWORKS=your_subnetwork \ ullaakut/cameradar:tag ``` * `your_subnetwork` can be a subnet (e.g.: `172.16.100.0/24`) or even an IP (e.g.: `172.16.100.10`). -* `your_ports` can be one port, multiple ports and even port ranges (e.g.: `554,8554,9000-9554`) -* `your_manager` can be either `dumb` or `mysql` but you probably want to use `dumb`. Check [Cameradar's readme on the Docker Hub](https://hub.docker.com/r/ullaakut/cameradar/) for more information. * `tag` allows you to specify a specific version for camerada. If you don't specify any tag, you will use the latest version by default (recommended) +Check [Cameradar's readme on the Docker Hub](https://hub.docker.com/r/ullaakut/cameradar/) for more information and more command-line options. + The generated thumbnails will be in `/tmp/thumbs` on both your machine and the `cameradar` container. For more complex use of the Docker image, see the `Environment variables` part of [Cameradar's readme on the Docker Hub](https://hub.docker.com/r/ullaakut/cameradar/). diff --git a/cameradar_standalone/src/main.cpp b/cameradar_standalone/src/main.cpp index 57cbd08..f43801e 100644 --- a/cameradar_standalone/src/main.cpp +++ b/cameradar_standalone/src/main.cpp @@ -88,14 +88,13 @@ check_storage_path(const std::string& thumbnail_storage_path) { int main(int argc, char* argv[]) { - etix::tool::logger::get_instance("cameradar"); + etix::tool::logger::get_instance("cameradar").set_level(etix::tool::loglevel::DEBUG); auto args = parse_cmdline(argc, argv); if (not args.first) return EXIT_FAILURE; print_version(); if (not args.second.exist("-l")) { - etix::tool::logger::get_instance("cameradar").set_level(etix::tool::loglevel::DEBUG); LOG_INFO_("No log level set, using log level 1", "main"); } else { try { diff --git a/cmake/jsoncpp.cmake b/cmake/jsoncpp.cmake index b5a397b..12ddf8b 100644 --- a/cmake/jsoncpp.cmake +++ b/cmake/jsoncpp.cmake @@ -42,7 +42,6 @@ set (JSONCPP_INCLUDE_DIR "${SOURCE_DIR}/include" PARENT_SCOPE) set (JSONCPP_LIBRARY_DIR "${SOURCE_DIR}/src/lib_json") set (JSONCPP_LIBRARY_DIR ${JSONCPP_LIBRARY_DIR} PARENT_SCOPE) -file(GLOB JSONCPP_INSTALL_DEPENDENCIES "${JSONCPP_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}jsoncpp*${CMAKE_SHARED_LIBRARY_SUFFIX}*") +file(GLOB JSONCPP_INSTALL_DEPENDENCIES "${JSONCPP_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}jsoncpp${CMAKE_SHARED_LIBRARY_SUFFIX}*") list (APPEND CAMERADAR_INSTALL_DEPENDENCIES ${JSONCPP_INSTALL_DEPENDENCIES}) - set(CAMERADAR_INSTALL_DEPENDENCIES ${CAMERADAR_INSTALL_DEPENDENCIES} PARENT_SCOPE) diff --git a/cmake/mysql_connector.cmake b/cmake/mysql_connector.cmake index 7d8469e..8240520 100644 --- a/cmake/mysql_connector.cmake +++ b/cmake/mysql_connector.cmake @@ -44,8 +44,7 @@ set (MYSQL_CONNECTOR_LIBRARY_DIR "${MYSQL_CONNECTOR_PATH}/lib") set (MYSQL_CONNECTOR_LIBRARY_DIR ${MYSQL_CONNECTOR_LIBRARY_DIR} PARENT_SCOPE) -# list all the hiredis libraries -file(GLOB MYSQL_CONNECTOR_INSTALL_DEPENDENCIES "${MYSQL_CONNECTOR_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}mysqlcppconn*${CMAKE_SHARED_LIBRARY_SUFFIX}*") +# list all the mysql libraries +file(GLOB MYSQL_CONNECTOR_INSTALL_DEPENDENCIES "${MYSQL_CONNECTOR_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}mysqlcppconn${CMAKE_SHARED_LIBRARY_SUFFIX}*") list (APPEND CAMERADAR_INSTALL_DEPENDENCIES ${MYSQL_CONNECTOR_INSTALL_DEPENDENCIES}) - set(CAMERADAR_INSTALL_DEPENDENCIES ${CAMERADAR_INSTALL_DEPENDENCIES} PARENT_SCOPE) diff --git a/deployment/build_last_package.sh b/deployment/build_last_package.sh index 0fa6f12..e20428c 100755 --- a/deployment/build_last_package.sh +++ b/deployment/build_last_package.sh @@ -10,18 +10,16 @@ COL_MAGENTA=$ESC_SEQ"35;01m" COL_CYAN=$ESC_SEQ"36;01m" echo -e $COL_YELLOW"Deleting old package ... "$COL_RESET -rm -f cameradar_*_Release_Linux.tar.gz +rm -f cameradar_*_${1:-"Release"}_Linux.tar.gz echo -e $COL_GREEN"OK!"$COL_RESET echo -e $COL_YELLOW"Creating package ... "$COL_RESET -{ cd .. mkdir build cd build - rm -f cameradar_*_Release_Linux.tar.gz - cmake .. -DCMAKE_BUILD_TYPE=Release + rm -f cameradar_*_${1:-"Release"}_Linux.tar.gz + cmake .. -DCMAKE_BUILD_TYPE=${1:-"Release"} make package - cp cameradar_*_Release_Linux.tar.gz ../deployment + cp cameradar_*_${1:-"Release"}_Linux.tar.gz ../deployment cd ../deployment - } &> /dev/null echo -e $COL_GREEN"OK!"$COL_RESET diff --git a/deployment/cameradar_1.1.1_Release_Linux.tar.gz b/deployment/cameradar_1.1.1_Release_Linux.tar.gz deleted file mode 100644 index 49d6818..0000000 Binary files a/deployment/cameradar_1.1.1_Release_Linux.tar.gz and /dev/null differ diff --git a/deployment/cameradar_1.1.2_Release_Linux.tar.gz b/deployment/cameradar_1.1.2_Release_Linux.tar.gz new file mode 100644 index 0000000..476ae4e Binary files /dev/null and b/deployment/cameradar_1.1.2_Release_Linux.tar.gz differ diff --git a/deployment/docker-entrypoint.sh b/deployment/docker-entrypoint.sh index 11316a1..473a701 100755 --- a/deployment/docker-entrypoint.sh +++ b/deployment/docker-entrypoint.sh @@ -21,8 +21,21 @@ for arg; do esac done +if [ "$CACHE_MANAGER" == "" ]; then + export CACHE_MANAGER="dumb" +fi + +if [ "$CAMERAS_SUBNETWORKS" == "" ]; then + export CAMERAS_SUBNETWORKS="0.0.0.0" +fi + +if [ "$CAMERAS_PORTS" == "" ]; then + export CAMERAS_PORTS="554,8554" +fi + envsubst < /cameradar/conf/cameradar.tmpl.conf.json > /cameradar/conf/cameradar.conf.json + if [ "$CACHE_MANAGER" == "mysql" ] && [ "$1" = '/cameradar/bin/cameradar' -a -z "$wantHelp" ]; then echo -n "Waiting for cameradar-database to be ready..." while ! mysqladmin ping -h "cameradar-database" -P3306 --silent; do