Skip to content
Merged
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
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ COPY . .
# distclean drops any host object files that slipped into the build context.
RUN make distclean || true \
&& make -j"$(nproc)" BUILD_TLS=yes \
&& make install BUILD_TLS=yes PREFIX=/opt/cmo
&& make install BUILD_TLS=yes PREFIX=/opt/cmo \
&& make -C modules/timeseries \
&& mkdir -p /opt/cmo/lib \
&& cp modules/timeseries/timeseries.so /opt/cmo/lib/timeseries.so

FROM debian:bookworm-slim AS runtime

Expand All @@ -37,6 +40,7 @@ RUN apt-get update \
&& chmod 750 /data

COPY --from=build /opt/cmo/bin/ /usr/local/bin/
COPY --from=build /opt/cmo/lib/ /usr/local/lib/cmo/
COPY deploy/valkey.conf /etc/cache-me-outside/valkey.conf
COPY deploy/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
COPY deploy/healthcheck.sh /usr/local/bin/healthcheck.sh
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile.modules
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ FROM ${BASE}
COPY --from=json /libjson.so /usr/local/lib/cmo-modules/libjson.so
COPY --from=bloom /libbloom.so /usr/local/lib/cmo-modules/libbloom.so
COPY --from=search /libsearch.so /usr/local/lib/cmo-modules/libsearch.so

# From TS module PR
# Loadable modules for the Cache Me Outside image.
# The server image build runs this file's RUN lines from /src.
RUN make -C /src/modules/timeseries && mkdir -p /opt/cmo/lib && cp /src/modules/timeseries/timeseries.so /opt/cmo/lib/timeseries.so
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

default: all

# Forward every target into src/, then build loadable modules listed for the
# image. `all` is explicit so the module is part of a normal `make`.
all:
cd src && $(MAKE) all
$(MAKE) -C modules/timeseries

.DEFAULT:
cd src && $(MAKE) $@

Expand Down
3 changes: 3 additions & 0 deletions modules/timeseries/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
timeseries.so
chunk_test
*.o
39 changes: 39 additions & 0 deletions modules/timeseries/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Time-series module. The .so is loaded with MODULE LOAD. chunk_test is a
# standalone compressor check and does not link the server.

uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')

ifeq ($(uname_S),Linux)
SHOBJ_CFLAGS ?= -W -Wall -Wno-missing-field-initializers -fno-common -g -ggdb -std=gnu11 -O2
SHOBJ_LDFLAGS ?= -shared
LD ?= gcc
CC ?= gcc
else
SHOBJ_CFLAGS ?= -W -Wall -Wno-missing-field-initializers -dynamic -fno-common -g -ggdb -std=gnu11 -O2
SHOBJ_LDFLAGS ?= -bundle -undefined dynamic_lookup
LD ?= $(CC)
endif

CFLAGS_MOD = -I. -I../../src $(CFLAGS) $(SHOBJ_CFLAGS) -fPIC

.PHONY: all clean

all: timeseries.so chunk_test

chunk.o: chunk.c chunk.h
$(CC) $(CFLAGS_MOD) -c chunk.c -o chunk.o

query.o: query.c chunk.h
$(CC) $(CFLAGS_MOD) -c query.c -o query.o

ts.o: ts.c chunk.h
$(CC) $(CFLAGS_MOD) -c ts.c -o ts.o

timeseries.so: ts.o chunk.o query.o
$(LD) -o $@ ts.o chunk.o query.o $(SHOBJ_LDFLAGS) $(LIBS) -lm

chunk_test: chunk_test.c chunk.c chunk.h
$(CC) -I. -std=gnu11 -Wall -Wextra -O2 -g -o $@ chunk_test.c chunk.c -lm

clean:
rm -f *.o timeseries.so chunk_test
Loading
Loading