-
Notifications
You must be signed in to change notification settings - Fork 0
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
Dockerization #46
Merged
Merged
Dockerization #46
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
1401624
wip
mkorcy 22135e3
progress but have lost the thread
mkorcy fc0481b
don't build ruby 3
mkorcy c1ef3c9
WIP
mkorcy d761b93
clean up file
mkorcy 9b1e26d
wip
mkorcy 9daf208
wip
mkorcy 4d5a4c8
keys backwards
mkorcy fcd0ced
wip
mkorcy 165931f
wip
mkorcy c931ab8
didn't need this file
mkorcy d276d62
removed xit
mkorcy 628a9cb
clean up
mkorcy 30e4cae
unnecessary change
mkorcy a7fdd91
spec writers
mkorcy f3f1fd4
wip
mkorcy 75a653b
deals with failures on local docker instances
mkorcy 06f5187
remove download_helpers
mkorcy 5e02987
gha
mkorcy 575da9c
wip
mkorcy 121886f
wip
mkorcy 2325644
wip
mkorcy eda3e17
wip
mkorcy 176ed3a
wip
mkorcy 556bf6a
adds a readme
mkorcy a3f6db5
removes unused file
mkorcy f4e6db3
pin gem system update
mkorcy f1d32cc
drop rubyracer
mkorcy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,10 +38,6 @@ jobs: | |
matrix: | ||
ruby-version: ['2.7.5'] | ||
experimental: [false] | ||
include: | ||
- ruby-version: 3.0.3 | ||
experimental: true | ||
|
||
steps: | ||
- name: Pin chrome | ||
uses: abhi1693/[email protected] | ||
|
@@ -63,7 +59,7 @@ jobs: | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | ||
- name: Update rubygems | ||
run: | | ||
gem update --system | ||
gem install rubygems-update -v 3.4.22 | ||
gem install bundler:2.3.15 | ||
|
||
- name: Set up JDK 1.8 | ||
|
@@ -102,7 +98,7 @@ jobs: | |
- name: Setup hyrax test environment | ||
run: | | ||
bundle exec rake hydra:test_server & | ||
sleep 150 | ||
sleep 180 | ||
# - name: Rubbocop | ||
# run: | | ||
# bundle exec rubocop | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,3 +46,7 @@ config/java.yml | |
# Spring stuff | ||
bin/rspec | ||
bin/spring | ||
|
||
# env files | ||
.env | ||
coverage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
FROM ruby:2.7.5 | ||
|
||
ARG RAILS_ENV | ||
ARG SECRET_KEY_BASE | ||
|
||
# Necessary for bundler to operate properly | ||
ENV LANG C.UTF-8 | ||
ENV LC_ALL C.UTF-8 | ||
|
||
# add nodejs and yarn dependencies for the frontend | ||
# RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ | ||
# curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ | ||
# echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list | ||
|
||
# --allow-unauthenticated needed for yarn package | ||
RUN apt-get update && apt-get upgrade -y && \ | ||
apt-get install --no-install-recommends -y ca-certificates nodejs \ | ||
build-essential libpq-dev libreoffice unzip ghostscript vim \ | ||
ffmpeg \ | ||
clamav-freshclam clamav-daemon libclamav-dev \ | ||
libqt5webkit5-dev xvfb xauth default-jre-headless --fix-missing --allow-unauthenticated | ||
|
||
RUN apt-get install chromium -y | ||
|
||
# Increase stack size limit to help working with large works | ||
ENV RUBY_THREAD_MACHINE_STACK_SIZE 8388608 | ||
|
||
RUN gem install rubygems-update -v 3.4.22 | ||
|
||
RUN mkdir /data | ||
WORKDIR /data | ||
|
||
# Pre-install gems so we aren't reinstalling all the gems when literally any | ||
# filesystem change happens | ||
ADD Gemfile /data | ||
ADD Gemfile.lock /data | ||
RUN mkdir /data/build | ||
ADD ./build/install_gems.sh /data/build | ||
RUN ./build/install_gems.sh | ||
RUN mkdir /data/pdfs | ||
|
||
|
||
# Add the application code | ||
ADD . /data | ||
|
||
# install node dependencies, after there are some included | ||
#RUN yarn install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,20 @@ | ||
# README | ||
# Trove | ||
|
||
This README would normally document whatever steps are necessary to get the | ||
application up and running. | ||
## About | ||
|
||
Things you may want to cover: | ||
Collections in Trove are available for use by Tufts University faculty and students, for teaching and research purposes. Collections will include images selected by faculty for teaching Art History courses. Faculty and students can create personal collections of images selected from those available in Trove. | ||
|
||
* Ruby version | ||
|
||
* System dependencies | ||
## Running Test Locally | ||
|
||
* Configuration | ||
* MIRA test docker environment should be running already | ||
|
||
* Database creation | ||
|
||
* Database initialization | ||
``` | ||
docker-compose up test | ||
docker exec -it trove_test_1 /bin/bash | ||
xvfb-run -a bundle exec rake spec SPEC_OPTS="--tag ~noci_local" | ||
|
||
* How to run the test suite | ||
``` | ||
|
||
* Services (job queues, cache servers, search engines, etc.) | ||
|
||
* Deployment instructions | ||
|
||
* ... | ||
There are two testing tags, noci and noci_local some tests aren't working in the dockerized environment we'll re-address when we move to Ruby 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
|
||
echo "Building ${RAILS_ENV}" | ||
|
||
# Remove previous servers pid | ||
rm -f tmp/puma.pid | ||
|
||
# Guarantee gems are installed in case docker image is outdated | ||
./build/install_gems.sh | ||
|
||
# Do not auto-migrate for production or staging environments | ||
if [ "${RAILS_ENV}" != 'production' ] && [ "${RAILS_ENV}" != 'staging' ]; then | ||
./build/validate_migrated.sh | ||
fi | ||
|
||
echo "Migration Validated" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
if [ "${RAILS_ENV}" = 'production' ] || [ "${RAILS_ENV}" = 'staging' ]; then | ||
echo "Bundle install without development or test gems." | ||
bundle install --without development test | ||
else | ||
bundle install --without production | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
|
||
if [ "${RAILS_ENV}" = 'production' ] || [ "${RAILS_ENV}" = 'staging' ]; then | ||
echo "Cannot auto-migrate ${RAILS_ENV} database, exiting" | ||
exit 1 | ||
fi | ||
|
||
echo "Checking ${RAILS_ENV} database migration status and auto-migrating if necessary." | ||
# If the migration status can't be read or is not fully migrated | ||
# then update the database with latest migrations | ||
if bundle exec rails db:migrate:status &> /dev/null; then | ||
bundle exec rails db:migrate | ||
fi | ||
echo "Done checking ${RAILS_ENV} database migration status" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,27 @@ | ||
# SQLite version 3.x | ||
# gem install sqlite3 | ||
# | ||
# Ensure the SQLite 3 gem is defined in your Gemfile | ||
# gem 'sqlite3' | ||
# | ||
default: &default | ||
adapter: mysql2 | ||
encoding: utf8 | ||
reconnect: false | ||
pool: 20 | ||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> | ||
timeout: 5000 | ||
database: <%= ENV['DB_NAME'] %> | ||
username: <%= ENV['DB_USERNAME'] %> | ||
password: <%= ENV['DB_PASSWORD'] %> | ||
host: <%= ENV['DB_HOST'] %> | ||
port: <%= ENV['DB_PORT'] %> | ||
|
||
development: | ||
<<: *default | ||
database: trove | ||
database: <%= ENV.fetch('DB_NAME', 'tdl_on_hyrax') %> | ||
|
||
# Warning: The database defined as "test" will be erased and | ||
# re-generated from your development database when you run "rake". | ||
# Do not set this db to the same as development or production. | ||
test: | ||
adapter: mysql2 | ||
database: trove_test | ||
user: root | ||
password: root | ||
pool: 5 | ||
timeout: 5000 | ||
<<: *default | ||
database: <%= ENV.fetch('DB_NAME', 'tdl_on_hyrax_test') %> | ||
username: <%= ENV.fetch('DB_USERNAME', 'root') %> | ||
password: <%= ENV.fetch('DB_PASSWORD', 'root') %> | ||
|
||
production: | ||
<<: *default | ||
database: trove | ||
encoding: unicode | ||
pool: 50 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#COMMON SETTINGS | ||
|
||
SERVER_PORTS="4000:4000" | ||
SERVER_EXPOSE="4000" | ||
TEST_PORTS="4101:4001" | ||
TEST_EXPOSE="4111" | ||
|
||
# APPLE SILICONE SETTINGS | ||
SELENIUM_IMAGE="seleniarm/standalone-chromium" | ||
SELENIUM_PLATFORM="linux/arm64" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#COMMON SETTINGS | ||
|
||
SERVER_PORTS="4000:4000" | ||
SERVER_EXPOSE="4000" | ||
TEST_PORTS="4101:4001" | ||
TEST_EXPOSE="4111" | ||
|
||
# INTEL SETTINGS | ||
SELENIUM_IMAGE="selenium/standalone-chrome:3.141" | ||
SELENIUM_PLATFORM="linux/amd64" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,10 @@ | ||
development: | ||
user: fedoraAdmin | ||
password: fedoraAdmin | ||
url: http://127.0.0.1:<%= ENV['FCREPO_DEVELOPMENT_PORT'] || 8984 %>/rest | ||
url: <%= ENV['FEDORA_URL'] || "http://127.0.0.1:#{ENV.fetch('FCREPO_DEVELOPMENT_PORT', 8984)}/rest" %> | ||
base_path: /dev | ||
test: | ||
user: fedoraAdmin | ||
password: fedoraAdmin | ||
url: http://127.0.0.1:<%= ENV['FCREPO_TEST_PORT'] || 8986 %>/rest | ||
url: <%= ENV['FEDORA_URL'] || "http://127.0.0.1:#{ENV.fetch('FCREPO_TEST_PORT', 8986)}/rest" %> | ||
base_path: /test | ||
production: | ||
user: fedoraAdmin | ||
password: fedoraAdmin | ||
url: http://127.0.0.1:8983/fedora/rest | ||
base_path: /prod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find the GHA container is a little slower so I bumped the sleep.