From 16ff27a4a81bf77023314799e374e24dd8ba0a23 Mon Sep 17 00:00:00 2001 From: Monique Rio Date: Fri, 23 Feb 2024 13:39:39 -0500 Subject: [PATCH] got rid of Dockerfile.prod; Got rid of GH token for building gems --- .../workflows/start-reindex-production.yml | 2 +- .github/workflows/start-reindex-workshop.yml | 2 +- .github/workflows/tests.yml | 4 +-- README.md | 14 +++++--- umich_catalog_indexing/Dockerfile | 4 +-- umich_catalog_indexing/Dockerfile.prod | 36 ------------------- .../{.env-dev-values => env.development} | 0 .../{.env-example => env.example} | 0 8 files changed, 13 insertions(+), 49 deletions(-) delete mode 100644 umich_catalog_indexing/Dockerfile.prod rename umich_catalog_indexing/{.env-dev-values => env.development} (100%) rename umich_catalog_indexing/{.env-example => env.example} (100%) diff --git a/.github/workflows/start-reindex-production.yml b/.github/workflows/start-reindex-production.yml index 670a7543..9a86e91f 100644 --- a/.github/workflows/start-reindex-production.yml +++ b/.github/workflows/start-reindex-production.yml @@ -18,7 +18,7 @@ jobs: with: image_name: ${{ vars.INDEXER_IMAGE_NAME }} tag: ${{ github.event.inputs.tag }} - dockerfile: umich_catalog_indexing/Dockerfile.prod + dockerfile: umich_catalog_indexing/Dockerfile docker_context: umich_catalog_indexing/. secrets: inherit diff --git a/.github/workflows/start-reindex-workshop.yml b/.github/workflows/start-reindex-workshop.yml index 43209936..38e71cd8 100644 --- a/.github/workflows/start-reindex-workshop.yml +++ b/.github/workflows/start-reindex-workshop.yml @@ -18,7 +18,7 @@ jobs: with: image_name: ${{ vars.INDEXER_IMAGE_NAME }} tag: ${{ github.event.inputs.tag }} - dockerfile: umich_catalog_indexing/Dockerfile.prod + dockerfile: umich_catalog_indexing/Dockerfile docker_context: umich_catalog_indexing/. secrets: inherit diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index eb22b9e1..275b2646 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,11 +15,9 @@ jobs: with: ruby-version: "3.2" bundler-cache: true - env: - BUNDLE_RUBYGEMS__PKG__GITHUB__COM: ${{secrets.GH_PACKAGE_READ_TOKEN}} - name: Create .env file working-directory: ./umich_catalog_indexing - run: cat .env-dev-values .env-example > .env + run: cat env.* > .env - name: Load .env file uses: xom9ikk/dotenv@v2 with: diff --git a/README.md b/README.md index 4206d927..31de60c7 100644 --- a/README.md +++ b/README.md @@ -26,28 +26,32 @@ Replace values in `umich_catalog_index/.env` with real keys. Ask a developer for Build it ``` -$ docker-compose build +$ docker compose build ``` Build the gems for the web service (the one that has traject) ``` -$ docker-compose run --rm web bundle install +$ docker compose run --rm web bundle install ``` Turn it on in detached mode ``` -$ docker-compose up -d +$ docker compose up -d ``` In a browser you can look at -http://localhost:8026 for the solr admin panel +http://localhost:8983 for the solr admin panel http://localhost:9292/ for the sidekiq admin panel ## Trying it Out Some example commands that should work: ``` docker-compose run --rm web bundle exec irb -r ./lib/sidekiq_jobs.rb -IndexIt.perform_async("search_daily_bibs/birds_2022021017_21131448650006381_new.tar.gz", "http://solr:8983/solr/biblio") + +IndexIt.perform_async("search_daily_bibs/birds.tar.gz", "http://solr:8983/solr/biblio") + +IndexIt.new.perform("search_daily_bibs/sample.tar.gz", "http://solr:8983/solr/biblio") + IndexHathi.perform_async("zephir_upd_20220301.json.gz", "http://solr:8983/solr/biblio") ``` diff --git a/umich_catalog_indexing/Dockerfile b/umich_catalog_indexing/Dockerfile index 38890815..2031e652 100644 --- a/umich_catalog_indexing/Dockerfile +++ b/umich_catalog_indexing/Dockerfile @@ -28,6 +28,4 @@ FROM development AS production COPY --chown=${UID}:${GID} . /app -RUN --mount=type=secret,id=gh_package_read_token,uid=1000 \ - read_token="$(cat /run/secrets/gh_package_read_token)" \ - && BUNDLE_RUBYGEMS__PKG__GITHUB__COM=${read_token} bundle install +RUN bundle install diff --git a/umich_catalog_indexing/Dockerfile.prod b/umich_catalog_indexing/Dockerfile.prod deleted file mode 100644 index d988e16b..00000000 --- a/umich_catalog_indexing/Dockerfile.prod +++ /dev/null @@ -1,36 +0,0 @@ -FROM jruby:9.4 -ARG UNAME=app -ARG UID=1000 -ARG GID=1000 - -RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \ - build-essential\ - netbase\ - libffi-dev \ - git \ - vim-tiny \ - ssh - -RUN groupadd -g ${GID} -o ${UNAME} -RUN useradd -m -d /app -u ${UID} -g ${GID} -o -s /bin/bash ${UNAME} -RUN mkdir -p /gems && chown ${UID}:${GID} /gems - -RUN gem install bundler - -ENV BUNDLE_PATH /gems -RUN mkdir -p /gems - -COPY --chown=${UID}:${GID} Gemfile* /app/ - -WORKDIR /app - -#jobs=1 set because ffi not installing properly for traject-marc4j_reader gem -RUN --mount=type=secret,id=gh_package_read_token \ - read_token="$(cat /run/secrets/gh_package_read_token)" \ - && BUNDLE_RUBYGEMS__PKG__GITHUB__COM=${read_token} bundle install --jobs=1 - -USER $UNAME - -COPY --chown=${UID}:${GID} . /app/ - -CMD ["bundle", "exec", "sidekiq", "-r", "./lib/sidekiq_jobs.rb"] diff --git a/umich_catalog_indexing/.env-dev-values b/umich_catalog_indexing/env.development similarity index 100% rename from umich_catalog_indexing/.env-dev-values rename to umich_catalog_indexing/env.development diff --git a/umich_catalog_indexing/.env-example b/umich_catalog_indexing/env.example similarity index 100% rename from umich_catalog_indexing/.env-example rename to umich_catalog_indexing/env.example