Skip to content
This repository was archived by the owner on Jun 7, 2026. It is now read-only.

Commit 3a7410e

Browse files
committed
Upload debug file information
1 parent efd9bb8 commit 3a7410e

3 files changed

Lines changed: 41 additions & 4 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,28 @@ jobs:
2020
steps:
2121
- name: Checkout repository
2222
uses: actions/checkout@v4
23+
2324
- name: Install cosign
2425
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
2526
with:
2627
cosign-release: 'v2.2.4'
28+
2729
- name: Set up Docker Buildx
2830
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
31+
2932
- name: Log into registry ${{ env.REGISTRY }}
3033
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
3134
with:
3235
registry: ${{ env.REGISTRY }}
3336
username: ${{ github.actor }}
3437
password: ${{ secrets.GITHUB_TOKEN }}
38+
3539
- name: Extract Docker metadata
3640
id: meta
3741
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
3842
with:
3943
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
44+
4045
- name: Build and push Docker image
4146
id: build-and-push
4247
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
@@ -47,11 +52,30 @@ jobs:
4752
labels: ${{ steps.meta.outputs.labels }}
4853
cache-from: type=gha
4954
cache-to: type=gha,mode=max
55+
5056
- name: Sign the published Docker image
5157
env:
5258
TAGS: ${{ steps.meta.outputs.tags }}
5359
DIGEST: ${{ steps.build-and-push.outputs.digest }}
5460
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
61+
62+
- name: Build debug image
63+
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
64+
with:
65+
push: false
66+
target: build
67+
tags: sinytra/mm_wiki_debug
68+
69+
- name: Upload to sentry
70+
env:
71+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
72+
run: |
73+
docker run --rm -e SENTRY_AUTH_TOKEN -e SENTRY_ORG -e SENTRY_PROJECT sinytra/mm_wiki_debug /bin/bash -c "
74+
sentry-cli debug-files upload --include-sources build/bin/wiki_service build/bin/wiki_service.debug
75+
LIBS=\$(ldd build/bin/wiki_service | awk '/=>/ {print \$3}' | grep '^/')
76+
sentry-cli debug-files upload --include-sources \$LIBS
77+
"
78+
5579
deploy:
5680
name: Deploy to server
5781
runs-on: ubuntu-latest

Dockerfile

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ RUN apt-get update && apt-get install -y \
77
cmake git gcc g++ ninja-build \
88
uuid-dev zlib1g-dev libc-ares-dev libbrotli-dev \
99
postgresql-all libhiredis-dev libspdlog-dev libzip-dev \
10-
libcurl4-openssl-dev
10+
libcurl4-openssl-dev curl binutils
11+
12+
# Install Sentry CLI
13+
RUN curl -sL https://sentry.io/get-cli/ | sh
1114

1215
# Build and install jsoncpp
1316
RUN git clone https://github.com/open-source-parsers/jsoncpp && cd jsoncpp && git checkout 1.9.6 \
@@ -22,16 +25,25 @@ RUN git clone https://github.com/drogonframework/drogon && cd drogon && git subm
2225
# Build app
2326
WORKDIR /build/src
2427

25-
COPY $PWD /build/src
28+
COPY $PWD/.git /build/src/.git
29+
COPY $PWD/builtin /build/src/builtin
30+
COPY $PWD/modules /build/src/modules
31+
COPY $PWD/src /build/src/src
32+
COPY $PWD/CMakeLists.txt /build/src/
33+
34+
RUN cmake -S . -B build -G "Ninja" && cmake --build build --config RelWithDebInfo
2635

27-
RUN cmake -S . -B build -G "Ninja" && cmake --build build --config Release
36+
# Extract debug info
37+
RUN objcopy --only-keep-debug --compress-debug-sections=zlib build/bin/wiki_service build/bin/wiki_service.debug \
38+
&& objcopy --strip-debug --strip-unneeded build/bin/wiki_service \
39+
&& objcopy --add-gnu-debuglink=build/bin/wiki_service.debug build/bin/wiki_service
2840

2941
FROM debian:sid-slim AS main
3042

3143
WORKDIR /app
3244

3345
RUN apt-get update && apt-get install -y ca-certificates libspdlog-dev libc-ares-dev libfmt10 libbrotli-dev \
34-
libhiredis-dev libpq5 libzip-dev
46+
libhiredis-dev libpq5 libzip-dev curl
3547

3648
COPY --from=build /build/src/build/bin/wiki_service /build/src/build/bin/crashpad_handler /app/
3749

src/monitoring.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace monitoring {
1313
sentry_options_set_release(options, PROJECT_GIT_HASH_FULL);
1414
#endif
1515
sentry_options_set_debug(options, 1);
16+
sentry_options_set_crashpad_wait_for_upload(options, true);
1617
sentry_init(options);
1718
}
1819

0 commit comments

Comments
 (0)