house keeping
This commit is contained in:
@@ -1,64 +0,0 @@
|
||||
# Multi-stage build for Odin + Python test environment with RocksDB
|
||||
FROM debian:bookworm-slim AS odin-builder
|
||||
|
||||
# Install dependencies for building Odin
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
curl \
|
||||
build-essential \
|
||||
clang \
|
||||
llvm \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Odin compiler
|
||||
WORKDIR /opt
|
||||
RUN git clone https://github.com/odin-lang/Odin.git odin \
|
||||
&& cd odin \
|
||||
&& ./build_odin.sh release
|
||||
|
||||
# Final stage with both Odin and Python
|
||||
FROM python:3.12-slim
|
||||
|
||||
# Install runtime and build dependencies including RocksDB
|
||||
RUN apt-get update && apt-get install -y \
|
||||
clang \
|
||||
llvm \
|
||||
make \
|
||||
git \
|
||||
build-essential \
|
||||
cmake \
|
||||
pkg-config \
|
||||
# RocksDB and compression libraries
|
||||
librocksdb-dev \
|
||||
librocksdb8.7 \
|
||||
# Compression libraries that RocksDB depends on
|
||||
libsnappy-dev \
|
||||
libgflags-dev \
|
||||
libz-dev \
|
||||
libbz2-dev \
|
||||
liblz4-dev \
|
||||
libzstd-dev \
|
||||
# Additional common dependencies
|
||||
libssl-dev \
|
||||
libcurl4-openssl-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy Odin compiler from builder stage
|
||||
COPY --from=odin-builder /opt/odin /opt/odin
|
||||
|
||||
# Add Odin to PATH
|
||||
ENV PATH="/opt/odin:${PATH}"
|
||||
ENV ODIN_ROOT="/opt/odin"
|
||||
|
||||
# Set up library paths for RocksDB
|
||||
ENV LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH}"
|
||||
ENV PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig:${PKG_CONFIG_PATH}"
|
||||
|
||||
# Install Python dependencies
|
||||
RUN pip install --no-cache-dir boto3 pytest requests
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /workspace
|
||||
|
||||
# Default command
|
||||
CMD ["/bin/bash"]
|
||||
91
Makefile
91
Makefile
@@ -6,66 +6,6 @@ ODIN := odin
|
||||
BUILD_DIR := build
|
||||
SRC_DIR := .
|
||||
|
||||
# Docker configuration for test SDK
|
||||
TEST_SDK_IMAGE := your-dockerhub-username/odin-python-test-sdk
|
||||
TEST_SDK_TAG := latest
|
||||
JORMUN_PORT ?= 8002
|
||||
|
||||
# Build the test SDK Docker image
|
||||
.PHONY: build-test-sdk
|
||||
build-test-sdk:
|
||||
@echo "Building test SDK Docker image..."
|
||||
docker build -f Dockerfile_test_sdk -t $(TEST_SDK_IMAGE):$(TEST_SDK_TAG) .
|
||||
@echo "Test SDK image built successfully"
|
||||
|
||||
# Push the test SDK image to registry
|
||||
.PHONY: push-test-sdk
|
||||
push-test-sdk: build-test-sdk
|
||||
@echo "Pushing test SDK image to registry..."
|
||||
docker push $(TEST_SDK_IMAGE):$(TEST_SDK_TAG)
|
||||
@echo "Test SDK image pushed successfully"
|
||||
|
||||
# Pull the test SDK image from registry
|
||||
.PHONY: pull-test-sdk
|
||||
pull-test-sdk:
|
||||
@echo "Pulling test SDK image from registry..."
|
||||
docker pull $(TEST_SDK_IMAGE):$(TEST_SDK_TAG)
|
||||
|
||||
# Run SDK tests in the consolidated container
|
||||
.PHONY: test-sdk
|
||||
test-sdk:
|
||||
@echo "Running SDK tests..."
|
||||
docker run --rm \
|
||||
--network host \
|
||||
-v $(PWD):/workspace \
|
||||
-w /workspace \
|
||||
-e JORMUN_ENDPOINT=http://localhost:$(JORMUN_PORT) \
|
||||
-e AWS_ACCESS_KEY_ID=local \
|
||||
-e AWS_SECRET_ACCESS_KEY=local \
|
||||
-e AWS_DEFAULT_REGION=us-east-1 \
|
||||
$(TEST_SDK_IMAGE):$(TEST_SDK_TAG) \
|
||||
sh -c "make build && python tests/sdk/test_sdk.py"
|
||||
|
||||
# Run SDK tests with live rebuild (for development)
|
||||
.PHONY: test-sdk-dev
|
||||
test-sdk-dev:
|
||||
@echo "Running SDK tests with live rebuild..."
|
||||
docker run --rm -it \
|
||||
--network host \
|
||||
-v $(PWD):/workspace \
|
||||
-w /workspace \
|
||||
-e JORMUN_ENDPOINT=http://localhost:$(JORMUN_PORT) \
|
||||
-e AWS_ACCESS_KEY_ID=local \
|
||||
-e AWS_SECRET_ACCESS_KEY=local \
|
||||
-e AWS_DEFAULT_REGION=us-east-1 \
|
||||
$(TEST_SDK_IMAGE):$(TEST_SDK_TAG) \
|
||||
/bin/bash
|
||||
|
||||
# One-time setup: build and push test SDK image
|
||||
.PHONY: setup-test-sdk
|
||||
setup-test-sdk: build-test-sdk push-test-sdk
|
||||
@echo "Test SDK setup complete"
|
||||
|
||||
# C++ shim (WAL replication helpers via RocksDB C++ API)
|
||||
SHIM_DIR := rocksdb_shim
|
||||
SHIM_LIB := $(BUILD_DIR)/libjormun_rocksdb_shim.a
|
||||
@@ -207,36 +147,6 @@ check-deps:
|
||||
@pkg-config --exists rocksdb || (echo "$(RED)✗ RocksDB not found$(NC)" && exit 1)
|
||||
@echo "$(GREEN)✓ All dependencies found$(NC)"
|
||||
|
||||
# AWS CLI test commands
|
||||
aws-test: run &
|
||||
@sleep 2
|
||||
@echo "$(BLUE)Testing with AWS CLI...$(NC)"
|
||||
@echo "\n$(YELLOW)Creating table...$(NC)"
|
||||
@aws dynamodb create-table \
|
||||
--endpoint-url http://localhost:$(PORT) \
|
||||
--table-name TestTable \
|
||||
--key-schema AttributeName=pk,KeyType=HASH \
|
||||
--attribute-definitions AttributeName=pk,AttributeType=S \
|
||||
--billing-mode PAY_PER_REQUEST || true
|
||||
@echo "\n$(YELLOW)Listing tables...$(NC)"
|
||||
@aws dynamodb list-tables --endpoint-url http://localhost:$(PORT)
|
||||
@echo "\n$(YELLOW)Putting item...$(NC)"
|
||||
@aws dynamodb put-item \
|
||||
--endpoint-url http://localhost:$(PORT) \
|
||||
--table-name TestTable \
|
||||
--item '{"pk":{"S":"test1"},"data":{"S":"hello world"}}'
|
||||
@echo "\n$(YELLOW)Getting item...$(NC)"
|
||||
@aws dynamodb get-item \
|
||||
--endpoint-url http://localhost:$(PORT) \
|
||||
--table-name TestTable \
|
||||
--key '{"pk":{"S":"test1"}}'
|
||||
@echo "\n$(YELLOW)Scanning table...$(NC)"
|
||||
@aws dynamodb scan \
|
||||
--endpoint-url http://localhost:$(PORT) \
|
||||
--table-name TestTable
|
||||
@echo "\n$(GREEN)✓ AWS CLI test complete$(NC)"
|
||||
|
||||
|
||||
# Development workflow
|
||||
dev: clean build run
|
||||
|
||||
@@ -261,7 +171,6 @@ help:
|
||||
@echo ""
|
||||
@echo "$(GREEN)Test Commands:$(NC)"
|
||||
@echo " make test - Run unit tests"
|
||||
@echo " make aws-test - Test with AWS CLI commands"
|
||||
@echo ""
|
||||
@echo "$(GREEN)Utility Commands:$(NC)"
|
||||
@echo " make fmt - Format source code"
|
||||
|
||||
@@ -404,7 +404,6 @@ brew upgrade odin # macOS
|
||||
|
||||
## Next Steps
|
||||
|
||||
- Read [ARCHITECTURE.md](ARCHITECTURE.md) for internals
|
||||
- Check [TODO.md](TODO.md) for implementation status
|
||||
- Browse source code in `dynamodb/`, `rocksdb/`, etc.
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
services:
|
||||
sdk-test:
|
||||
image: python:3.12-slim
|
||||
network_mode: host
|
||||
working_dir: /tests
|
||||
volumes:
|
||||
- ./tests/sdk:/tests
|
||||
environment:
|
||||
- JORMUN_ENDPOINT=http://localhost:${JORMUN_PORT:-8002}
|
||||
- AWS_ACCESS_KEY_ID=local
|
||||
- AWS_SECRET_ACCESS_KEY=local
|
||||
- AWS_DEFAULT_REGION=us-east-1
|
||||
command: >
|
||||
sh -c "pip install --quiet boto3 && python test_sdk.py"
|
||||
1002
test_sdk.py
1002
test_sdk.py
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user