fix cobra to sentry + change ws docker file to use alpine (much smaller footprint)
This commit is contained in:
parent
c65fec7271
commit
285386e47f
@ -1,3 +1,4 @@
|
||||
build
|
||||
CMakeCache.txt
|
||||
ws/CMakeCache.txt
|
||||
test/build
|
||||
|
@ -1 +1 @@
|
||||
2.0.0
|
||||
2.2.1
|
||||
|
@ -1 +1 @@
|
||||
docker/Dockerfile.ubuntu_xenial
|
||||
docker/Dockerfile.alpine
|
33
docker/Dockerfile.alpine
Normal file
33
docker/Dockerfile.alpine
Normal file
@ -0,0 +1,33 @@
|
||||
FROM alpine as build
|
||||
|
||||
RUN apk add --no-cache gcc g++ musl-dev linux-headers cmake openssl-dev
|
||||
RUN apk add --no-cache make
|
||||
RUN apk add --no-cache zlib-dev
|
||||
|
||||
RUN addgroup -S app && adduser -S -G app app
|
||||
RUN chown -R app:app /opt
|
||||
RUN chown -R app:app /usr/local
|
||||
|
||||
# There is a bug in CMake where we cannot build from the root top folder
|
||||
# So we build from /opt
|
||||
COPY --chown=app:app . /opt
|
||||
WORKDIR /opt
|
||||
|
||||
USER app
|
||||
RUN [ "make" ]
|
||||
|
||||
FROM alpine as runtime
|
||||
|
||||
RUN apk add --no-cache libstdc++
|
||||
|
||||
RUN addgroup -S app && adduser -S -G app app
|
||||
COPY --chown=app:app --from=build /usr/local/bin/ws /usr/local/bin/ws
|
||||
RUN chmod +x /usr/local/bin/ws
|
||||
RUN ldd /usr/local/bin/ws
|
||||
|
||||
# Now run in usermode
|
||||
USER app
|
||||
WORKDIR /home/app
|
||||
|
||||
ENTRYPOINT ["ws"]
|
||||
CMD ["--help"]
|
5
makefile
5
makefile
@ -25,6 +25,9 @@ IMG := ${NAME}:${TAG}
|
||||
LATEST := ${NAME}:latest
|
||||
BUILD := ${NAME}:build
|
||||
|
||||
docker_test:
|
||||
docker build -f docker/Dockerfile.debian -t bsergean/ixwebsocket_test:build .
|
||||
|
||||
docker:
|
||||
docker build -t ${IMG} .
|
||||
docker tag ${IMG} ${BUILD}
|
||||
@ -34,7 +37,7 @@ docker_push:
|
||||
docker push ${LATEST}
|
||||
|
||||
run:
|
||||
docker run --cap-add sys_ptrace --entrypoint=bash -it bsergean/ws:build
|
||||
docker run --cap-add sys_ptrace --entrypoint=sh -it bsergean/ws:build
|
||||
|
||||
# this is helpful to remove trailing whitespaces
|
||||
trail:
|
||||
|
@ -427,6 +427,7 @@ TEST_CASE("Websocket_ping_no_data_sent_setHeartBeatPeriod", "[setHeartBeatPeriod
|
||||
REQUIRE(server.getClients().size() == 0);
|
||||
|
||||
ix::reportWebSocketTraffic();
|
||||
server.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@ -477,5 +478,6 @@ TEST_CASE("Websocket_ping_data_sent_setHeartBeatPeriod", "[setHeartBeatPeriod]")
|
||||
REQUIRE(server.getClients().size() == 0);
|
||||
|
||||
ix::reportWebSocketTraffic();
|
||||
server.stop();
|
||||
}
|
||||
}
|
||||
|
@ -99,6 +99,18 @@ namespace ix
|
||||
return frames;
|
||||
}
|
||||
|
||||
std::string parseExceptionName(const std::string& stack)
|
||||
{
|
||||
// Split by lines
|
||||
std::string line;
|
||||
std::stringstream tokenStream(stack);
|
||||
|
||||
// Extract the first line
|
||||
std::getline(tokenStream, line);
|
||||
|
||||
return line;
|
||||
}
|
||||
|
||||
std::string SentryClient::computePayload(const Json::Value& msg)
|
||||
{
|
||||
Json::Value payload;
|
||||
@ -107,14 +119,14 @@ namespace ix
|
||||
payload["sdk"]["version"] = "1.0.0";
|
||||
payload["timestamp"] = SentryClient::getIso8601();
|
||||
|
||||
bool isNoisyTypes = msg["id"].asString() == "game_noisytypes_id";
|
||||
|
||||
std::string stackTraceFieldName = isNoisyTypes ? "traceback" : "stack";
|
||||
std::string stack(msg["data"][stackTraceFieldName].asString());
|
||||
|
||||
Json::Value exception;
|
||||
exception["value"] = msg["data"]["message"];
|
||||
|
||||
std::string stackTraceFieldName =
|
||||
(msg["id"].asString() == "game_noisytypes_id") ? "traceback" : "stack";
|
||||
|
||||
exception["stacktrace"]["frames"] =
|
||||
parseLuaStackTrace(msg["data"][stackTraceFieldName].asString());
|
||||
exception["stacktrace"]["frames"] = parseLuaStackTrace(stack);
|
||||
exception["value"] = isNoisyTypes ? parseExceptionName(stack) : msg["data"]["message"];
|
||||
|
||||
payload["exception"].append(exception);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user