Compare commits

...

30 Commits

Author SHA1 Message Date
TIP Automation User
af7cbf0ce1 Chg: update image tag in helm values to v2.7.0-RC6 2022-10-05 02:46:05 +00:00
Stephane Bourque
d50e8c0c44 Merge pull request #74 from Telecominfraproject/main
Fix for WIFI-10942
2022-10-04 19:41:23 -07:00
stephb9959
c5e44f2a98 Merge remote-tracking branch 'origin/main' 2022-10-04 08:20:51 -07:00
stephb9959
5c2937c7ec https://telecominfraproject.atlassian.net/browse/WIFI-10942
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2022-10-04 08:20:42 -07:00
Dmitry Dunaev
698b467d3f Merge pull request #72 from Telecominfraproject/main
[WIFI-10581] Fix: securityContext fsGroup in helm
2022-10-03 15:54:01 +03:00
Dmitry Dunaev
a8f1483362 [WIFI-10581] Fix: securityContext fsGroup in helm
Signed-off-by: Dmitry Dunaev <dmitry@opsfleet.com>
2022-10-03 15:53:05 +03:00
TIP Automation User
693814de1c Chg: update image tag in helm values to v2.7.0-RC5 2022-10-03 11:14:26 +00:00
Dmitry Dunaev
0394369410 Merge pull request #71 from Telecominfraproject/main
[WIFI-10581] Add: postgresql-client in Dockerfile
2022-10-03 14:06:07 +03:00
Dmitry Dunaev
5abe7a9909 [WIFI-10581] Fix: Helm image to main
Signed-off-by: Dmitry Dunaev <dmitry@opsfleet.com>
2022-10-03 12:11:10 +03:00
Dmitry Dunaev
0a3a9a4b20 Merge pull request #70 from Telecominfraproject/fix/wifi-10581--postgres-client
[WIFI-10581] Add: postgresql-client in Dockerfile
2022-10-03 11:24:32 +03:00
Dmitry Dunaev
9d4eb1e502 [WIFI-10581] Add: postgresql-client in Dockerfile
Signed-off-by: Dmitry Dunaev <dmitry@opsfleet.com>
2022-10-03 11:24:15 +03:00
Stephane Bourque
0b6d68def5 Merge pull request #69 from Telecominfraproject/main
https://telecominfraproject.atlassian.net/browse/WIFI-10942
2022-10-02 11:30:41 -07:00
Stephane Bourque
51ba962338 Merge branch 'release/v2.7.0' into main 2022-10-02 11:30:09 -07:00
Stephane Bourque
fef07e3150 Merge pull request #68 from Telecominfraproject/WIFI-10942
https://telecominfraproject.atlassian.net/browse/WIFI-10942
2022-10-02 11:28:07 -07:00
Stephane Bourque
03a6675359 Merge branch 'main' into WIFI-10942 2022-10-02 11:27:38 -07:00
stephb9959
19686da4d8 https://telecominfraproject.atlassian.net/browse/WIFI-10942 2022-10-02 11:26:16 -07:00
stephb9959
c5997a3511 Merge remote-tracking branch 'origin/WIFI-10942' into WIFI-10942 2022-10-02 11:26:02 -07:00
Stephane Bourque
3feb5fd666 https://telecominfraproject.atlassian.net/browse/WIFI-10942 2022-10-02 11:25:53 -07:00
Stephane Bourque
d3cd3a1a21 https://telecominfraproject.atlassian.net/browse/WIFI-10942 2022-10-02 11:25:19 -07:00
Stephane Bourque
5e6228b9d6 Merge pull request #51 from Telecominfraproject/WIFI-10581-switch-images-to-debian-slim
[WIFI-10581] Switch microservice Docker images from Alpine to Debian-slim
2022-10-02 11:20:58 -07:00
TIP Automation User
ad526ebf1d Chg: update image tag in helm values to v2.7.0-RC4 2022-09-30 19:49:00 +00:00
Stephane Bourque
8de53277e6 Merge pull request #67 from Telecominfraproject/WIFI-10942
https://telecominfraproject.atlassian.net/browse/WIFI-10942
2022-09-30 11:27:14 -07:00
Stephane Bourque
93fbb3017a Merge branch 'release/v2.7.0' into WIFI-10942 2022-09-30 11:27:06 -07:00
stephb9959
2e4d1ad3e8 https://telecominfraproject.atlassian.net/browse/WIFI-10942
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2022-09-30 11:25:38 -07:00
TIP Automation User
109a9affc5 Chg: update image tag in helm values to v2.7.0-RC3 2022-09-30 16:31:37 +00:00
Stephane Bourque
9c65813735 Merge pull request #66 from Telecominfraproject/WIFI-10942
https://telecominfraproject.atlassian.net/browse/WIFI-10942
2022-09-30 09:00:23 -07:00
stephb9959
7d0bdf059d https://telecominfraproject.atlassian.net/browse/WIFI-10942
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2022-09-30 08:59:38 -07:00
Johann Hoffmann
6cacebad28 Fix self-signed cert file extension for Debian
Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>
2022-08-19 17:19:40 +02:00
Johann Hoffmann
e487b68945 Create necessary library links in Docker image
Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>
2022-08-19 16:13:11 +02:00
Johann Hoffmann
ffddfa87d2 Switch to Debian-slim base images
Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>
2022-08-18 17:53:53 +02:00
10 changed files with 251 additions and 76 deletions

View File

@@ -78,7 +78,9 @@ add_executable(owprov
src/framework/ConfigurationValidator.cpp
src/framework/ConfigurationValidator.h
src/framework/ow_constants.h
src/framework/MicroServiceErrorHandler.h
src/framework/WebSocketClientNotifications.h
src/framework/MicroServiceErrorHandler.h
src/RESTObjects/RESTAPI_SecurityObjects.h src/RESTObjects/RESTAPI_SecurityObjects.cpp
src/RESTObjects/RESTAPI_ProvObjects.cpp src/RESTObjects/RESTAPI_ProvObjects.h
src/RESTObjects/RESTAPI_GWobjects.h src/RESTObjects/RESTAPI_GWobjects.cpp

View File

@@ -1,17 +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 \
curl-dev
libpq-dev libmariadb-dev libmariadbclient-dev-compat \
librdkafka-dev libboost-all-dev libssl-dev \
zlib1g-dev nlohmann-json3-dev ca-certificates libcurl4-openssl-dev
FROM build-base AS poco-build
@@ -91,21 +90,21 @@ WORKDIR /owprov/cmake-build
RUN cmake ..
RUN cmake --build . --config Release -j8
FROM alpine:$ALPINE_VERSION
FROM debian:$DEBIAN_VERSION
ENV OWPROV_USER=owprov \
OWPROV_ROOT=/owprov-data \
OWPROV_CONFIG=/owprov-data
RUN addgroup -S "$OWPROV_USER" && \
adduser -S -G "$OWPROV_USER" "$OWPROV_USER"
RUN useradd "$OWPROV_USER"
RUN mkdir /openwifi
RUN mkdir -p "$OWPROV_ROOT" "$OWPROV_CONFIG" && \
chown "$OWPROV_USER": "$OWPROV_ROOT" "$OWPROV_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 postgresql-client
COPY readiness_check /readiness_check
COPY test_scripts/curl/cli /cli
@@ -114,12 +113,14 @@ COPY owprov.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=owprov-build /owprov/cmake-build/owprov /openwifi/owprov
COPY --from=cppkafka-build /cppkafka/cmake-build/src/lib/* /usr/local/lib
COPY --from=poco-build /poco/cmake-build/lib/* /usr/local/lib
RUN ldconfig
EXPOSE 16005 17005 16105
ENTRYPOINT ["/docker-entrypoint.sh"]

2
build
View File

@@ -1 +1 @@
19
28

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -e
if [ "$SELFSIGNED_CERTS" = 'true' ]; then
@@ -49,7 +49,7 @@ if [ "$1" = '/openwifi/owprov' -a "$(id -u)" = '0' ]; then
if [ "$RUN_CHOWN" = 'true' ]; then
chown -R "$OWPROV_USER": "$OWPROV_ROOT" "$OWPROV_CONFIG"
fi
exec su-exec "$OWPROV_USER" "$@"
exec gosu "$OWPROV_USER" "$@"
fi
exec "$@"

View File

@@ -131,8 +131,10 @@ spec:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.securityContext }}
securityContext:
fsGroup: 101
{{- toYaml . | nindent 8 }}
{{- end }}
imagePullSecrets:
{{- range $image, $imageValue := .Values.images }}

View File

@@ -9,7 +9,7 @@ fullnameOverride: ""
images:
owprov:
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owprov
tag: v2.7.0-RC2
tag: v2.7.0-RC6
pullPolicy: Always
# regcred:
# registry: tip-tip-wlan-cloud-ucentral.jfrog.io
@@ -91,6 +91,9 @@ resources: {}
# cpu: 100m
# memory: 128Mi
securityContext:
fsGroup: 1000
nodeSelector: {}
tolerations: []

View File

@@ -73,17 +73,25 @@ namespace OpenWifi {
}
int main(int argc, char **argv) {
try {
auto App = OpenWifi::Daemon::instance();
auto ExitCode = App->run(argc, argv);
delete App;
int ExitCode;
try {
Poco::Net::SSLManager::instance().initializeServer(nullptr, nullptr, nullptr);
auto App = OpenWifi::Daemon::instance();
ExitCode = App->run(argc, argv);
Poco::Net::SSLManager::instance().shutdown();
} catch (Poco::Exception &exc) {
ExitCode = Poco::Util::Application::EXIT_SOFTWARE;
std::cout << exc.displayText() << std::endl;
} catch (std::exception &exc) {
ExitCode = Poco::Util::Application::EXIT_TEMPFAIL;
std::cout << exc.what() << std::endl;
} catch (...) {
ExitCode = Poco::Util::Application::EXIT_TEMPFAIL;
std::cout << "Exception on closure" << std::endl;
}
return ExitCode;
} catch (Poco::Exception &exc) {
std::cerr << exc.displayText() << std::endl;
return Poco::Util::Application::EXIT_SOFTWARE;
}
std::cout << "Exitcode: " << ExitCode << std::endl;
return ExitCode;
}
// end of namespace

View File

@@ -96,8 +96,10 @@ using namespace std::chrono_literals;
#include "Poco/NObserver.h"
#include "Poco/Net/SocketNotification.h"
#include "Poco/Base64Decoder.h"
#include "Poco/ThreadLocal.h"
#include "cppkafka/cppkafka.h"
#include "framework/MicroServiceErrorHandler.h"
#include "framework/OpenWifiTypes.h"
#include "framework/KafkaTopics.h"
#include "framework/ow_constants.h"
@@ -667,6 +669,19 @@ namespace OpenWifi::RESTAPI_utils {
namespace OpenWifi::Utils {
inline bool NormalizeMac(std::string & Mac) {
Poco::replaceInPlace(Mac,":","");
Poco::replaceInPlace(Mac,"-","");
if(Mac.size()!=12)
return false;
for(const auto &i:Mac) {
if(!std::isxdigit(i))
return false;
}
Poco::toLowerInPlace(Mac);
return true;
}
inline void SetThreadName(const char *name) {
#ifdef __linux__
Poco::Thread::current()->setName(name);
@@ -1346,28 +1361,6 @@ namespace OpenWifi {
Poco::ExpireLRUCache<KeyType,Record> Cache_{Size,Expiry};
};
class MyErrorHandler : public Poco::ErrorHandler {
public:
explicit MyErrorHandler(Poco::Util::Application &App) : App_(App) {}
inline void exception(const Poco::Exception & E) {
Poco::Thread * CurrentThread = Poco::Thread::current();
App_.logger().log(E);
poco_error(App_.logger(), fmt::format("Exception occurred in {}",CurrentThread->getName()));
}
inline void exception(const std::exception & E) {
Poco::Thread * CurrentThread = Poco::Thread::current();
poco_warning(App_.logger(), fmt::format("std::exception in {}: {}",CurrentThread->getName(),E.what()));
}
inline void exception() {
Poco::Thread * CurrentThread = Poco::Thread::current();
poco_warning(App_.logger(), fmt::format("exception in {}",CurrentThread->getName()));
}
private:
Poco::Util::Application &App_;
};
class BusEventManager : public Poco::Runnable {
public:
explicit BusEventManager(Poco::Logger &L) : Logger_(L) {
@@ -3082,7 +3075,7 @@ namespace OpenWifi {
private:
std::vector<std::unique_ptr<Poco::Net::HTTPServer>> RESTServers_;
Poco::ThreadPool Pool_{"x-rest",4,128};
Poco::ThreadPool Pool_{"x-rest",8,128};
RESTAPI_GenericServer Server_;
RESTAPI_ExtServer() noexcept:
@@ -3099,15 +3092,16 @@ namespace OpenWifi {
inline Poco::Net::HTTPRequestHandler *createRequestHandler(const Poco::Net::HTTPServerRequest &Request) override {
try {
Poco::URI uri(Request.getURI());
Utils::SetThreadName(fmt::format("x-rest:{}",TransactionId_).c_str());
return RESTAPI_ExtServer()->CallServer(uri.getPath(), TransactionId_++);
auto TID = NextTransactionId_++;
Utils::SetThreadName(fmt::format("x-rest:{}",TID).c_str());
return RESTAPI_ExtServer()->CallServer(uri.getPath(), TID);
} catch (...) {
}
return nullptr;
}
private:
static inline std::atomic_uint64_t TransactionId_ = 1;
static inline std::atomic_uint64_t NextTransactionId_ = 1;
};
class LogMuxer : public Poco::Channel {
@@ -3215,7 +3209,7 @@ namespace OpenWifi {
const Poco::ThreadPool & Pool() { return Pool_; }
private:
std::vector<std::unique_ptr<Poco::Net::HTTPServer>> RESTServers_;
Poco::ThreadPool Pool_{"i-rest",4,96};
Poco::ThreadPool Pool_{"i-rest",4,64};
RESTAPI_GenericServer Server_;
RESTAPI_IntServer() noexcept:
@@ -3230,12 +3224,13 @@ namespace OpenWifi {
public:
inline IntRequestHandlerFactory() = default;
inline Poco::Net::HTTPRequestHandler *createRequestHandler(const Poco::Net::HTTPServerRequest &Request) override {
Utils::SetThreadName(fmt::format("i-rest:{}",TransactionId_).c_str());
auto TID=NextTransactionId_++;
Utils::SetThreadName(fmt::format("i-rest:{}",TID).c_str());
Poco::URI uri(Request.getURI());
return RESTAPI_IntServer()->CallServer(uri.getPath(), TransactionId_);
return RESTAPI_IntServer()->CallServer(uri.getPath(), TID);
}
private:
static inline std::atomic_uint64_t TransactionId_ = 1;
static inline std::atomic_uint64_t NextTransactionId_ = 1;
};
struct MicroServiceMeta {
@@ -3411,7 +3406,7 @@ namespace OpenWifi {
bool NoBuiltInCrypto_=false;
Poco::JWT::Signer Signer_;
Poco::Logger &Logger_;
Poco::ThreadPool TimerPool_{"timer:pool",2,16};
Poco::ThreadPool TimerPool_{"timer:pool",2,32};
std::unique_ptr<BusEventManager> BusEventManager_;
};
@@ -3576,7 +3571,7 @@ namespace OpenWifi {
auto LoggingDestination = MicroService::instance().ConfigGetString("logging.type", "file");
auto LoggingFormat = MicroService::instance().ConfigGetString("logging.format",
"%Y-%m-%d %H:%M:%S %s: [%p] %t");
"%Y-%m-%d %H:%M:%S.%i %s: [%p][thr:%I] %t");
if (LoggingDestination == "console") {
Poco::AutoPtr<Poco::ConsoleChannel> Console(new Poco::ConsoleChannel);
Poco::AutoPtr<Poco::AsyncChannel> Async(new Poco::AsyncChannel(Console));
@@ -3607,14 +3602,14 @@ namespace OpenWifi {
FileChannel->setProperty("archive", "timestamp");
FileChannel->setProperty("path", LoggingLocation);
Poco::AutoPtr<Poco::AsyncChannel> Async_File(new Poco::AsyncChannel(FileChannel));
Poco::AutoPtr<Poco::AsyncChannel> Async_Muxer(new Poco::AsyncChannel(LogMuxer()));
Poco::AutoPtr<Poco::SplitterChannel> Splitter(new Poco::SplitterChannel);
Splitter->addChannel(Async_File);
Splitter->addChannel(Async_Muxer);
// Poco::AutoPtr<Poco::AsyncChannel> Async_Muxer(new Poco::AsyncChannel(LogMuxer()));
// Poco::AutoPtr<Poco::SplitterChannel> Splitter(new Poco::SplitterChannel);
// Splitter->addChannel(Async_File);
// Splitter->addChannel(Async_Muxer);
Poco::AutoPtr<Poco::PatternFormatter> Formatter(new Poco::PatternFormatter);
Formatter->setProperty("pattern", LoggingFormat);
Poco::AutoPtr<Poco::FormattingChannel> FormattingChannel(
new Poco::FormattingChannel(Formatter, Splitter));
new Poco::FormattingChannel(Formatter, Async_File));
Poco::Logger::root().setChannel(FormattingChannel);
}
auto Level = Poco::Logger::parseLevel(MicroService::instance().ConfigGetString("logging.level", "debug"));
@@ -3963,8 +3958,6 @@ namespace OpenWifi {
}
Poco::Net::HTTPServerParams::Ptr Params = new Poco::Net::HTTPServerParams;
Params->setMaxThreads(50);
Params->setMaxQueued(200);
Params->setKeepAlive(true);
Params->setName("ws:xrest");
@@ -3999,8 +3992,6 @@ namespace OpenWifi {
}
auto Params = new Poco::Net::HTTPServerParams;
Params->setMaxThreads(50);
Params->setMaxQueued(200);
Params->setKeepAlive(true);
Params->setName("ws:irest");
@@ -4020,7 +4011,7 @@ namespace OpenWifi {
}
inline int MicroService::main([[maybe_unused]] const ArgVec &args) {
MyErrorHandler ErrorHandler(*this);
MicroServiceErrorHandler ErrorHandler(*this);
Poco::ErrorHandler::set(&ErrorHandler);
if (!HelpRequested_) {
@@ -5100,7 +5091,7 @@ namespace OpenWifi {
auto Op = flags & Poco::Net::WebSocket::FRAME_OP_BITMASK;
if (n == 0) {
poco_warning(Logger(),Poco::format("CLOSE(%s): %s UI Client is closing WS connection.", Id_, UserName_));
poco_debug(Logger(),fmt::format("CLOSE({}): {} UI Client is closing WS connection.", Id_, UserName_));
return delete this;
}
@@ -5113,7 +5104,7 @@ namespace OpenWifi {
case Poco::Net::WebSocket::FRAME_OP_PONG: {
} break;
case Poco::Net::WebSocket::FRAME_OP_CLOSE: {
poco_warning(Logger(),Poco::format("CLOSE(%s): %s UI Client is closing WS connection.", Id_, UserName_));
poco_debug(Logger(),fmt::format("CLOSE({}): {} UI Client is closing WS connection.", Id_, UserName_));
Done = true;
} break;
case Poco::Net::WebSocket::FRAME_OP_TEXT: {
@@ -5126,7 +5117,7 @@ namespace OpenWifi {
AuthClient()->IsAuthorized(Tokens[1], UserInfo_, 0, Expired, Contacted)) {
Authenticated_ = true;
UserName_ = UserInfo_.userinfo.email;
poco_warning(Logger(),Poco::format("START(%s): %s UI Client is starting WS connection.", Id_, UserName_));
poco_debug(Logger(),fmt::format("START({}): {} UI Client is starting WS connection.", Id_, UserName_));
std::string S{"Welcome! Bienvenue! Bienvenidos!"};
WS_->sendFrame(S.c_str(), S.size());
WebSocketClientServer()->SetUser(Id_, UserInfo_.userinfo.email);
@@ -5212,7 +5203,6 @@ namespace OpenWifi {
Poco::Net::ErrorNotification>(*this,&WebSocketClient::OnSocketError));
(*WS_).shutdown();
(*WS_).close();
WebSocketClientServer()->UnRegister(Id_);
} catch(...) {
}

View File

@@ -0,0 +1,169 @@
//
// Created by stephane bourque on 2022-09-29.
//
#pragma once
#include "fmt/format.h"
#include "Poco/Util/Application.h"
#include "Poco/ErrorHandler.h"
#include "Poco/Net/NetException.h"
#include "Poco/Net/SSLException.h"
#include "Poco/JSON/Template.h"
#include "Poco/Thread.h"
namespace OpenWifi {
class MicroServiceErrorHandler : public Poco::ErrorHandler {
public:
explicit MicroServiceErrorHandler(Poco::Util::Application &App) : App_(App) {
}
inline void exception(const Poco::Exception & Base) override {
try {
if(Poco::Thread::current()!= nullptr) {
t_name = Poco::Thread::current()->getName();
t_id = Poco::Thread::current()->id();
} else {
t_name = "startup_code";
t_id = 0;
}
App_.logger().log(Base);
Base.rethrow();
} catch (const Poco::Net::InvalidCertificateException &E) {
poco_error(App_.logger(), fmt::format("Poco::Net::InvalidCertificateException thr_name={} thr_id={} code={} text={} msg={} what={}",
t_name, t_id, E.code(),
E.displayText(),
E.message(),
E.what()));
} catch (const Poco::Net::InvalidSocketException &E) {
poco_error(App_.logger(), fmt::format("Poco::Net::InvalidSocketException thr_name={} thr_id={} code={} text={} msg={} what={}",
t_name, t_id, E.code(),
E.displayText(),
E.message(),
E.what()));
} catch (const Poco::Net::WebSocketException &E) {
poco_error(App_.logger(), fmt::format("Poco::Net::WebSocketException thr_name={} thr_id={} code={} text={} msg={} what={}",
t_name, t_id, E.code(),
E.displayText(),
E.message(),
E.what()));
} catch (const Poco::Net::ConnectionResetException &E) {
poco_error(App_.logger(), fmt::format("Poco::Net::ConnectionResetException thr_name={} thr_id={} code={} text={} msg={} what={}",
t_name, t_id, E.code(),
E.displayText(),
E.message(),
E.what()));
} catch (const Poco::Net::CertificateValidationException &E) {
poco_error(App_.logger(), fmt::format("Poco::Net::CertificateValidationException thr_name={} thr_id={} code={} text={} msg={} what={}",
t_name, t_id, E.code(),
E.displayText(),
E.message(),
E.what()));
} catch (const Poco::Net::SSLConnectionUnexpectedlyClosedException &E) {
poco_error(App_.logger(), fmt::format("Poco::Net::SSLConnectionUnexpectedlyClosedException thr_name={} thr_id={} code={} text={} msg={} what={}",
t_name, t_id, E.code(),
E.displayText(),
E.message(),
E.what()));
} catch (const Poco::Net::SSLContextException &E) {
poco_error(App_.logger(), fmt::format("Poco::Net::SSLContextException thr_name={} thr_id={} code={} text={} msg={} what={}",
t_name, t_id, E.code(),
E.displayText(),
E.message(),
E.what()));
} catch (const Poco::Net::SSLException &E) {
poco_error(App_.logger(), fmt::format("Poco::Net::SSLException thr_name={} thr_id={} code={} text={} msg={} what={}",
t_name, t_id, E.code(),
E.displayText(),
E.message(),
E.what()));
} catch (const Poco::Net::InvalidAddressException &E) {
poco_error(App_.logger(), fmt::format("Poco::Net::InvalidAddressException thr_name={} thr_id={} code={} text={} msg={} what={}",
t_name, t_id, E.code(),
E.displayText(),
E.message(),
E.what()));
} catch (const Poco::Net::NetException &E) {
poco_error(App_.logger(), fmt::format("Poco::Net::NetException thr_name={} thr_id={} code={} text={} msg={} what={}",
t_name, t_id, E.code(),
E.displayText(),
E.message(),
E.what()));
} catch (const Poco::IOException &E) {
poco_error(App_.logger(), fmt::format("Poco::IOException thr_name={} thr_id={} code={} text={} msg={} what={}",
t_name, t_id, E.code(),
E.displayText(),
E.message(),
E.what()));
} catch (const Poco::RuntimeException &E) {
poco_error(App_.logger(), fmt::format("Poco::RuntimeException thr_name={} thr_id={} code={} text={} msg={} what={}",
t_name, t_id, E.code(),
E.displayText(),
E.message(),
E.what()));
} catch (const Poco::JSON::JSONTemplateException &E) {
poco_error(App_.logger(), fmt::format("Poco::JSON::JSONTemplateException thr_name={} thr_id={} code={} text={} msg={} what={}",
t_name, t_id, E.code(),
E.displayText(),
E.message(),
E.what()));
} catch (const Poco::JSON::JSONException &E) {
poco_error(App_.logger(), fmt::format("Poco::JSON::JSONException thr_name={} thr_id={} code={} text={} msg={} what={}",
t_name, t_id, E.code(),
E.displayText(),
E.message(),
E.what()));
} catch (const Poco::ApplicationException &E) {
poco_error(App_.logger(), fmt::format("Poco::ApplicationException thr_name={} thr_id={} code={} text={} msg={} what={}",
t_name, t_id, E.code(),
E.displayText(),
E.message(),
E.what()));
} catch (const Poco::Exception &E) {
poco_error(App_.logger(), fmt::format("Poco::Exception thr_name={} thr_id={} code={} text={} msg={} what={}",
t_name, t_id, E.code(),
E.displayText(),
E.message(),
E.what()));
} catch (...) {
poco_error(App_.logger(), fmt::format("Poco:Generic thr_name={}",t_name, t_id));
}
}
inline void exception(const std::exception & E) override {
if(Poco::Thread::current()!= nullptr) {
t_name = Poco::Thread::current()->getName();
t_id = Poco::Thread::current()->id();
} else {
t_name = "startup_code";
t_id = 0;
}
poco_warning(App_.logger(), fmt::format("std::exception in {}: {} thr_id={}",
t_name,E.what(),
t_id));
}
inline void exception() override {
if(Poco::Thread::current()!= nullptr) {
t_name = Poco::Thread::current()->getName();
t_id = Poco::Thread::current()->id();
} else {
t_name = "startup_code";
t_id = 0;
}
poco_warning(App_.logger(), fmt::format("generic exception in {} thr_id={}",
t_name, t_id));
}
private:
Poco::Util::Application &App_;
std::string t_name;
int t_id=0;
};
}

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# wait-for-postgres.sh
set -e
@@ -20,7 +20,7 @@ if [ "$1" = '/openwifi/owprov' -a "$(id -u)" = '0' ]; then
if [ "$RUN_CHOWN" = 'true' ]; then
chown -R "$OWPROV_USER": "$OWPROV_ROOT" "$OWPROV_CONFIG"
fi
exec su-exec "$OWPROV_USER" "$@"
exec gosu "$OWPROV_USER" "$@"
fi
exec "$@"