Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#357 Add SQLite in-memory support #358

Merged
merged 9 commits into from
Nov 18, 2024
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
10 changes: 5 additions & 5 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ this action runs [golangci-lint] to run multiple linters against the code.
- [.golangci.yaml]
- Uses:
- [actions/checkout]
- [senzing-factory/github-action-install-senzing-api]
- [senzing-factory/github-action-install-senzing-sdk]
- [actions/setup-go]
- [golangci/golangci-lint-action]

Expand All @@ -85,7 +85,7 @@ this action runs `go test` with coverage testing on macOS.
- [actions/checkout]
- [actions/setup-go]
- [gotesttools/gotestfmt-action]
- [senzing-factory/github-action-install-senzing-api]
- [senzing-factory/github-action-install-senzing-sdk]
- [actions/upload-artifact]
- [senzing-factory/build-resources/.../go-coverage.yaml]

Expand All @@ -100,7 +100,7 @@ this action runs `go test` with coverage testing on Linux.
- [actions/checkout]
- [actions/setup-go]
- [gotesttools/gotestfmt-action]
- [senzing-factory/github-action-install-senzing-api]
- [senzing-factory/github-action-install-senzing-sdk]
- [actions/upload-artifact]
- [senzing-factory/build-resources/.../go-coverage.yaml]

Expand All @@ -115,7 +115,7 @@ this action runs `go test` with coverage testing on Windows.
- [actions/checkout]
- [actions/setup-go]
- [gotesttools/gotestfmt-action]
- [senzing-factory/github-action-install-senzing-api]
- [senzing-factory/github-action-install-senzing-sdk]
- [actions/upload-artifact]
- [senzing-factory/build-resources/.../go-coverage.yaml]

Expand Down Expand Up @@ -199,7 +199,7 @@ this action moves the PR on the "Garage" project board to "Done".
[senzing-factory/build-resources/.../make-go-github-file.yaml]: https://github.com/senzing-factory/build-resources/blob/main/.github/workflows/make-go-github-file.yaml
[senzing-factory/build-resources/.../move-pr-to-done-dependabot.yaml]: https://github.com/senzing-factory/build-resources/blob/main/.github/workflows/move-pr-to-done-dependabot.yaml
[senzing-factory/github-action-docker-buildx-build]: https://github.com/senzing-factory/github-action-docker-buildx-build
[senzing-factory/github-action-install-senzing-api]: https://github.com/senzing-factory/github-action-install-senzing-api
[senzing-factory/github-action-install-senzing-sdk]: https://github.com/senzing-factory/github-action-install-senzing-sdk
[senzing-factory/github-action-make-go-tag]: https://github.com/senzing-factory/github-action-make-go-tag
[super-linter]: https://github.com/super-linter/super-linter
[testcoverage.yaml]: ../coverage/README.md#testcoverageyaml
10 changes: 5 additions & 5 deletions .github/workflows/go-test-darwin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ permissions:

jobs:
go-test-darwin:
name: "Go test with Senzing: ${{ matrix.senzingapi-version }}; OS: ${{ matrix.os }}; Go: ${{ matrix.go }}"
name: "Go test with Senzing: ${{ matrix.senzingsdk-version }}; OS: ${{ matrix.os }}; Go: ${{ matrix.go }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
go: ["1.21"]
os: [macos-latest]
senzingapi-version: [staging-v4]
senzingsdk-version: [staging-v4]

steps:
- name: Checkout repository
Expand All @@ -38,10 +38,10 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Senzing API
uses: senzing-factory/github-action-install-senzing-api@v4
- name: Install Senzing SDK
uses: senzing-factory/github-action-install-senzing-sdk@v1
with:
senzingapi-version: ${{ matrix.senzingapi-version }}
senzingsdk-version: ${{ matrix.senzingsdk-version }}

- name: Copy /etc files
run: sudo mkdir -p /opt/senzing/er/etc && sudo cp testdata/senzing-license/g2.lic /opt/senzing/er/etc/g2.lic
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/go-test-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ permissions:

jobs:
go-test-linux:
name: "Go test with Senzing: ${{ matrix.senzingapi-version }}; OS: ${{ matrix.os }}; Go: ${{ matrix.go }}"
name: "Go test with Senzing: ${{ matrix.senzingsdk-version }}; OS: ${{ matrix.os }}; Go: ${{ matrix.go }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
go: ["1.21"]
os: [ubuntu-latest]
senzingapi-version: [staging-v4]
senzingsdk-version: [staging-v4]

steps:
- name: Checkout repository
Expand All @@ -36,10 +36,10 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Senzing API
uses: senzing-factory/github-action-install-senzing-api@v4
- name: Install Senzing SDK
uses: senzing-factory/github-action-install-senzing-sdk@v1
with:
senzingapi-version: ${{ matrix.senzingapi-version }}
senzingsdk-version: ${{ matrix.senzingsdk-version }}

- name: Copy /etc files
run: sudo mkdir -p /etc/opt/senzing && sudo cp testdata/senzing-license/g2.lic /etc/opt/senzing/g2.lic
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/go-test-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ permissions:

jobs:
go-test-windows:
name: "Go test with Senzing: ${{ matrix.senzingapi-version }}; OS: ${{ matrix.os }}; Go: ${{ matrix.go }}"
name: "Go test with Senzing: ${{ matrix.senzingsdk-version }}; OS: ${{ matrix.os }}; Go: ${{ matrix.go }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
go: ["1.21"]
os: [windows-latest]
senzingapi-version: [staging-v4]
senzingsdk-version: [staging-v4]

steps:
- name: Checkout repository
Expand All @@ -35,10 +35,10 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Senzing API
uses: senzing-factory/github-action-install-senzing-api@v4
- name: Install Senzing SDK
uses: senzing-factory/github-action-install-senzing-sdk@v1
with:
senzingapi-version: ${{ matrix.senzingapi-version }}
senzingsdk-version: ${{ matrix.senzingsdk-version }}

- name: Add to "Path" environment variable
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
with:
fetch-depth: 0

- name: Install Senzing API
uses: senzing-factory/github-action-install-senzing-api@v4
- name: Install Senzing SDK
uses: senzing-factory/github-action-install-senzing-sdk@v1
with:
senzingapi-version: staging-v4
senzingsdk-version: staging-v4

- name: Copy Senzing headers
run: |
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning].

-

## [0.8.7] - 2024-11-14

### Changed in 0.8.7

- Support SQLite in-memory database

## [0.8.6] - 2024-10-30

### Changed in 0.8.6
Expand Down
30 changes: 21 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ LABEL Name="senzing/go-builder" \

USER root

# Install packages via apt-get.

RUN apt-get update \
&& apt-get -y install \
libsqlite3-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Copy local files from the Git repository.

COPY ./rootfs /
Expand All @@ -42,7 +50,7 @@ ENV LD_LIBRARY_PATH=/opt/senzing/er/lib/
# Build go program.

WORKDIR ${GOPATH}/src/serve-grpc
RUN make build
RUN make build-with-libsqlite3

# Copy binaries to /output.

Expand All @@ -57,21 +65,25 @@ FROM ${IMAGE_FINAL} AS final
ENV REFRESHED_AT=2024-07-01
LABEL Name="senzing/serve-grpc" \
Maintainer="[email protected]" \
Version="0.8.3"
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD [ "/app/healthcheck.sh" ]
Version="0.8.7"
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD ["/app/healthcheck.sh"]
USER root

# Install packages via apt-get.

RUN apt-get update \
&& apt-get -y install \
libsqlite3-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Copy files from repository.

COPY ./rootfs /

# Copy files from prior stage.

COPY --from=builder "/output/linux/serve-grpc" "/app/serve-grpc"

# Prepare environment file system.

RUN chmod --recursive 777 /tmp
COPY --from=builder /output/linux/serve-grpc /app/serve-grpc

# Run as non-root container

Expand All @@ -80,7 +92,7 @@ USER 1001
# Runtime environment variables.

ENV LD_LIBRARY_PATH=/opt/senzing/er/lib/
ENV SENZING_TOOLS_DATABASE_URL=sqlite3://na:na@nowhere/tmp/sqlite/G2C.db?mode=memory&cache=shared
ENV SENZING_TOOLS_DATABASE_URL=sqlite3://na:na@nowhere/IN_MEMORY_DB?mode=memory&cache=shared
ENV SENZING_TOOLS_ENABLE_ALL=true

# Runtime execution.
Expand Down
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ GO_ARCH = $(word 2, $(GO_OSARCH))

DOCKER_IMAGE_TAG ?= $(GIT_REPOSITORY_NAME):$(GIT_VERSION)
GOBIN ?= $(shell go env GOPATH)/bin
LD_LIBRARY_PATH ?= /opt/senzing/er/lib
LD_LIBRARY_PATH ?= /opt/senzing/er/lib:/opt/oracle/instantclient_23_5

# Export environment variables.

Expand Down Expand Up @@ -106,10 +106,20 @@ $(PLATFORMS):
@GOOS=$(GO_OS) GOARCH=$(GO_ARCH) go build -o $(TARGET_DIRECTORY)/$(GO_OS)-$(GO_ARCH)/$(PROGRAM_NAME)


PLATFORMS_WITH_LIBSQLITE3 := linux/amd64/libsqlite3 linux/arm64/libsqlite3
$(PLATFORMS_WITH_LIBSQLITE3):
$(info Building $(TARGET_DIRECTORY)/$(GO_OS)-$(GO_ARCH)/$(PROGRAM_NAME))
@GOOS=$(GO_OS) GOARCH=$(GO_ARCH) go build -tags "libsqlite3 linux" -o $(TARGET_DIRECTORY)/$(GO_OS)-$(GO_ARCH)/$(PROGRAM_NAME)


.PHONY: build
build: build-osarch-specific


.PHONY: build-with-libsqlite3
build-with-libsqlite3: build-with-libsqlite3-osarch-specific


.PHONY: docker-build
docker-build: docker-build-osarch-specific

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Senzing SDKs for accessing the gRPC server:
Example:

```console
docker run -it --name senzing-serve-grpc -p 8261:8261 --rm senzing/serve-grpc
docker run -it --name senzing-serve-grpc -p 8261:8261 --read-only --rm senzing/serve-grpc
```

1. See [Parameters](#parameters) for additional parameters.
Expand Down
Loading
Loading