Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
45f2774
Use dotenv-rails in production as well
Dantemss Oct 20, 2020
5dd3145
Removed a15k and its secrets
Dantemss Oct 21, 2020
5230817
Copied puma config from Tutor and added pool setting for database
Dantemss Oct 22, 2020
0f8c1f8
Added rake task to update secrets and removed unicorn
Dantemss Oct 23, 2020
2d1cc16
Restored default env vars for puma.rb (removed puma namespace)
Dantemss Oct 23, 2020
166cd0f
Log to STDOUT and let systemd handle the logs
Dantemss Oct 26, 2020
26358de
Split the Redis url secret
Dantemss Oct 28, 2020
2137f26
Backported rake db:prepare from Rails 6
Dantemss Oct 30, 2020
7d27f10
update_secrets can now fetch the rds superuser username and password …
Dantemss Nov 2, 2020
6e5f7dd
More bugfixes for update_secrets
Dantemss Nov 3, 2020
66202c7
Quote environment variables in .env file
Dantemss Nov 3, 2020
1a7af6f
Also require and set RELEASE_VERSION from the environment
Dantemss Nov 4, 2020
b31c6c5
Use Shellwords to escape secrets instead of manual quotes
Dantemss Nov 4, 2020
1192860
Moved secrets task to deployment script and removed backport
Dantemss Nov 4, 2020
fba394c
Fixed puma config and added puma binstubs
Dantemss Nov 5, 2020
33f8400
Load dotenv before puma config
Dantemss Nov 6, 2020
67ba548
Updated .gitignore with Rails 6 defaults
Dantemss Nov 9, 2020
67ed6f1
Removed SES and made assets precompile in production mode without sec…
Dantemss Nov 9, 2020
890d593
Use encryption to communicate with Redis
Dantemss Nov 10, 2020
444ed71
Made scout log file path configurable
Dantemss Nov 10, 2020
2cddae9
Updated puma
Dantemss Nov 11, 2020
69672ec
Disable scout until explicitly enabled
Dantemss Nov 23, 2020
6fa205c
Updated puma
Dantemss Nov 30, 2020
545f7b6
Removed unused whenever gem
Dantemss Jan 20, 2021
9926835
Silence "Sentry is ready" log messages
Dantemss Jan 20, 2021
eb21db4
Switch Exercises to using the new buckets
Dantemss Jan 20, 2021
a40e4a7
Replaced Travis with GH actions
Dantemss Jan 20, 2021
ecd4a4e
Added fake S3 config for the test env
Dantemss Jan 20, 2021
8e922db
Updated README badges
Dantemss Jan 20, 2021
9b6d145
Added status page
Dantemss Jan 20, 2021
8ebade6
Updated openstax_utilities so status page works when DJ is not installed
Dantemss Jan 20, 2021
abe6770
Tweak puma_worker_killer settings for Exercises
Dantemss Jan 20, 2021
1543bb9
Fixed binstubs
Dantemss Jan 21, 2021
e1504a5
Removed unicorn from config.ru
Dantemss Jan 21, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/migrations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Migrations

on:
pull_request:
types:
- opened
- edited
- synchronize
- reopened

jobs:
migrations:
timeout-minutes: 30
runs-on: ubuntu-18.04
services:
postgres:
image: postgres:11
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
redis:
image: redis
ports:
- 6379:6379
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5


steps:
# Clone repo and checkout merge commit parent (PR target commit)
- uses: actions/checkout@v2
with:
fetch-depth: 2

- run: git checkout HEAD^

# Install ruby
- uses: actions/setup-ruby@v1
with:
ruby-version: 2.6

# Retrieve gem cache for merge commit parent
- uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-parent-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-parent-

# Install gems, create data to be migrated and revert to PR merge commit
- name: Create data to be migrated
env:
OXE_DB_USER: postgres
OXE_DB_PASS: postgres
run: |
gem install bundler
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
bundle exec rake db:create db:schema:load db:seed --trace
bundle exec rails runner '10.times { FactoryBot.create :exercise }'
git checkout -

# Retrieve gem cache for PR merge commit
- uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-pr-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-pr-

# Migrate the data
- name: Migrate
env:
OXE_DB_USER: postgres
OXE_DB_PASS: postgres
run: |
bundle install --jobs 4 --retry 3
bundle exec rake db:migrate
55 changes: 55 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Tests

on:
pull_request:
push:
branches:
- main
schedule:
- cron: '0 0 * * 0' # weekly

jobs:
tests:
timeout-minutes: 30
runs-on: ubuntu-18.04
services:
postgres:
image: postgres:11
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
env:
POSTGRES_USER: postgres
POSTGRES_DB: ci_test
POSTGRES_PASSWORD: postgres
strategy:
matrix:
tests:
- name: 'assets'
args: 'ASSETS=true'
- name: 'tests'
args: 'ASSETS=false'

steps:
- uses: actions/checkout@v2
- uses: actions/setup-ruby@v1
with:
ruby-version: 2.6
- uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-pr-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-pr-
- name: Test
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
OXT_DB_USER: postgres
OXT_TEST_DB: ci_test
OXT_DB_PASS: postgres
RAILS_ENV: test
run: |
gem install bundler
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
${{ matrix.tests.args }} ./bin/ci
105 changes: 71 additions & 34 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,57 +1,94 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile ~/.gitignore_global
*.rbc
capybara-*.html
.rspec
/db/*.sqlite3
/db/*.sqlite3-journal
/db/*.sqlite3-[0-9]*
/public/system
/coverage/
/spec/tmp
*.orig
rerun.txt
pickle-email-*.html

# Ignore bundler config
# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# TODO Comment out this rule if you are OK with secrets being uploaded to the repo
config/initializers/secret_token.rb
config/master.key

# Only include if you have production secrets in this file, which is no longer a Rails default
# config/secrets.yml

# dotenv, dotenv-rails
# TODO Comment out these rules if environment variables can be committed
.env
.env.*

## Environment normalization:
/.bundle
/vendor/bundle

# Ignore installed gems
vendor
# these should all be checked in to normalize the environment:
# Gemfile.lock, .ruby-version, .ruby-gemset

# Ignore the default SQLite database and yaml_db database files
/db/*.sqlite3*
/db/data.yml*
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

# Ignore all logfiles and tempfiles.
/log/*.log
/tmp/**/*
# if using bower-rails ignore default bower_components path bower.json files
/vendor/assets/bower_components
*.bowerrc
bower.json

# Ignore pow environment settings
.powenv

# Ignore Byebug command history file.
.byebug_history

# Ignore node_modules
node_modules/

# Ignore files containing keys and passwords
config/*settings.yml
# Ignore precompiled javascript packs
/public/packs
/public/packs-test
/public/assets

# Ignore compiled assets and uploaded files
public/assets/**/*
public/attachments/**/*
# Ignore yarn files
/yarn-error.log
yarn-debug.log*
.yarn-integrity

# Ignore vagrant and berkshelf files
.vagrant*
.vagrant_setup.json
Berksfile.lock
# Ignore uploaded files in development
/storage/*
!/storage/.keep
/public/uploads

# Ignore attached files in development
/public/attachments

# Ignore Cucumber and RSpec failure information
cucumber_rerun.txt
rspec.failures

# Ignore brakeman reports
brakeman.html
# Ignore webdrivers lock file
.webdrivers_update

# Ignore coverage reports
coverage/*

# Ignore ERD diagrams
erd*.pdf

# Ignore misc files
notes
# Ignore brakeman reports
brakeman.html

# Ignore gedit and OSX temp files
# Ignore editor temp files
*~
*.DS_Store

# Ignore dotenv env variable definitions
.env

# Ignore byebug history
.byebug_history
# Ignore OS X's Desktop Service Store files
*.DS_Store
32 changes: 0 additions & 32 deletions .travis.yml

This file was deleted.

31 changes: 15 additions & 16 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ gem 'sanitize'
# Utilities for OpenStax websites
gem 'openstax_utilities'

# Cron job scheduling
gem 'whenever'

# Talks to Accounts (latest version is broken)
gem 'omniauth-oauth2'

Expand Down Expand Up @@ -114,14 +111,18 @@ gem 'scout_apm', '~> 3.0.pre28'
# PostgreSQL database
gem 'pg'

# Support systemd Type=notify services for puma
gem 'sd_notify', require: false

# Use the puma webserver
gem 'puma'

# Prevent server memory from growing until OOM
gem 'puma_worker_killer'

# HTTP requests
gem 'httparty'

gem 'a15k_client',
git: 'https://github.com/a15k/mothership.git',
glob: 'clients/1.0.0/ruby/*gemspec',
branch: 'master'

# Notify developers of Exceptions in production
gem 'openstax_rescue_from'

Expand Down Expand Up @@ -151,10 +152,10 @@ gem 'bootsnap', '~> 1.4.0', require: false
# Bulk inserts and upserts
gem 'activerecord-import'

group :development, :test do
# Get env variables from .env file
gem 'dotenv-rails'
# Get env variables from .env file
gem 'dotenv-rails'

group :development, :test do
# Run specs in parallel
gem 'parallel_tests'

Expand Down Expand Up @@ -221,11 +222,9 @@ group :test do
end

group :production do
# Unicorn production server
gem 'unicorn'

# Unicorn worker killer
gem 'unicorn-worker-killer'
# Used to fetch secrets from the AWS parameter store and secrets manager
gem 'aws-sdk-ssm', require: false
gem 'aws-sdk-secretsmanager', require: false

# AWS SES
gem 'aws-ses', '~> 0.6.0', require: 'aws/ses'
Expand Down
Loading