-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit: Rails 7.1 app, lightly based on ATC app setup (with b…
…asic GCP and AWS client setup, plus rspec, rubocop, devise, and resque)
- Loading branch information
0 parents
commit 2048fd8
Showing
121 changed files
with
3,478 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files. | ||
|
||
# Ignore git directory. | ||
/.git/ | ||
|
||
# Ignore bundler config. | ||
/.bundle | ||
|
||
# Ignore all environment files (except templates). | ||
/.env* | ||
!/.env*.erb | ||
|
||
# Ignore all default key files. | ||
/config/master.key | ||
/config/credentials/*.key | ||
|
||
# Ignore all logfiles and tempfiles. | ||
/log/* | ||
/tmp/* | ||
!/log/.keep | ||
!/tmp/.keep | ||
|
||
# Ignore pidfiles, but keep the directory. | ||
/tmp/pids/* | ||
!/tmp/pids/.keep | ||
|
||
# Ignore storage (uploaded files in development and any SQLite databases). | ||
/storage/* | ||
!/storage/.keep | ||
/tmp/storage/* | ||
!/tmp/storage/.keep | ||
|
||
# Ignore assets. | ||
/node_modules/ | ||
/app/assets/builds/* | ||
!/app/assets/builds/.keep | ||
/public/assets |
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,9 @@ | ||
# See https://git-scm.com/docs/gitattributes for more about git attribute files. | ||
|
||
# Mark the database schema as having been generated. | ||
db/schema.rb linguist-generated | ||
|
||
# Mark any vendored files as having been vendored. | ||
vendor/* linguist-vendored | ||
config/credentials/*.yml.enc diff=rails_credentials | ||
config/credentials.yml.enc diff=rails_credentials |
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,27 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ '*' ] | ||
|
||
jobs: | ||
ci-rails-app: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
ruby-version: ['3.2.2'] | ||
env: | ||
RAILS_ENV: test | ||
NOKOGIRI_USE_SYSTEM_LIBRARIES: true | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Add --no-document option to .gemrc file to speed up bundle install | ||
run: "echo 'gem: --no-document' > ~/.gemrc" | ||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby-version }} | ||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | ||
- name: Run CI task | ||
run: bundle exec rake check_please:ci |
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,54 @@ | ||
# See https://help.github.com/articles/ignoring-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' | ||
|
||
# Ignore bundler config. | ||
/.bundle | ||
|
||
# Ignore all environment files (except templates). | ||
/.env* | ||
!/.env*.erb | ||
|
||
# Ignore all logfiles and tempfiles. | ||
/log/* | ||
/tmp/* | ||
!/log/.keep | ||
!/tmp/.keep | ||
|
||
# Ignore pidfiles, but keep the directory. | ||
/tmp/pids/* | ||
!/tmp/pids/ | ||
!/tmp/pids/.keep | ||
|
||
# Ignore storage (uploaded files in development and any SQLite databases). | ||
/storage/* | ||
!/storage/.keep | ||
/tmp/storage/* | ||
!/tmp/storage/ | ||
!/tmp/storage/.keep | ||
|
||
/public/assets | ||
|
||
# Ignore master key for decrypting credentials and more. | ||
/config/master.key | ||
|
||
# Editor files | ||
*~ | ||
\#*\# | ||
|
||
# macOS files | ||
.DS_Store | ||
|
||
# Config file ignores | ||
/config/check_please.yml | ||
/config/aws.yml | ||
/config/gcp.yml | ||
/config/database.yml | ||
/config/permissions.yml | ||
/config/redis.yml | ||
/config/resque.yml | ||
|
||
# simplecov coverage report | ||
/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 @@ | ||
--require spec_helper |
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,21 @@ | ||
inherit_gem: | ||
rubocul: rubocul_default.yml | ||
|
||
inherit_from: .rubocop_todo.yml | ||
|
||
AllCops: | ||
TargetRubyVersion: 3.2.2 | ||
TargetRailsVersion: 7.1 | ||
DisplayCopNames: true | ||
Exclude: | ||
- 'bin/**/*' | ||
- 'db/**/*' | ||
- 'app/javascript/**/*' | ||
- 'config/environments/**/*' | ||
- 'node_modules/**/*' | ||
- 'vendor/**/*' | ||
- 'lib/tasks/**/*' | ||
- 'tmp/**/*' | ||
|
||
Lint/MissingCopEnableDirective: | ||
Enabled: false |
Empty file.
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 @@ | ||
3.2.2 |
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,19 @@ | ||
# frozen_string_literal: true | ||
|
||
# Load DSL and set up stages | ||
require 'capistrano/setup' | ||
|
||
# Include default deployment tasks | ||
require 'capistrano/deploy' | ||
|
||
# Git SCM plugin | ||
require 'capistrano/scm/git' | ||
install_plugin Capistrano::SCM::Git | ||
|
||
# additional modules | ||
require 'capistrano/rails' | ||
require 'capistrano/passenger' | ||
require 'capistrano/cul' | ||
|
||
# Load custom tasks from `lib/capistrano/tasks` if you have any defined | ||
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } |
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,62 @@ | ||
# syntax = docker/dockerfile:1 | ||
|
||
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile | ||
ARG RUBY_VERSION=3.2.2 | ||
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base | ||
|
||
# Rails app lives here | ||
WORKDIR /rails | ||
|
||
# Set production environment | ||
ENV RAILS_ENV="production" \ | ||
BUNDLE_DEPLOYMENT="1" \ | ||
BUNDLE_PATH="/usr/local/bundle" \ | ||
BUNDLE_WITHOUT="development" | ||
|
||
|
||
# Throw-away build stage to reduce size of final image | ||
FROM base as build | ||
|
||
# Install packages needed to build gems | ||
RUN apt-get update -qq && \ | ||
apt-get install --no-install-recommends -y build-essential git libvips pkg-config | ||
|
||
# Install application gems | ||
COPY Gemfile Gemfile.lock ./ | ||
RUN bundle install && \ | ||
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \ | ||
bundle exec bootsnap precompile --gemfile | ||
|
||
# Copy application code | ||
COPY . . | ||
|
||
# Precompile bootsnap code for faster boot times | ||
RUN bundle exec bootsnap precompile app/ lib/ | ||
|
||
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY | ||
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile | ||
|
||
|
||
# Final stage for app image | ||
FROM base | ||
|
||
# Install packages needed for deployment | ||
RUN apt-get update -qq && \ | ||
apt-get install --no-install-recommends -y curl libsqlite3-0 libvips && \ | ||
rm -rf /var/lib/apt/lists /var/cache/apt/archives | ||
|
||
# Copy built artifacts: gems, application | ||
COPY --from=build /usr/local/bundle /usr/local/bundle | ||
COPY --from=build /rails /rails | ||
|
||
# Run and own only the runtime files as a non-root user for security | ||
RUN useradd rails --create-home --shell /bin/bash && \ | ||
chown -R rails:rails db log storage tmp | ||
USER rails:rails | ||
|
||
# Entrypoint prepares the database. | ||
ENTRYPOINT ["/rails/bin/docker-entrypoint"] | ||
|
||
# Start the server by default, this can be overwritten at runtime | ||
EXPOSE 3000 | ||
CMD ["./bin/rails", "server"] |
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,106 @@ | ||
# frozen_string_literal: true | ||
|
||
source 'https://rubygems.org' | ||
|
||
# URL encoding | ||
gem 'addressable', '~> 2.8' | ||
# Amazon S3 SDK | ||
gem 'aws-sdk-s3', '~> 1' | ||
# gem 'aws-sdk-s3', git: 'https://github.com/elohanlon/aws-sdk-ruby', | ||
# branch: 's3_allow_custom_multipart_part_size_during_object_upload', glob: 'gems/aws-sdk-s3/*.gemspec' | ||
# Additional gem enabling the AWS SDK to calculate CRC32C checksums | ||
gem 'aws-crt', '~> 0.2.0' | ||
# For file type determination | ||
gem 'best_type', '~> 1.0' | ||
# Reduces boot times through caching; required in config/boot.rb | ||
gem 'bootsnap', require: false | ||
# Add CRC32C support to the Ruby Digest module | ||
gem 'digest-crc', '~> 0.6.5' | ||
# Google Cloud Storage SDK | ||
gem 'google-cloud-storage', '~> 1.49' | ||
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails] | ||
gem 'importmap-rails' | ||
# Build JSON APIs with ease [https://github.com/rails/jbuilder] | ||
gem 'jbuilder' | ||
# Use mysql as a database option for Active Record | ||
gem 'mysql2', '~> 0.5.6' | ||
# Use the Puma web server for local development [https://github.com/puma/puma] | ||
gem 'puma', '~> 6.0' | ||
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" | ||
gem 'rails', '~> 7.1.3', '>= 7.1.3.2' | ||
# Rainbow for text coloring | ||
gem 'rainbow', '~> 3.0' | ||
# Use Redis adapter to run Action Cable in production | ||
gem 'redis', '~> 4.8' # NOTE: Updating the redis gem to v5 breaks the current redis namespace setup | ||
# For namespacing the Redis keys used by resque | ||
gem 'redis-namespace', '~> 1.11' | ||
# Resque for queued jobs | ||
gem 'resque', '~> 2.6' | ||
# Resque for retrying code after errors | ||
gem 'retriable', '~> 3.1' | ||
# We don't actually use sinatra directly, but it is used by resque. | ||
# We need to pin to 3.x because 4.x introduces a conflict. | ||
# The line below can be removed if resque ever stops requiring sinatra. | ||
gem 'sinatra', '~> 3.0' | ||
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails] | ||
gem 'sprockets-rails' | ||
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev] | ||
gem 'stimulus-rails' | ||
# Unicode to ASCII transliteration [https://rubygems.org/gems/stringex/] | ||
gem 'stringex', '~> 2.8', '>= 2.8.6' | ||
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev] | ||
gem 'turbo-rails' | ||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem | ||
gem 'tzinfo-data', platforms: %i[windows jruby] | ||
|
||
# Use devise and omniauth for authentication | ||
gem 'devise' | ||
gem 'omniauth' | ||
gem 'omniauth-cul', '~> 0.2.0' | ||
|
||
# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis] | ||
# gem "kredis" | ||
|
||
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword] | ||
# gem "bcrypt", "~> 3.1.7" | ||
|
||
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images] | ||
# gem "image_processing", "~> 1.2" | ||
|
||
group :development, :test do | ||
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem | ||
gem 'debug', platforms: %i[mri windows] | ||
# Use sqlite3 as the database for Active Record | ||
gem 'sqlite3', '~> 1.4' | ||
# Rubocul for linting | ||
gem 'rubocul', '~> 4.0.11' | ||
# gem 'rubocul', path: '../rubocul' | ||
end | ||
|
||
group :development do | ||
# Use Capistrano for deployment | ||
gem 'capistrano', '~> 3.18.0', require: false | ||
gem 'capistrano-cul', require: false | ||
gem 'capistrano-passenger', '~> 0.1', require: false | ||
gem 'capistrano-rails', '~> 1.4', require: false | ||
|
||
# Use console on exceptions pages [https://github.com/rails/web-console] | ||
gem 'web-console' | ||
|
||
# Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler] | ||
# gem "rack-mini-profiler" | ||
|
||
# Speed up commands on slow machines / big apps [https://github.com/rails/spring] | ||
# gem "spring" | ||
|
||
# simplecov for test coverage | ||
gem 'simplecov', '~> 0.22', require: false | ||
end | ||
|
||
group :test do | ||
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing] | ||
gem 'capybara' | ||
gem 'factory_bot_rails' | ||
gem 'rspec-rails' | ||
gem 'selenium-webdriver' | ||
end |
Oops, something went wrong.