Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ project(OpenLogReplicator

set(SCHEMA_VERSION "1.9.0")
string(TIMESTAMP CMAKE_BUILD_TIMESTAMP "%Y-%m-%d %H:%M" UTC)
if(NOT DEFINED OLR_VERSION OR OLR_VERSION STREQUAL "")
execute_process(
COMMAND git describe --tags --always --dirty
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE OLR_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
endif()
if(NOT DEFINED OLR_VERSION OR OLR_VERSION STREQUAL "")
set(OLR_VERSION "${PROJECT_VERSION}")
endif()
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS FALSE)
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ ARG GIDOLR=1001
ARG UIDOLR=1001
ARG GIDORA=54322
ARG BUILD_TYPE=Debug
ARG OLR_VERSION
ARG WITHKAFKA
ARG WITHPROMETHEUS
ARG WITHORACLE
Expand Down Expand Up @@ -137,7 +138,7 @@ RUN --mount=type=cache,target=/root/.ccache,id=olr-ccache \
fi && \
mkdir cmake-build-${BUILD_TYPE}-${ARCH} && \
cd cmake-build-${BUILD_TYPE}-${ARCH} && \
cmake ${BUILDARGS} \
cmake ${BUILDARGS} ${OLR_VERSION:+-DOLR_VERSION=${OLR_VERSION}} \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache && \
cmake --build ./ --target OpenLogReplicator -j && \
Expand Down
9 changes: 6 additions & 3 deletions Dockerfile.release
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
# Produces a minimal runtime image with only the OLR binary and shared libs.
#
# Usage:
# OLR_VERSION=$(git describe --tags --always --dirty)
# docker buildx build -f Dockerfile.release \
# --build-arg OLR_VERSION=$OLR_VERSION \
# --build-arg GIDOLR=$(id -g) --build-arg UIDOLR=$(id -u) \
# --build-arg WITHORACLE=1 --build-arg WITHKAFKA=1 \
# --build-arg WITHPROTOBUF=1 --build-arg WITHPROMETHEUS=1 \
# -t rophy/openlogreplicator:latest .
# -t rophy/openlogreplicator:$OLR_VERSION .

ARG IMAGE=debian
ARG VERSION=13.0
Expand All @@ -21,6 +23,7 @@ FROM ${IMAGE}:${VERSION} AS builder

ARG ARCH=x86_64
ARG BUILD_TYPE=Release
ARG OLR_VERSION
ARG WITHKAFKA
ARG WITHPROMETHEUS
ARG WITHORACLE
Expand Down Expand Up @@ -50,7 +53,7 @@ ENV DEBIAN_FRONTEND=noninteractive
# System packages
RUN set -eu && \
apt-get update && \
apt-get -y install --no-install-recommends file gcc g++ libaio1t64 libasan8 libubsan1 libtool libz-dev make patch unzip wget cmake git curl && \
apt-get -y install --no-install-recommends ca-certificates file gcc g++ libaio1t64 libasan8 libubsan1 libtool libz-dev make patch unzip wget cmake git curl && \
ln -s libaio.so.1t64 /usr/lib/x86_64-linux-gnu/libaio.so.1

# RapidJSON (header-only, not needed at runtime)
Expand Down Expand Up @@ -136,7 +139,7 @@ RUN set -eu && \
fi && \
mkdir cmake-build-${BUILD_TYPE}-${ARCH} && \
cd cmake-build-${BUILD_TYPE}-${ARCH} && \
cmake ${BUILDARGS} && \
cmake ${BUILDARGS} ${OLR_VERSION:+-DOLR_VERSION=${OLR_VERSION}} && \
cmake --build ./ --target OpenLogReplicator -j

# Stage runtime libs into a single directory for clean COPY into runtime stage
Expand Down
19 changes: 17 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
OLR_IMAGE ?= olr-dev:latest
CACHE_IMAGE ?= ghcr.io/bersler/openlogreplicator:ci
BUILD_TYPE ?= Debug
OLR_VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo unknown)

FIXTURE_ARCHIVES := $(wildcard tests/fixtures/*.tar.gz)
FIXTURE_DIRS := $(FIXTURE_ARCHIVES:.tar.gz=)

.PHONY: help build test-redo extract-fixtures fixtures clean
.PHONY: help build build-release test-redo extract-fixtures fixtures clean

help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'

build: ## Build OLR Docker image
build: ## Build OLR dev image (Debug)
docker buildx build \
--build-arg BUILD_TYPE=$(BUILD_TYPE) \
--build-arg OLR_VERSION=$(OLR_VERSION) \
--build-arg UIDOLR=$$(id -u) \
--build-arg GIDOLR=$$(id -g) \
--build-arg GIDORA=54322 \
Expand All @@ -25,6 +27,19 @@ build: ## Build OLR Docker image
--load \
-f Dockerfile.dev .

build-release: ## Build OLR release image (minimal, multi-stage)
docker buildx build \
--build-arg OLR_VERSION=$(OLR_VERSION) \
--build-arg GIDOLR=$$(id -g) \
--build-arg UIDOLR=$$(id -u) \
--build-arg WITHORACLE=1 \
--build-arg WITHKAFKA=1 \
--build-arg WITHPROTOBUF=1 \
--build-arg WITHPROMETHEUS=1 \
-t rophy/openlogreplicator:$(OLR_VERSION) \
--load \
-f Dockerfile.release .

tests/fixtures/%: tests/fixtures/%.tar.gz
rm -rf $@
tar xzf $< -C tests/fixtures/
Expand Down
4 changes: 1 addition & 3 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ along with OpenLogReplicator; see the file LICENSE; If not see
#ifndef CONFIG_H_
#define CONFIG_H_

#define OpenLogReplicator_VERSION_MAJOR @OpenLogReplicator_VERSION_MAJOR@
#define OpenLogReplicator_VERSION_MINOR @OpenLogReplicator_VERSION_MINOR@
#define OpenLogReplicator_VERSION_PATCH @OpenLogReplicator_VERSION_PATCH@
#define OpenLogReplicator_OLR_VERSION "@OLR_VERSION@"
#define OpenLogReplicator_SCHEMA_VERSION "@SCHEMA_VERSION@"
#define OpenLogReplicator_CMAKE_BUILD_TYPE "@CMAKE_BUILD_TYPE@"
#define OpenLogReplicator_CMAKE_BUILD_TIMESTAMP "@CMAKE_BUILD_TIMESTAMP@"
Expand Down
5 changes: 2 additions & 3 deletions src/StreamClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@ int main(int argc, char** argv) {
if (!OpenLogReplicator::Data::parseTimezone(logTimezone, ctx.logTimezone))
ctx.error(10070, "invalid environment variable OLR_LOG_TIMEZONE value: " + std::string(logTimezone));

ctx.welcome("OpenLogReplicator v." + std::to_string(OpenLogReplicator_VERSION_MAJOR) + "." +
std::to_string(OpenLogReplicator_VERSION_MINOR) + "." + std::to_string(OpenLogReplicator_VERSION_PATCH) +
" StreamClient (C) 2018-2026 by Adam Leszczynski (aleszczynski@bersler.com), see LICENSE file for licensing information");
ctx.welcome("OpenLogReplicator " + std::string(OpenLogReplicator_OLR_VERSION) + " StreamClient");
ctx.welcome("Forked by rophy from https://github.com/bersler/OpenLogReplicator, all credits to the original author Adam Leszczynski.");

// Run arguments:
// 1. network|zeromq - type of communication protocol
Expand Down
5 changes: 2 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,8 @@ namespace {
if (strlen(OpenLogReplicator_CMAKE_BUILD_TIMESTAMP) > 0)
buildArch = ", build-arch: " OpenLogReplicator_CPU_ARCH;

mainCtx->welcome("OpenLogReplicator v" + std::to_string(OpenLogReplicator_VERSION_MAJOR) + "." +
std::to_string(OpenLogReplicator_VERSION_MINOR) + "." + std::to_string(OpenLogReplicator_VERSION_PATCH) +
" (C) 2018-2026 by Adam Leszczynski (aleszczynski@bersler.com), see LICENSE file for licensing information");
mainCtx->welcome("OpenLogReplicator " + std::string(OpenLogReplicator_OLR_VERSION));
mainCtx->welcome("Forked by rophy from https://github.com/bersler/OpenLogReplicator, all credits to the original author Adam Leszczynski.");
mainCtx->welcome("arch: " + std::string(name.machine) + buildArch + ", system: " + name.sysname +
", release: " + name.release + ", build: " +
OpenLogReplicator_CMAKE_BUILD_TYPE + ", compiled: " + OpenLogReplicator_CMAKE_BUILD_TIMESTAMP + ", modules:"
Expand Down
Loading