Skip to content

Commit

Permalink
Merge pull request #1 from scientist-softserv/with-docker-dev
Browse files Browse the repository at this point in the history
add dockerfile/internal-test config/docker-compose
  • Loading branch information
orangewolf authored Dec 5, 2022
2 parents bbe8736 + 1160f0a commit 7813dd5
Show file tree
Hide file tree
Showing 9 changed files with 200 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ENGINE_CART_DESTINATION='.internal_test_app'
SOLR_URL=http://solr:8983/solr
FCREPO_URL=http://fcrepo:8080
REDIS_HOST=redis
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ fcrepo-webapp-*
# ignore gem builds
*.gem
pkg/
*~undo-tree~
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM ghcr.io/scientist-softserv/dev-ops/samvera:e9200061 as hyku-base
USER root
RUN apk add --no-cache sqlite chromium-chromedriver
USER app

RUN sh -l -c " \
git config --global --add safe.directory /app/samvera/hyrax-webapp && \
bundle config set --global force_ruby_platform ruby"

COPY --chown=1001:101 $APP_PATH/Gemfile* /app/samvera/hyrax-webapp/
COPY --chown=1001:101 $APP_PATH/*.gemspec /app/samvera/hyrax-webapp/
COPY --chown=1001:101 $APP_PATH/lib/newspaper_works/version.rb /app/samvera/hyrax-webapp/lib/newspaper_works/
RUN bundle install --jobs "$(nproc)"

COPY --chown=1001:101 $APP_PATH /app/samvera/hyrax-webapp
126 changes: 126 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
version: '3.8'

x-app: &app
build:
context: .
target: hyku-base
args:
- EXTRA_APK_PACKAGES=less vim bash openjdk11-jre ffmpeg rsync exiftool
# image: ghcr.io/scientist-softserv/palni-palci:${TAG:-latest}
env_file:
- .env
# NOTE: all common env variables moved to .env
volumes:
- node_modules:/app/samvera/hyrax-webapp/node_modules:cached
- uploads:/app/samvera/hyrax-webapp/public/uploads:cached
- assets:/app/samvera/hyrax-webapp/public/assets:cached
- cache:/app/samvera/hyrax-webapp/tmp/cache:cached
- .:/app/samvera/hyrax-webapp
networks:
internal:

volumes:
assets:
cache:
db:
fcrepo:
node_modules:
redis:
solr:
uploads:
zk:
zoo:

networks:
internal:

services:
solr:
image: solr:7.7.2
environment:
- VIRTUAL_PORT=8983
- VIRTUAL_HOST=solr.iiif_print.test
ports:
- 8983:8983
command:
- sh
- "-c"
- "precreate-core hyrax_test /opt/solr/server/configsets/hyraxconf; solr-precreate hyrax /opt/solr/server/configsets/hyraxconf"
volumes:
- solr:/var/solr/data:cached
- .internal_test_app/solr/conf:/opt/solr/server/configsets/hyraxconf
networks:
- internal

fcrepo:
image: ghcr.io/samvera/fcrepo4:4.7.5
volumes:
- fcrepo:/data:cached
env_file:
- .env
environment:
- VIRTUAL_PORT=8080
- VIRTUAL_HOST=fcrepo.hyku.test
- JAVA_OPTS=${JAVA_OPTS} -Dfcrepo.modeshape.configuration="classpath:/config/file-simple/repository.json" -Dfcrepo.object.directory="/data/objects" -Dfcrepo.binary.directory="/data/binaries"
expose:
- 8080
networks:
internal:

db:
image: postgres:11.1
env_file:
- .env
environment:
- POSTGRES_DB=${DB_NAME}
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_USER=${DB_USER}
- VIRTUAL_PORT=5432
- VIRTUAL_HOST=db.hyku.test
volumes:
- db:/var/lib/postgresql/data
networks:
internal:

web:
<<: *app
environment:
- VIRTUAL_PORT=3000
- VIRTUAL_HOST=.hyku.test
command: tail -f /dev/null
depends_on:
db:
condition: service_started
solr:
condition: service_started
fcrepo:
condition: service_started
redis:
condition: service_started
chrome:
condition: service_started
expose:
- 3000

redis:
image: redis:5
command: redis-server
volumes:
- redis:/data
networks:
internal:

chrome:
# password is 'secret'
image: selenium/standalone-chrome-debug:3.141.59-20201010
logging:
driver: none
volumes:
- /dev/shm:/dev/shm
shm_size: 3G
networks:
internal:
environment:
- JAVA_OPTS=-Dwebdriver.chrome.whitelistedIps=
- VIRTUAL_PORT=7900
- VIRTUAL_HOST=chrome.hyku.test
9 changes: 9 additions & 0 deletions spec/test_app_templates/config/blacklight.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
development:
adapter: solr
url: <%= ENV['SOLR_URL'] %>/hyrax
test: &test
adapter: solr
url: <%= ENV['SOLR_URL'] %>/hyrax_test
production:
adapter: solr
url: <%= ENV['SOLR_URL'] || "http://127.0.0.1:8983/solr/blacklight-core" %>
15 changes: 15 additions & 0 deletions spec/test_app_templates/config/fedora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
development:
user: fedoraAdmin
password: fedoraAdmin
url: <%= ENV['FCREPO_URL'] %>/rest
base_path: /dev
test:
user: fedoraAdmin
password: fedoraAdmin
url: <%= ENV['FCREPO_URL'] %>/rest
base_path: /test
production:
user: fedoraAdmin
password: fedoraAdmin
url: http://127.0.0.1:8983/fedora/rest
base_path: /prod
9 changes: 9 additions & 0 deletions spec/test_app_templates/config/redis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
development:
host: <%= ENV['REDIS_HOST'] || 'localhost' %>
port: 6379
test:
host: <%= ENV['REDIS_HOST'] || 'localhost' %>
port: 6379
production:
host: <%= ENV['REDIS_HOST'] || 'localhost' %>
port: 6379
7 changes: 7 additions & 0 deletions spec/test_app_templates/config/solr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This is a sample config file that points to a solr server for each environment
development:
url: <%= ENV['SOLR_URL'] %>/hyrax
test:
url: <%= ENV['SOLR_URL'] %>/hyrax_test
production:
url: <%= ENV['SOLR_URL'] || "http://your.production.server:8080/bl_solr/core0" %>
14 changes: 14 additions & 0 deletions spec/test_app_templates/lib/generators/test_app_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,24 @@
class TestAppGenerator < Rails::Generators::Base
source_root './spec/test_app_templates'

def install_redis
gem 'redis', '4.8.0'
Bundler.with_clean_env do
run "bundle install"
end
end

def install_hyrax
generate 'hyrax:install', '-f'
end

def create_config_files
copy_file 'config/blacklight.yaml', 'config/blacklight.yaml'
copy_file 'config/fcrepo.yaml', 'config/fcrepo.yaml'
copy_file 'config/redis.yaml', 'config/redis.yaml'
copy_file 'config/solr.yaml', 'config/solr.yaml'
end

def install_engine
generate 'newspaper_works:install'
end
Expand Down

0 comments on commit 7813dd5

Please sign in to comment.