diff --git a/.koppie/.env b/.koppie/.env index a5d09804f1..37b890f84d 100644 --- a/.koppie/.env +++ b/.koppie/.env @@ -9,6 +9,7 @@ DB_NAME=koppie DB_PASSWORD=hyrax_password DB_PORT=5432 DB_USERNAME=hyrax_user +FCREPO_URL=http://fedoraAdmin:fedoraAdmin@fcrepo:8080/fcrepo/rest FITS_SERVLET_URL=http://fits:8080/fits HUB_URL=http://chrome:4444/wd/hub HYRAX_DERIVATIVES_PATH=/app/samvera/hyrax-webapp/derivatives/ @@ -39,6 +40,8 @@ SOLR_CORES=koppie SOLR_HOST=solr SOLR_PORT=8983 SOLR_URL=http://solr:8983/solr/koppie +VALKYRIE_METADATA_ADAPTER=nurax_pg_metadata_adapter VALKYRIE_SOLR_CORE=koppie VALKYRIE_SOLR_HOST=solr VALKYRIE_SOLR_PORT=8983 +VALKYRIE_STORAGE_ADAPTER=disk \ No newline at end of file diff --git a/.koppie/config/initializers/1_valkyrie.rb b/.koppie/config/initializers/1_valkyrie.rb index 16a3491884..9e7b1288a6 100644 --- a/.koppie/config/initializers/1_valkyrie.rb +++ b/.koppie/config/initializers/1_valkyrie.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +require 'faraday/multipart' # require "shrine/storage/s3" # require "valkyrie/storage/shrine" @@ -26,7 +27,17 @@ Valkyrie::Persistence::Postgres::MetadataAdapter.new, :nurax_pg_metadata_adapter ) -Valkyrie.config.metadata_adapter = :nurax_pg_metadata_adapter + +Valkyrie::MetadataAdapter.register( + Valkyrie::Persistence::Fedora::MetadataAdapter.new( + connection: ::Ldp::Client.new(Hyrax.config.fedora_connection_builder.call( + ENV.fetch('FCREPO_URL') { "http://localhost:8080/fcrepo/rest" })), + base_path: Rails.env, #, schema: Valkyrie::Persistence::Fedora::PermissiveSchema.new(title: RDF::URI("http://example.com/title")) + fedora_version: 6 + ), :nurax_fedora_metadata_adapter +) + +Valkyrie.config.metadata_adapter = ENV.fetch('VALKYRIE_METADATA_ADAPTER') { :nurax_pg_metadata_adapter }.to_sym # shrine_s3_options = { # bucket: ENV.fetch("REPOSITORY_S3_BUCKET") { "nurax_pg#{Rails.env}" }, @@ -46,11 +57,21 @@ # ) # # Valkyrie.config.storage_adapter = :repository_s3 + +Valkyrie::StorageAdapter.register( + Valkyrie::Storage::Fedora.new( + connection: ::Ldp::Client.new(Hyrax.config.fedora_connection_builder.call( + ENV.fetch('FCREPO_URL') { "http://localhost:8080/fcrepo/rest" })), + base_path: Rails.env, + fedora_version: 6 + ), :fedora +) + Valkyrie::StorageAdapter.register( Valkyrie::Storage::VersionedDisk.new(base_path: Rails.root.join("storage", "files"), file_mover: FileUtils.method(:cp)), :disk ) -Valkyrie.config.storage_adapter = :disk +Valkyrie.config.storage_adapter = ENV.fetch('VALKYRIE_STORAGE_ADAPTER') { :disk }.to_sym Valkyrie.config.indexing_adapter = :solr_index diff --git a/docker-compose-sirenia.yml b/docker-compose-sirenia.yml new file mode 100644 index 0000000000..46143051ad --- /dev/null +++ b/docker-compose-sirenia.yml @@ -0,0 +1,204 @@ +# Requires Docker Compose v2 +name: sirenia +services: + app: &app + build: + context: . + target: hyrax-engine-dev + args: + - EXTRA_APK_PACKAGES=git less + - APP_PATH=.koppie + - BUNDLE_GEMFILE=Gemfile.sirenia + image: samvera/koppie + entrypoint: dev-entrypoint.sh + command: sh -c 'bundle exec puma -v -b tcp://0.0.0.0:3000' + stdin_open: true + tty: true + user: root + env_file: + - .koppie/.env + environment: + - RAILS_ROOT=/app/samvera/hyrax-webapp + - VALKYRIE_METADATA_ADAPTER=nurax_fedora_metadata_adapter + - VALKYRIE_STORAGE_ADAPTER=fedora + depends_on: + - chrome + - db_migrate + - memcached + - postgres + - redis + - solr + ports: + - 3002:3000 + - 9878:9876 + - 1050:1048 + volumes: + - ./bin:/app/samvera + - .koppie:/app/samvera/hyrax-webapp + - .:/app/samvera/hyrax-engine + - bundle:/app/bundle + - hyrax-storage:/app/samvera/hyrax-webapp/storage + - hyrax-derivatives:/app/samvera/hyrax-webapp/derivatives + - hyrax-uploads:/app/samvera/hyrax-webapp/uploads + - rails-public:/app/samvera/hyrax-webapp/public + - rails-tmp:/app/samvera/hyrax-webapp/tmp + networks: + - sirenia + + sidekiq: + build: + context: . + target: hyrax-engine-dev-worker + args: + - EXTRA_APK_PACKAGES=git less + - APP_PATH=.koppie + - BUNDLE_GEMFILE=Gemfile.sirenia + image: samvera/koppie-worker + entrypoint: dev-entrypoint.sh + command: sh -c 'bundle exec sidekiq' + user: root + env_file: + - .koppie/.env + environment: + - VALKYRIE_METADATA_ADAPTER=nurax_fedora_metadata_adapter + - VALKYRIE_STORAGE_ADAPTER=fedora + depends_on: + - db_migrate + - memcached + - postgres + - redis + - solr + volumes: + - ./bin:/app/samvera + - .koppie:/app/samvera/hyrax-webapp + - .:/app/samvera/hyrax-engine + - bundle:/app/bundle + - hyrax-storage:/app/samvera/hyrax-webapp/storage + - hyrax-derivatives:/app/samvera/hyrax-webapp/derivatives + - hyrax-uploads:/app/samvera/hyrax-webapp/uploads + - sidekiq-public:/app/samvera/hyrax-webapp/public + - sidekiq-tmp:/app/samvera/hyrax-webapp/tmp + networks: + - sirenia + + db_migrate: + image: samvera/koppie + user: root + env_file: + - .koppie/.env + environment: + - VALKYRIE_METADATA_ADAPTER=nurax_fedora_metadata_adapter + - VALKYRIE_STORAGE_ADAPTER=fedora + entrypoint: dev-entrypoint.sh + command: db-migrate-seed.sh + depends_on: + - postgres + - solr + volumes: + - ./bin:/app/samvera + - .koppie:/app/samvera/hyrax-webapp + - .:/app/samvera/hyrax-engine + - bundle:/app/bundle + - rails-public:/app/samvera/hyrax-webapp/public + - rails-tmp:/app/samvera/hyrax-webapp/tmp + networks: + - sirenia + + chrome: + image: seleniarm/standalone-chromium:114.0 + environment: + - START_XVFB=false + logging: + driver: none + volumes: + - /dev/shm:/dev/shm + shm_size: 2G + ports: + - "4447:4444" + - "5962:5900" + networks: + - sirenia + + postgres: + image: postgres:15 + env_file: + - .koppie/.env + ports: + - "5434:5432" + volumes: + - db:/var/lib/postgresql/data + networks: + - sirenia + + fcrepo: + image: fcrepo/fcrepo:6.4.0 + environment: + - CATALINA_OPTS=-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true + - JAVA_OPTS=-Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true + volumes: + - fcrepo:/var/lib/fcrepo + ports: + - 8081:8080 + networks: + - sirenia + + fits: + image: ghcr.io/samvera/fitsservlet:1.6.0 + ports: + - 9082:8080 + networks: + - sirenia + + memcached: + image: bitnami/memcached + ports: + - '11213:11211' + networks: + - sirenia + + redis: + image: bitnami/redis:6.2 + env_file: + - .koppie/.env + volumes: + - redis:/bitnami/redis/data + networks: + - sirenia + + solr: + image: solr:8.11 + ports: + - 8985:8983 + command: + - sh + - "-c" + - "precreate-core koppie_test /opt/solr/server/configsets/hyraxconf; solr-precreate koppie /opt/solr/server/configsets/hyraxconf" + volumes: + - solr_home:/var/solr/data:cached + - .koppie/solr/conf:/opt/solr/server/configsets/hyraxconf + ulimits: + nofile: + soft: 65536 + hard: 524288 + networks: + - sirenia + +volumes: + bundle: + db: + fcrepo: + hyrax-storage: + hyrax-derivatives: + hyrax-uploads: + rails-public: + rails-tmp: + redis: + sidekiq-public: + sidekiq-tmp: + solr_home: + +networks: + sirenia: + driver: bridge + driver_opts: + com.docker.network.bridge.name: br-sirenia