Commit a6d2d8f9 authored by jan.koester's avatar jan.koester
Browse files

test

parent 492ec594
Loading
Loading
Loading
Loading
Loading
+76 −0
Changes for test/docker/Dockerfile.debug: 76 added lines, 0 removed lines.
Original line number Diff line number Diff line
FROM node:alpine AS build
WORKDIR /build

RUN apk update --no-cache && apk upgrade --no-cache
RUN apk add --no-cache cmake ninja clang alpine-sdk yaml-dev brotli-dev json-c-dev util-linux-dev

# Build all libraries with debug symbols and no optimization
ENV CXXFLAGS="-g -O0 -fno-omit-frame-pointer"
ENV CFLAGS="-g -O0 -fno-omit-frame-pointer"

RUN git clone https://tuxist.de/git/jan.koester/libcmdplus.git && \
    mkdir libcmdplus/build && \
    cd libcmdplus/build && cmake ../ -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fPIC -g -O0" && ninja install

RUN git clone https://tuxist.de/git/tuxist/uuidplus.git && \
    mkdir uuidplus/build && \
    cd uuidplus/build && cmake ../ -G Ninja -DCMAKE_BUILD_TYPE=Debug && ninja install

RUN git clone https://tuxist.de/git/jan.koester/libnetplus.git && \
    mkdir libnetplus/build && \
    cd libnetplus/build && cmake ../ -G Ninja -DCMAKE_BUILD_TYPE=Debug && ninja install

RUN git clone https://tuxist.de/git/jan.koester/libhtmlpp.git && \
    mkdir libhtmlpp/build && \
    cd libhtmlpp/build && cmake ../ -G Ninja -DCMAKE_BUILD_TYPE=Debug && ninja install

RUN git clone https://tuxist.de/git/jan.koester/libhttppp.git && \
    mkdir libhttppp/build && \
    cd libhttppp/build && cmake ../ -G Ninja -DCMAKE_BUILD_TYPE=Debug && ninja install

RUN git clone https://tuxist.de/git/jan.koester/libconfplus.git && \
    mkdir libconfplus/build && \
    cd libconfplus/build && cmake ../ -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fPIC -g -O0" && ninja install

RUN git clone https://tuxist.de/git/tuxist/libparitypp.git && \
    mkdir libparitypp/build && \
    cd libparitypp/build && cmake ../ -G Ninja -DCMAKE_BUILD_TYPE=Debug && ninja install

RUN git clone https://tuxist.de/git/jan.koester/authdb.git && \
    mkdir authdb/build && \
    cd authdb/build && cmake ../ -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBUILD_BINDINGS=OFF -DDATAPATH:PATH=/usr/local/share/authdb && ninja install

# --- Runtime stage (keep debug tools) ---
FROM node:alpine

RUN addgroup authdb && \
    adduser authdb -h /var/lib/authdb -S -G authdb

RUN apk update && apk upgrade && \
    apk add --no-cache yaml brotli openssl json-c libuuid libstdc++ \
    gdb musl-dbg libstdc++-dev

RUN mkdir -p /etc/authdb/certs /var/lib/authdb /usr/local/share/authdb /var/log/authdb && \
    chown -R authdb:authdb /var/lib/authdb /var/log/authdb

COPY --from=build /usr/local/bin/authdb /usr/local/bin/
COPY --from=build /usr/local/lib /usr/local/lib/
COPY --from=build /usr/local/lib/authdb /usr/local/lib/authdb
COPY --from=build /usr/local/share/authdb /usr/local/share/authdb

# Copy source trees so GDB can show source lines
COPY --from=build /build /build

EXPOSE 9090 4433

# Run under GDB: on crash, print backtrace and exit
CMD ["gdb", "-batch", \
     "-ex", "set confirm off", \
     "-ex", "set pagination off", \
     "-ex", "handle SIGPIPE nostop noprint pass", \
     "-ex", "run", \
     "-ex", "bt full", \
     "-ex", "info threads", \
     "-ex", "thread apply all bt full", \
     "-ex", "quit 1", \
     "--args", "authdb", "-f", "true", "-c", "yaml:///etc/authdb/config.yaml"]
+59 −0
Changes for test/docker/docker-compose.debug.yml: 59 added lines, 0 removed lines.
Original line number Diff line number Diff line
services:
  node1:
    build:
      context: .
      dockerfile: Dockerfile.debug
    container_name: node1
    hostname: node1
    # SYS_PTRACE is required for GDB to attach/trace inside the container
    cap_add:
      - SYS_PTRACE
    security_opt:
      - seccomp:unconfined
    volumes:
      - ./config-node1.yaml:/etc/authdb/config.yaml:ro
      - ./certs:/etc/authdb/certs:ro
    ports:
      - "9091:9090"
    networks:
      - cluster

  node2:
    build:
      context: .
      dockerfile: Dockerfile.debug
    container_name: node2
    hostname: node2
    cap_add:
      - SYS_PTRACE
    security_opt:
      - seccomp:unconfined
    volumes:
      - ./config-node2.yaml:/etc/authdb/config.yaml:ro
      - ./certs:/etc/authdb/certs:ro
    ports:
      - "9092:9090"
    networks:
      - cluster

  node3:
    build:
      context: .
      dockerfile: Dockerfile.debug
    container_name: node3
    hostname: node3
    cap_add:
      - SYS_PTRACE
    security_opt:
      - seccomp:unconfined
    volumes:
      - ./config-node3.yaml:/etc/authdb/config.yaml:ro
      - ./certs:/etc/authdb/certs:ro
    ports:
      - "9093:9090"
    networks:
      - cluster

networks:
  cluster:
    driver: bridge

test/docker/file.png

0 → 100644
+332 KiB
Loading image diff...