-
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
Dockerization #46
Changes from 10 commits
1401624
22135e3
fc0481b
c1ef3c9
d761b93
9b1e26d
9daf208
4d5a4c8
fcd0ced
165931f
c931ab8
d276d62
628a9cb
30e4cae
a7fdd91
f3f1fd4
75a653b
06f5187
5e02987
575da9c
121886f
2325644
eda3e17
176ed3a
556bf6a
a3f6db5
f4e6db3
f1d32cc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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] | ||
|
@@ -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 | ||
|
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/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
FROM ruby:2.7.7 | ||
|
||
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 imagemagick unzip ghostscript vim \ | ||
libqt5webkit5-dev xvfb xauth default-jre-headless --fix-missing --allow-unauthenticated | ||
|
||
RUN apt-get update && apt-get install -y wget gnupg | ||
RUN apt-get install -y wget apt-transport-https gnupg | ||
RUN echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list | ||
|
||
RUN wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public| apt-key add - \ | ||
&& apt-get update \ | ||
&& apt-get install -y temurin-8-jdk | ||
|
||
RUN update-java-alternatives --set /usr/lib/jvm/temurin-8-jdk-amd64 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suspect we may start needing this change in other places, worth noting: https://adoptium.net/blog/2023/07/adoptopenjdk-jfrog-io-has-been-deprecated/ |
||
|
||
RUN apt-get update && apt-get install -y wget unzip libatk1.0-0 libgtk-3-0 libgbm1 | ||
|
||
# Download and extract Google Chrome | ||
RUN wget https://github.com/Alex313031/thorium/releases/download/M114.0.5735.134/thorium-browser_114.0.5735.134_amd64.zip && \ | ||
unzip chrome-linux.zip -d /usr/local/bin/ && \ | ||
rm chrome-linux.zip | ||
|
||
# Create a symbolic link to the Chrome binary | ||
RUN ln -s /usr/local/bin/thorium /usr/local/bin/google-chrome | ||
RUN ln -s /usr/local/bin/thorium /usr/local/bin/chrome | ||
RUN ln -s /usr/local/bin/thorium /usr/local/bin/chromium | ||
|
||
# Cleanup unnecessary files | ||
RUN apt-get remove -y wget unzip && apt-get clean | ||
|
||
# Verify the installation | ||
RUN google-chrome --version | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can get rid of this now. |
||
|
||
# Increase stack size limit to help working with large works | ||
ENV RUBY_THREAD_MACHINE_STACK_SIZE 8388608 | ||
|
||
RUN gem update --system | ||
|
||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
development: | ||
adapter: solr | ||
url: <%= ENV['SOLR_URL'] || "http://127.0.0.1:#{ENV.fetch('SOLR_DEVELOPMENT_PORT', 8983)}/solr/hydra-development" %> | ||
test: &test | ||
adapter: solr | ||
url: <%= ENV['SOLR_URL'] || "http://127.0.0.1:#{ENV.fetch('SOLR_TEST_PORT', 8985)}/solr/hydra-test" %> | ||
production: | ||
adapter: solr | ||
url: <%= ENV['SOLR_URL'] || "http://127.0.0.1:8983/solr/epigaea" %> |
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" |
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 |
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" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
-- MySQL dump 10.13 Distrib 5.6.50, for Linux (x86_64) | ||
-- | ||
-- Host: localhost Database: trove | ||
-- ------------------------------------------------------ | ||
-- Server version 5.6.50-log | ||
|
||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; | ||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; | ||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; | ||
/*!40101 SET NAMES utf8 */; | ||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; | ||
/*!40103 SET TIME_ZONE='+00:00' */; | ||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; | ||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; | ||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; | ||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; | ||
|
||
-- | ||
-- Table structure for table `hyrax_collection_types` | ||
-- | ||
|
||
DROP TABLE IF EXISTS `hyrax_collection_types`; | ||
/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
/*!40101 SET character_set_client = utf8 */; | ||
CREATE TABLE `hyrax_collection_types` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`title` varchar(255) COLLATE utf8_bin DEFAULT NULL, | ||
`description` text COLLATE utf8_bin, | ||
`machine_id` varchar(255) COLLATE utf8_bin DEFAULT NULL, | ||
`nestable` tinyint(1) NOT NULL DEFAULT '1', | ||
`discoverable` tinyint(1) NOT NULL DEFAULT '1', | ||
`sharable` tinyint(1) NOT NULL DEFAULT '1', | ||
`allow_multiple_membership` tinyint(1) NOT NULL DEFAULT '1', | ||
`require_membership` tinyint(1) NOT NULL DEFAULT '0', | ||
`assigns_workflow` tinyint(1) NOT NULL DEFAULT '0', | ||
`assigns_visibility` tinyint(1) NOT NULL DEFAULT '0', | ||
`share_applies_to_new_works` tinyint(1) NOT NULL DEFAULT '1', | ||
`brandable` tinyint(1) NOT NULL DEFAULT '1', | ||
`badge_color` varchar(255) COLLATE utf8_bin DEFAULT '#663333', | ||
PRIMARY KEY (`id`), | ||
UNIQUE KEY `index_hyrax_collection_types_on_machine_id` (`machine_id`) | ||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; | ||
/*!40101 SET character_set_client = @saved_cs_client */; | ||
|
||
-- | ||
-- Dumping data for table `hyrax_collection_types` | ||
-- | ||
|
||
LOCK TABLES `hyrax_collection_types` WRITE; | ||
/*!40000 ALTER TABLE `hyrax_collection_types` DISABLE KEYS */; | ||
INSERT INTO `hyrax_collection_types` VALUES (1,'User Collection','A User Collection can be created by any user to organize their works.','user_collection',1,1,1,1,0,0,0,0,1,'#705070'),(2,'Admin Set','An aggregation of works that is intended to help with administrative control. Admin Sets provide a way of defining behaviors and policies around a set of works.','admin_set',0,0,1,0,1,1,1,1,0,'#405060'),(3,'Course Collection','For Trove','course_collection',1,1,1,1,0,0,0,1,1,'#663333'),(4,'Personal Collection','For Trove','personal_collection',1,1,1,1,0,0,0,1,1,'#663333'); | ||
/*!40000 ALTER TABLE `hyrax_collection_types` ENABLE KEYS */; | ||
UNLOCK TABLES; | ||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; | ||
|
||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; | ||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; | ||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; | ||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; | ||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; | ||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; | ||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; | ||
|
||
-- Dump completed on 2023-08-30 10:54:38 |
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 |
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="4001:4001" | ||
TEST_EXPOSE="4001" | ||
|
||
# APPLE SILICONE SETTINGS | ||
SELENIUM_IMAGE="seleniarm/standalone-chromium" | ||
SELENIUM_PLATFORM="linux/arm64" |
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="4001:4001" | ||
TEST_EXPOSE="4001" | ||
|
||
# INTEL SETTINGS | ||
SELENIUM_IMAGE="selenium/standalone-chrome:3.141" | ||
SELENIUM_PLATFORM="linux/amd64" |
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# This is a sample config file that points to a solr server for each environment | ||
development: | ||
url: http://127.0.0.1:<%= ENV['SOLR_TEST_PORT'] || 8983 %>/solr/hydra-development | ||
url: <%= ENV['SOLR_URL'] || "http://127.0.0.1:#{ENV.fetch('SOLR_DEVELOPMENT_PORT', 8983)}/solr/hydra-development" %> | ||
test: | ||
url: http://127.0.0.1:<%= ENV['SOLR_TEST_PORT'] || 8985 %>/solr/hydra-test | ||
url: <%= ENV['SOLR_URL'] || "http://127.0.0.1:#{ENV.fetch('SOLR_TEST_PORT', 8985)}/solr/hydra-test" %> | ||
production: | ||
url: http://your.production.server:8080/bl_solr/core0 | ||
url: <%= ENV['SOLR_URL'] || "http://127.0.0.1:8983/solr/nurax" %> |
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.