Skip to content

Commit afe7ba6

Browse files
authored
Merge pull request #185 from mlibrary/LIBSEARCH-1166-query-parser-service
Libsearch 1166 query parser service
2 parents 81e7a70 + d857019 commit afe7ba6

File tree

12 files changed

+880
-15
lines changed

12 files changed

+880
-15
lines changed

.github/workflows/manual-build-unstable.yaml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#saved so that I can have a workflow to try out in a branch
22
name: Manual Build image
3-
43
on:
54
workflow_dispatch:
65
inputs:
@@ -10,30 +9,32 @@ on:
109
type: choice
1110
options:
1211
- api
12+
- parser
1313
tag:
1414
description: tag
1515
required: true
16-
1716
jobs:
1817
get-image-info:
1918
runs-on: ubuntu-latest
2019
outputs:
2120
directory: ${{ steps.get_step.outputs.directory }}
2221
image_name: ${{ steps.get_step.outputs.image_name }}
2322
steps:
24-
- name: Get step
25-
id: get_step
26-
env:
27-
IMAGE: ${{ github.event.inputs.image }}
28-
run: |
29-
if [[ $IMAGE == "api" ]]; then
30-
echo "directory=api" >> "$GITHUB_OUTPUT"
31-
echo "image_name=search.catalog-api" >> "$GITHUB_OUTPUT"
32-
else
33-
echo "somehow didn't provide a image"
34-
false
35-
fi
36-
23+
- name: Get step
24+
id: get_step
25+
env:
26+
IMAGE: ${{ github.event.inputs.image }}
27+
run: |
28+
if [[ $IMAGE == "api" ]]; then
29+
echo "directory=api" >> "$GITHUB_OUTPUT"
30+
echo "image_name=search.catalog-api" >> "$GITHUB_OUTPUT"
31+
elif [[ $IMAGE == "parser" ]]; then
32+
echo "directory=search_parser" >> "$GITHUB_OUTPUT"
33+
echo "image_name=search.parser" >> "$GITHUB_OUTPUT"
34+
else
35+
echo "somehow didn't provide a image"
36+
false
37+
fi
3738
build-unstable:
3839
name: Build unstable ${{ github.event.inputs.tag }}
3940
needs: [get-image-info]

.rubocop.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
require: standard
2+
3+
inherit_gem:
4+
standard: config/base.yml

compose.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,23 @@ services:
1919
env_file:
2020
- ./api/.env
2121
command: "poetry run uvicorn catalog_api.main:app --host 0.0.0.0 --reload"
22+
23+
parser:
24+
build:
25+
context: search_parser/.
26+
target: development
27+
volumes:
28+
- ./search_parser/.:/app
29+
ports:
30+
- 4567:4567
31+
env_file:
32+
- ./search_parser/.env
33+
command:
34+
- bundle
35+
- exec
36+
- puma
37+
- -b
38+
- "tcp://0.0.0.0:4567"
2239

2340
supervisor:
2441
image: "ghcr.io/mlibrary/sidekiq-supervisor-unstable:latest"

search_parser/Dockerfile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
################################################################################
2+
# BASE
3+
################################################################################
4+
FROM ruby:4.0-slim AS base
5+
6+
ARG UID=1000
7+
ARG GID=1000
8+
ARG NODE_MAJOR=20
9+
10+
11+
RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \
12+
build-essential \
13+
libyaml-dev \
14+
curl \
15+
vim\
16+
git
17+
18+
19+
RUN groupadd -g ${GID} -o app
20+
RUN useradd -m -d /app -u ${UID} -g ${GID} -o -s /bin/bash app
21+
22+
ENV GEM_HOME=/gems
23+
ENV PATH="$PATH:/gems/bin"
24+
RUN mkdir -p /gems && chown ${UID}:${GID} /gems
25+
26+
27+
ENV BUNDLE_PATH /app/vendor/bundle
28+
29+
# Change to app and back so that bundler created files in /gems are owned by the
30+
# app user
31+
USER app
32+
RUN gem install bundler
33+
USER root
34+
35+
WORKDIR /app
36+
37+
CMD ["bundle", "exec", "puma", "-b", "tcp://0.0.0.0:4567"]
38+
39+
################################################################################
40+
# DEVELOPMENT #
41+
################################################################################
42+
FROM base AS development
43+
44+
#RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \
45+
#git
46+
47+
48+
USER app
49+
50+
################################################################################
51+
# PRODUCTION #
52+
################################################################################
53+
FROM base AS production
54+
55+
56+
ENV BUNDLE_WITHOUT=development:test
57+
58+
COPY --chown=${UID}:${GID} . /app
59+
60+
USER app
61+
62+
RUN bundle install
63+

search_parser/Gemfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
source "https://rubygems.org"
2+
3+
gem "sinatra"
4+
gem "sinatra-contrib"
5+
gem "puma"
6+
gem "ostruct"
7+
gem "semantic_logger"
8+
gem "canister"
9+
gem "pry" # for mlibrary_search_parser
10+
gem "activesupport"
11+
gem "faraday"
12+
13+
gem "mlibrary_search_parser",
14+
git: "https://github.com/mlibrary/mlibrary_search_parser",
15+
branch: "main"
16+
17+
group :metrics do
18+
gem "yabeda-puma-plugin"
19+
gem "yabeda-prometheus"
20+
gem "prometheus-client"
21+
end
22+
23+
group :development, :test do
24+
gem "faker"
25+
gem "ruby-prof"
26+
gem "debug"
27+
end
28+
29+
group :test do
30+
gem "rspec"
31+
gem "rack-test"
32+
gem "simplecov"
33+
gem "simplecov-lcov"
34+
gem "webmock"
35+
end
36+
37+
group :development do
38+
gem "standard"
39+
gem "ruby-lsp"
40+
end

0 commit comments

Comments
 (0)