diff --git a/CMakeLists.txt b/CMakeLists.txt index d53c2ba..9427eec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,6 +72,7 @@ add_executable( owls src/framework/ConfigurationValidator.h src/framework/ow_constants.h src/framework/WebSocketClientNotifications.h + src/framework/MicroServiceErrorHandler.h src/RESTAPI/RESTAPI_routers.cpp src/Daemon.cpp src/Daemon.h src/Dashboard.cpp src/Dashboard.h diff --git a/Dockerfile b/Dockerfile index 31ca167..9fd7866 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,16 @@ -ARG ALPINE_VERSION=3.16.2 +ARG DEBIAN_VERSION=11.4-slim ARG POCO_VERSION=poco-tip-v1 ARG FMTLIB_VERSION=9.0.0 ARG CPPKAFKA_VERSION=tip-v1 ARG JSON_VALIDATOR_VERSION=2.1.0 -FROM alpine:$ALPINE_VERSION AS build-base +FROM debian:$DEBIAN_VERSION AS build-base -RUN apk add --update --no-cache \ +RUN apt-get update && apt-get install --no-install-recommends -y \ make cmake g++ git \ - unixodbc-dev postgresql-dev mariadb-dev \ - librdkafka-dev boost-dev openssl-dev \ - zlib-dev nlohmann-json + ibpq-dev libmariadb-dev libmariadbclient-dev-compat \ + librdkafka-dev libboost-all-dev libssl-dev \ + zlib1g-dev nlohmann-json3-dev ca-certificates FROM build-base AS poco-build @@ -90,21 +90,21 @@ WORKDIR /owls/cmake-build RUN cmake .. RUN cmake --build . --config Release -j8 -FROM alpine:$ALPINE_VERSION +FROM debian:$DEBIAN_VERSION ENV OWLS_USER=owls \ OWLS_ROOT=/owls-data \ OWLS_CONFIG=/owls-data -RUN addgroup -S "$OWLS_USER" && \ - adduser -S -G "$OWLS_USER" "$OWLS_USER" +RUN useradd "$OWLS_USER" RUN mkdir /openwifi RUN mkdir -p "$OWLS_ROOT" "$OWLS_CONFIG" && \ chown "$OWLS_USER": "$OWLS_ROOT" "$OWLS_CONFIG" -RUN apk add --update --no-cache librdkafka su-exec gettext ca-certificates bash jq curl \ - mariadb-connector-c libpq unixodbc postgresql-client +RUN apt-get update && apt-get install --no-install-recommends -y \ + librdkafka++1 gosu gettext ca-certificates bash jq curl wget \ + libmariadb-dev-compat libpq5 unixodbc COPY test_scripts/curl/cli /cli @@ -112,12 +112,14 @@ COPY owls.properties.tmpl / COPY docker-entrypoint.sh / COPY wait-for-postgres.sh / RUN wget https://raw.githubusercontent.com/Telecominfraproject/wlan-cloud-ucentral-deploy/main/docker-compose/certs/restapi-ca.pem \ - -O /usr/local/share/ca-certificates/restapi-ca-selfsigned.pem + -O /usr/local/share/ca-certificates/restapi-ca-selfsigned.crt COPY --from=owls-build /owls/cmake-build/owls /openwifi/owls COPY --from=cppkafka-build /cppkafka/cmake-build/src/lib/* /lib/ COPY --from=poco-build /poco/cmake-build/lib/* /lib/ +RUN ldconfig + EXPOSE 16007 17007 16107 ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/build b/build index 9d60796..8e2afd3 100644 --- a/build +++ b/build @@ -1 +1 @@ -11 \ No newline at end of file +17 \ No newline at end of file diff --git a/cmake-build/Makefile b/cmake-build/Makefile index 03a5ec2..bbce266 100644 --- a/cmake-build/Makefile +++ b/cmake-build/Makefile @@ -57,10 +57,10 @@ RM = /usr/local/Cellar/cmake/3.21.3_1/bin/cmake -E rm -f EQUALS = = # The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /Users/stephb/Desktop/Dropbox/clion/owls-270-rc2 +CMAKE_SOURCE_DIR = /Users/stephb/Desktop/Dropbox/clion/wlan-cloud-owls # The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /Users/stephb/Desktop/Dropbox/clion/owls-270-rc2/cmake-build +CMAKE_BINARY_DIR = /Users/stephb/Desktop/Dropbox/clion/wlan-cloud-owls/cmake-build #============================================================================= # Targets provided globally by CMake. @@ -87,9 +87,9 @@ edit_cache/fast: edit_cache # The main all target all: cmake_check_build_system - $(CMAKE_COMMAND) -E cmake_progress_start /Users/stephb/Desktop/Dropbox/clion/owls-270-rc2/cmake-build/CMakeFiles /Users/stephb/Desktop/Dropbox/clion/owls-270-rc2/cmake-build//CMakeFiles/progress.marks + $(CMAKE_COMMAND) -E cmake_progress_start /Users/stephb/Desktop/Dropbox/clion/wlan-cloud-owls/cmake-build/CMakeFiles /Users/stephb/Desktop/Dropbox/clion/wlan-cloud-owls/cmake-build//CMakeFiles/progress.marks $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all - $(CMAKE_COMMAND) -E cmake_progress_start /Users/stephb/Desktop/Dropbox/clion/owls-270-rc2/cmake-build/CMakeFiles 0 + $(CMAKE_COMMAND) -E cmake_progress_start /Users/stephb/Desktop/Dropbox/clion/wlan-cloud-owls/cmake-build/CMakeFiles 0 .PHONY : all # The main clean target diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 4bb276b..2814f0b 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e if [ "$SELFSIGNED_CERTS" = 'true' ]; then @@ -53,7 +53,7 @@ if [ "$1" = '/openwifi/owls' -a "$(id -u)" = '0' ]; then if [ "$RUN_CHOWN" = 'true' ]; then chown -R "$OWLS_USER": "$OWLS_ROOT" "$OWLS_CONFIG" fi - exec su-exec "$OWLS_USER" "$@" + exec gosu "$OWLS_USER" "$@" fi exec "$@" diff --git a/helm/values.yaml b/helm/values.yaml index 79bdcfd..9f9a942 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -97,7 +97,7 @@ resources: {} # memory: 128Mi securityContext: - fsGroup: 101 + fsGroup: 1000 nodeSelector: {} diff --git a/wait-for-postgres.sh b/wait-for-postgres.sh index 86ed806..8d3e6c9 100755 --- a/wait-for-postgres.sh +++ b/wait-for-postgres.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # wait-for-postgres.sh set -e @@ -20,7 +20,7 @@ if [ "$1" = '/openwifi/owls' -a "$(id -u)" = '0' ]; then if [ "$RUN_CHOWN" = 'true' ]; then chown -R "$OWLS_USER": "$OWLS_ROOT" "$OWLS_CONFIG" fi - exec su-exec "$OWLS_USER" "$@" + exec gosu "$OWLS_USER" "$@" fi exec "$@"