Commit 4f31b440 authored by Zac Wood's avatar Zac Wood

prepare for switch to mysql for production

parent 36f68c0d
Pipeline #5199 failed with stages
in 11 minutes and 48 seconds
......@@ -28,3 +28,5 @@ yarn-debug.log*
coverage
subjects
/config/master.key
......@@ -8,14 +8,9 @@ EXPOSE 3000
ENV RAILS_ENV production
RUN bundle install
RUN bundle install --without development test
RUN yarn install
RUN export SECRET_KEY_BASE=$(rails secret)
RUN export RAILS_MASTER_KEY=$SECRET_KEY_BASE
RUN rails assets:precompile
RUN rails db:migrate
RUN rails db:seed
RUN rails runner db/load_course_ratings.rb
RUN whenever --update-crontab
......
......@@ -46,6 +46,10 @@ group :development do
gem 'spring-watcher-listen', '~> 2.0.0'
end
group :production do
gem 'mysql2'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
......
......@@ -112,6 +112,7 @@ GEM
mini_portile2 (2.4.0)
minitest (5.13.0)
multi_xml (0.6.0)
mysql2 (0.5.2)
nio4r (2.5.2)
nokogiri (1.10.5)
mini_portile2 (~> 2.4.0)
......@@ -255,6 +256,7 @@ DEPENDENCIES
icalendar
jbuilder
listen (>= 3.0.5, < 3.2)
mysql2
nokogiri
pry
pry-doc
......
......@@ -34,13 +34,6 @@ class CourseSection < ApplicationRecord
end
end
def overlaps?(other)
t1_start, t1_end = Time.parse(start_time), Time.parse(end_time)
t2_start, t2_end = Time.parse(other.start_time), Time.parse(other.end_time)
(t1_start <= t2_end && t2_start <= t1_end) && Set.new(days.split).intersect?(Set.new(other.days.split))
end
def self.latest_by_crn(crn)
sems = Semester.sorted_by_date
where(crn: crn).min_by { |s| sems.find_index(s.semester) }
......
......@@ -5,32 +5,28 @@
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
<<: *default
database: db/development.sqlite3
# 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:
<<: *default
database: db/test.sqlite3
<<: *default
database: db/test.sqlite3
production:
<<: *default
database: db/production.sqlite3
# production:
# adapter: postgresql
# encoding: unicode
# database: <%= ENV.fetch("DB_DATABASE") { "" } %>
# username: <%= ENV.fetch("DB_USERNAME") { "" } %>
# password: <%= ENV.fetch("DB_PASSWORD") { "" } %>
# host: <%= ENV.fetch("DB_HOST") { "localhost" } %>
# port: <%= ENV.fetch("DB_PORT") { 5432 } %>
# pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
# timeout: 5000
adapter: mysql2
encoding: unicode
database: <%= ENV.fetch("DB_DATABASE") { "" } %>
username: <%= ENV.fetch("DB_USERNAME") { "" } %>
password: <%= ENV.fetch("DB_PASSWORD") { "" } %>
host: <%= ENV.fetch("DB_HOST") { "localhost" } %>
port: <%= ENV.fetch("DB_PORT") { 5432 } %>
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment