Initial commit

This commit is contained in:
Celina Lopez
2024-09-25 13:52:06 -07:00
parent 98c265c50b
commit 67dd26ca9d
121 changed files with 2254 additions and 1415 deletions

View File

@@ -2,6 +2,7 @@
# Ignore git directory.
/.git/
/.gitignore
# Ignore bundler config.
/.bundle
@@ -35,3 +36,13 @@
/app/assets/builds/*
!/app/assets/builds/.keep
/public/assets
# Ignore CI service files.
/.github
# Ignore development files
/.devcontainer
# Ignore Docker-related files
/.dockerignore
/Dockerfile*

1
.foreman Normal file
View File

@@ -0,0 +1 @@
procfile: Procfile.dev

12
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: bundler
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10

101
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,101 @@
name: CI
on:
pull_request:
push:
branches: [ main ]
jobs:
scan_ruby:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Scan for common Rails security vulnerabilities using static analysis
run: bin/brakeman --no-pager
scan_js:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Scan for security vulnerabilities in JavaScript dependencies
run: bin/importmap audit
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Lint code for consistent style
run: bin/rubocop -f github
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3
# redis:
# image: redis
# ports:
# - 6379:6379
# options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Install packages
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y google-chrome-stable curl libjemalloc2 libvips postgresql-client
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Run tests
env:
RAILS_ENV: test
DATABASE_URL: postgres://postgres:postgres@localhost:5432
# REDIS_URL: redis://localhost:6379/0
run: bin/rails db:test:prepare test test:system
- name: Keep screenshots from failed system tests
uses: actions/upload-artifact@v4
if: failure()
with:
name: screenshots
path: ${{ github.workspace }}/tmp/screenshots
if-no-files-found: ignore

6
.gitignore vendored
View File

@@ -1,8 +1,8 @@
# 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'
# Temporary files generated by your text editor or operating system
# belong in git's global ignore instead:
# `$XDG_CONFIG_HOME/git/ignore` or `~/.config/git/ignore`
# Ignore bundler config.
/.bundle

8
.rubocop.yml Normal file
View File

@@ -0,0 +1,8 @@
# Omakase Ruby styling for Rails
inherit_gem: { rubocop-rails-omakase: rubocop.yml }
# Overwrite or add rules to create your own house style
#
# # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
# Layout/SpaceInsideArrayLiteralBrackets:
# Enabled: false

View File

@@ -1 +1 @@
3.3.1
3.3.4

View File

@@ -1,25 +1,34 @@
# syntax = docker/dockerfile:1
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.3.1
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
# This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand:
# docker build -t my-app .
# docker run -d -p 80:80 -p 443:443 --name my-app -e RAILS_MASTER_KEY=<value from config/master.key> my-app
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
ARG RUBY_VERSION=3.3.4
FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base
# Rails app lives here
WORKDIR /rails
# Install base packages
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y curl libjemalloc2 libvips postgresql-client && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives
# 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
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 libpq-dev libvips pkg-config
apt-get install --no-install-recommends -y build-essential git libpq-dev pkg-config && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives
# Install application gems
COPY Gemfile Gemfile.lock ./
@@ -37,22 +46,20 @@ RUN bundle exec bootsnap precompile app/ lib/
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 libvips postgresql-client && \
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 "${BUNDLE_PATH}" "${BUNDLE_PATH}"
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 && \
RUN groupadd --system --gid 1000 rails && \
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
chown -R rails:rails db log storage tmp
USER rails:rails
USER 1000:1000
# Entrypoint prepares the database.
ENTRYPOINT ["/rails/bin/docker-entrypoint"]

147
Gemfile
View File

@@ -1,106 +1,73 @@
# frozen_string_literal: true
source "https://rubygems.org"
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby file: '.ruby-version'
gem 'rails', '~> 7.1.3' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'bootsnap', '>= 1.4.2', require: false # Reduces boot times through caching; required in config/boot.rb
gem 'dotenv', '~> 3.1'
gem 'image_processing', '~> 1.12' # Use Active Storage variants
gem 'jbuilder', github: 'excid3/jbuilder', branch: 'partial-paths' # "~> 2.11" # Build JSON APIs with ease
gem 'k8s-ruby', '~> 0.16.0'
gem 'kubeclient', '~> 4.11'
gem 'light-service', '~> 0.18.0' # business logic framework
gem 'nokogiri', '>= 1.12.5' # Security update
gem 'octokit', '~> 9.1' # github API client
gem 'omniauth-digitalocean', '~> 0.3.2' # DigitalOcean OAuth2 strategy for OmniAuth
gem 'pg' # Use postgresql as the database for Active Record
gem 'puma', '~> 6.0' # Use the Puma web server
gem 'redis', '~> 5.1' # Use Redis adapter to run Action Cable in production
gem 'sprockets-rails', '>= 3.4.1' # The original asset pipeline for Rails
gem 'stimulus-rails', '~> 1.0', '>= 1.0.2' # Hotwire's modest JavaScript framework
gem 'turbo-rails', '~> 2.0.3' # Hotwire's SPA-like page accelerator
gem 'tzinfo-data', platforms: %i[windows jruby] # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.2.1"
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"
# Use postgresql as the database for Active Record
gem "pg", "~> 1.1"
# Use the Puma web server [https://github.com/puma/puma]
gem "puma", ">= 5.0"
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem "importmap-rails"
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem "turbo-rails"
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem "stimulus-rails"
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"
# Use Redis adapter to run Action Cable in production
# gem "redis", ">= 4.0.1"
# 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"
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ windows jruby ]
# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"
group :development, :test do
# debug gems
gem 'debug', platforms: %i[mri windows], require: 'debug/prelude'
gem 'pry', '~> 0.14.2'
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
# Lint code for consistent style
gem 'erb_lint', require: false
gem 'standard', require: false
# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
gem "brakeman", require: false
gem 'brakeman', require: false # Static analysis for security vulnerabilities [https://brakemanscanner.org/]
gem 'letter_opener_web', '~> 3.0' # Preview mail in the browser instead of sending
# Optional debugging tools
# gem "byebug", platforms: [:mri, :mingw, :x64_mingw]
# gem "pry-rails"
# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
gem "rubocop-rails-omakase", require: false
end
group :development do
# Use console on exceptions pages [https://github.com/rails/web-console]
gem 'annotate', '~> 3.2' # Annotate models and tests with database columns
gem 'web-console', '>= 4.1.0'
gem 'overcommit', require: false # A fully configurable and extendable Git hook manager
# Add speed badges
# gem "rack-mini-profiler", ">= 2.3.3"
# Speed up commands on slow machines / big apps
# gem "spring"
gem "web-console"
end
group :test do
# Use system testing
gem 'capybara', '>= 3.39'
gem 'selenium-webdriver', '>= 4.20.1'
gem 'webmock'
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
gem "capybara"
gem "selenium-webdriver"
end
# We recommend using strong migrations when your app is in production
# gem "strong_migrations"
# Add dependencies for your application in the main Gemfile
gem 'administrate', github: 'excid3/administrate'
gem 'administrate-field-active_storage', '~> 1.0.0'
gem 'country_select', '~> 9.0'
gem 'cssbundling-rails', '~> 1.4.0'
gem 'devise', github: 'excid3/devise', branch: 'sign-in-after-reset-password-proc' # "~> 4.9.0"
gem 'devise-i18n', '~> 1.10'
gem 'inline_svg', '~> 1.6'
gem 'invisible_captcha', '~> 2.0'
gem 'jsbundling-rails', '~> 1.3.0'
gem 'local_time', '~> 3.0'
gem 'name_of_person', '~> 1.0'
gem 'noticed', '~> 2.2'
gem 'pagy', '~> 8.0'
gem 'pay', '~> 7.1'
gem 'prefixed_ids', '~> 1.2'
gem 'pretender', '~> 0.4'
gem 'pundit', '~> 2.1'
gem 'receipts', '~> 2.1'
gem 'rotp', '~> 6.2'
gem 'rqrcode', '~> 2.1'
gem 'ruby-oembed', '~> 0.17.0', require: 'oembed'
gem 'oj', '~> 3.8'
gem 'omniauth', '~> 2.1'
gem 'omniauth-github'
gem 'omniauth-rails_csrf_protection', '~> 1.0'
gem 'mission_control-jobs'
gem 'solid_queue'
gem "tailwindcss-rails", "~> 2.7"
gem "friendly_id", "~> 5.5"
gem "cssbundling-rails"
gem "devise", "~> 4.9"
gem "friendly_id", "~> 5.4"
gem "jsbundling-rails"
gem "madmin"
gem "name_of_person", github: "basecamp/name_of_person"
gem "noticed", "~> 2.0"
gem "omniauth-facebook", "~> 8.0"
gem "omniauth-github", "~> 2.0"
gem "omniauth-twitter", "~> 1.4"
gem "pretender", "~> 0.3.4"
gem "pundit", "~> 2.1"
gem "sidekiq", "~> 6.2"
gem "sitemap_generator", "~> 6.1"
gem "whenever", require: false
gem "responders", github: "heartcombo/responders", branch: "main"

View File

@@ -1,132 +1,97 @@
GIT
remote: https://github.com/excid3/administrate.git
revision: a345248f4e66237816f3195893e1edf02d7be28f
remote: https://github.com/basecamp/name_of_person.git
revision: bab0a4496a167fc5e153f4eb6514ba45f5d26338
specs:
administrate (0.20.1)
actionpack (>= 6.0, < 8.0)
actionview (>= 6.0, < 8.0)
activerecord (>= 6.0, < 8.0)
jquery-rails (~> 4.6.0)
kaminari (~> 1.2.2)
sassc-rails (~> 2.1)
selectize-rails (~> 0.6)
name_of_person (1.1.3)
activesupport (>= 5.2.0)
GIT
remote: https://github.com/excid3/devise.git
revision: 871c1b7cf6a0cc24b5f8fd5bc165d9c261a6da23
branch: sign-in-after-reset-password-proc
remote: https://github.com/heartcombo/responders.git
revision: 9bdc60dfbfa8001641c1c4df7bc73c3fc2a4cf41
branch: main
specs:
devise (4.9.3)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 6.0.0)
responders
warden (~> 1.2.3)
GIT
remote: https://github.com/excid3/jbuilder.git
revision: 52791b57350b200b2fcf25b674aca91384d56e1d
branch: partial-paths
specs:
jbuilder (2.12.0)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
responders (3.1.1)
actionpack (>= 5.2)
railties (>= 5.2)
GEM
remote: https://rubygems.org/
specs:
actioncable (7.1.4)
actionpack (= 7.1.4)
activesupport (= 7.1.4)
actioncable (7.2.1)
actionpack (= 7.2.1)
activesupport (= 7.2.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.1.4)
actionpack (= 7.1.4)
activejob (= 7.1.4)
activerecord (= 7.1.4)
activestorage (= 7.1.4)
activesupport (= 7.1.4)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.1.4)
actionpack (= 7.1.4)
actionview (= 7.1.4)
activejob (= 7.1.4)
activesupport (= 7.1.4)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
actionmailbox (7.2.1)
actionpack (= 7.2.1)
activejob (= 7.2.1)
activerecord (= 7.2.1)
activestorage (= 7.2.1)
activesupport (= 7.2.1)
mail (>= 2.8.0)
actionmailer (7.2.1)
actionpack (= 7.2.1)
actionview (= 7.2.1)
activejob (= 7.2.1)
activesupport (= 7.2.1)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (7.1.4)
actionview (= 7.1.4)
activesupport (= 7.1.4)
actionpack (7.2.1)
actionview (= 7.2.1)
activesupport (= 7.2.1)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack (>= 2.2.4, < 3.2)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.4)
actionpack (= 7.1.4)
activerecord (= 7.1.4)
activestorage (= 7.1.4)
activesupport (= 7.1.4)
useragent (~> 0.16)
actiontext (7.2.1)
actionpack (= 7.2.1)
activerecord (= 7.2.1)
activestorage (= 7.2.1)
activesupport (= 7.2.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.4)
activesupport (= 7.1.4)
actionview (7.2.1)
activesupport (= 7.2.1)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.1.4)
activesupport (= 7.1.4)
activejob (7.2.1)
activesupport (= 7.2.1)
globalid (>= 0.3.6)
activemodel (7.1.4)
activesupport (= 7.1.4)
activerecord (7.1.4)
activemodel (= 7.1.4)
activesupport (= 7.1.4)
activemodel (7.2.1)
activesupport (= 7.2.1)
activerecord (7.2.1)
activemodel (= 7.2.1)
activesupport (= 7.2.1)
timeout (>= 0.4.0)
activestorage (7.1.4)
actionpack (= 7.1.4)
activejob (= 7.1.4)
activerecord (= 7.1.4)
activesupport (= 7.1.4)
activestorage (7.2.1)
actionpack (= 7.2.1)
activejob (= 7.2.1)
activerecord (= 7.2.1)
activesupport (= 7.2.1)
marcel (~> 1.0)
activesupport (7.1.4)
activesupport (7.2.1)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
administrate-field-active_storage (1.0.3)
administrate (>= 0.2.2)
rails (>= 7.0)
annotate (3.2.0)
activerecord (>= 3.2, < 8.0)
rake (>= 10.4, < 14.0)
ast (2.4.2)
base64 (0.2.0)
bcrypt (3.1.20)
better_html (2.1.1)
actionview (>= 6.0)
activesupport (>= 6.0)
ast (~> 2.0)
erubi (~> 1.4)
parser (>= 2.4)
smart_properties
bigdecimal (3.1.8)
bindex (0.8.1)
bootsnap (1.18.4)
@@ -143,19 +108,9 @@ GEM
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
childprocess (5.1.0)
logger (~> 1.5)
chunky_png (1.4.0)
coderay (1.1.3)
chronic (0.10.2)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
countries (6.0.1)
unaccent (~> 0.3)
country_select (9.0.0)
countries (> 5.0, < 7.0)
crack (1.0.0)
bigdecimal
rexml
crass (1.0.6)
cssbundling-rails (1.4.1)
railties (>= 6.0.0)
@@ -163,160 +118,51 @@ GEM
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
devise-i18n (1.12.1)
devise (>= 4.9.0)
domain_name (0.6.20240107)
dotenv (3.1.4)
devise (4.9.4)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
drb (2.2.1)
dry-configurable (1.2.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-core (1.0.1)
concurrent-ruby (~> 1.0)
zeitwerk (~> 2.6)
dry-inflector (1.1.0)
dry-logic (1.5.0)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-struct (1.6.0)
dry-core (~> 1.0, < 2)
dry-types (>= 1.7, < 2)
ice_nine (~> 0.11)
zeitwerk (~> 2.6)
dry-types (1.7.2)
bigdecimal (~> 3.0)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0)
dry-inflector (~> 1.0)
dry-logic (~> 1.4)
zeitwerk (~> 2.6)
erb_lint (0.6.0)
activesupport
better_html (>= 2.0.1)
parser (>= 2.7.1.4)
rainbow
rubocop (>= 1)
smart_properties
erubi (1.13.0)
et-orbi (1.2.11)
tzinfo
excon (0.111.0)
faraday (2.12.0)
faraday-net_http (>= 2.0, < 3.4)
json
logger
faraday-net_http (3.3.0)
net-http
ffi (1.17.0-aarch64-linux-gnu)
ffi (1.17.0-arm-linux-gnu)
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x86-linux-gnu)
ffi (1.17.0-x86_64-darwin)
ffi (1.17.0-x86_64-linux-gnu)
ffi-compiler (1.3.2)
ffi (>= 1.15.5)
rake
friendly_id (5.5.1)
activerecord (>= 4.0.0)
fugit (1.11.1)
et-orbi (~> 1, >= 1.2.11)
raabro (~> 1.4)
globalid (1.2.1)
activesupport (>= 6.1)
hashdiff (1.0.1)
hashids (1.0.6)
hashie (5.0.0)
http (5.2.0)
addressable (~> 2.8)
base64 (~> 0.1)
http-cookie (~> 1.0)
http-form_data (~> 2.2)
llhttp-ffi (~> 0.5.0)
http-accept (1.7.0)
http-cookie (1.0.7)
domain_name (~> 0.5)
http-form_data (2.3.0)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
image_processing (1.13.0)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
importmap-rails (2.0.1)
actionpack (>= 6.0.0)
activesupport (>= 6.0.0)
railties (>= 6.0.0)
iniparse (1.5.0)
inline_svg (1.10.0)
activesupport (>= 3.0)
nokogiri (>= 1.6)
invisible_captcha (2.3.0)
rails (>= 5.2)
io-console (0.7.2)
irb (1.14.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jquery-rails (4.6.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jbuilder (2.13.0)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
jsbundling-rails (1.3.1)
railties (>= 6.0.0)
json (2.7.2)
jsonpath (1.1.5)
multi_json
jwt (2.9.1)
base64
k8s-ruby (0.16.0)
dry-configurable
dry-struct
dry-types
excon (~> 0.71)
hashdiff (~> 1.0.0)
jsonpath (~> 1.1)
recursive-open-struct (~> 1.1.3)
yajl-ruby (~> 1.4.0)
yaml-safe_load_stream3
kaminari (1.2.2)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.2)
kaminari-activerecord (= 1.2.2)
kaminari-core (= 1.2.2)
kaminari-actionview (1.2.2)
actionview
kaminari-core (= 1.2.2)
kaminari-activerecord (1.2.2)
activerecord
kaminari-core (= 1.2.2)
kaminari-core (1.2.2)
kubeclient (4.12.0)
http (>= 3.0, < 6.0)
jsonpath (~> 1.0)
recursive-open-struct (~> 1.1, >= 1.1.1)
rest-client (~> 2.0)
language_server-protocol (3.17.0.3)
launchy (3.0.1)
addressable (~> 2.8)
childprocess (~> 5.0)
letter_opener (1.10.0)
launchy (>= 2.2, < 4)
letter_opener_web (3.0.0)
actionmailer (>= 6.1)
letter_opener (~> 1.9)
railties (>= 6.1)
rexml
light-service (0.18.0)
activesupport (>= 4.0.0)
lint_roller (1.1.0)
llhttp-ffi (0.5.0)
ffi-compiler (~> 1.0)
rake (~> 13.0)
local_time (3.0.2)
logger (1.6.1)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
madmin (1.2.11)
pagy (>= 3.5)
rails (>= 6.0.3)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
@@ -324,26 +170,11 @@ GEM
net-smtp
marcel (1.0.4)
matrix (0.4.2)
method_source (1.1.0)
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0903)
mini_magick (4.13.2)
mini_mime (1.1.5)
minitest (5.25.1)
mission_control-jobs (0.3.1)
importmap-rails
irb (~> 1.13)
rails (>= 7.1)
stimulus-rails
turbo-rails
msgpack (1.7.2)
multi_json (1.15.0)
multi_xml (0.7.1)
bigdecimal (~> 3.1)
mutex_m (0.2.0)
name_of_person (1.1.3)
activesupport (>= 5.2.0)
net-http (0.4.1)
uri
net-imap (0.4.16)
@@ -355,7 +186,6 @@ GEM
timeout
net-smtp (0.5.0)
net-protocol
netrc (0.11.0)
nio4r (2.7.3)
nokogiri (1.16.7-aarch64-linux)
racc (~> 1.4)
@@ -371,6 +201,12 @@ GEM
racc (~> 1.4)
noticed (2.4.3)
rails (>= 6.1.0)
oauth (1.1.0)
oauth-tty (~> 1.0, >= 1.0.1)
snaky_hash (~> 2.0)
version_gem (~> 1.1)
oauth-tty (1.0.5)
version_gem (~> 1.1, >= 1.1.1)
oauth2 (2.0.9)
faraday (>= 0.17.3, < 3.0)
jwt (>= 1.0, < 3.0)
@@ -378,58 +214,34 @@ GEM
rack (>= 1.2, < 4)
snaky_hash (~> 2.0)
version_gem (~> 1.1)
octokit (9.1.0)
faraday (>= 1, < 3)
sawyer (~> 0.9)
oj (3.16.6)
bigdecimal (>= 3.0)
ostruct (>= 0.2)
omniauth (2.1.2)
hashie (>= 3.4.6)
rack (>= 2.2.3)
rack-protection
omniauth-digitalocean (0.3.2)
multi_json (~> 1.15)
omniauth (~> 2.0)
omniauth-oauth2 (~> 1.0)
omniauth-facebook (8.0.0)
omniauth-oauth2 (~> 1.2)
omniauth-github (2.0.1)
omniauth (~> 2.0)
omniauth-oauth2 (~> 1.8)
omniauth-oauth (1.2.1)
oauth
omniauth (>= 1.0, < 3)
rack (>= 1.6.2, < 4)
omniauth-oauth2 (1.8.0)
oauth2 (>= 1.4, < 3)
omniauth (~> 2.0)
omniauth-rails_csrf_protection (1.0.2)
actionpack (>= 4.2)
omniauth (~> 2.0)
omniauth-twitter (1.4.0)
omniauth-oauth (~> 1.1)
rack
orm_adapter (0.5.0)
ostruct (0.6.0)
overcommit (0.64.0)
childprocess (>= 0.6.3, < 6)
iniparse (~> 1.4)
rexml (~> 3.2)
pagy (8.6.3)
pagy (9.0.9)
parallel (1.26.3)
parser (3.3.5.0)
ast (~> 2.4.1)
racc
pay (7.3.0)
rails (>= 6.0.0)
pdf-core (0.10.0)
pg (1.5.8)
prawn (2.5.0)
matrix (~> 0.4)
pdf-core (~> 0.10.0)
ttfunk (~> 1.8)
prawn-table (0.2.2)
prawn (>= 1.3.0, < 3.0.0)
prefixed_ids (1.8.1)
hashids (>= 1.0.0, < 2.0.0)
rails (>= 6.0.0)
pretender (0.5.0)
actionpack (>= 6.1)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
pretender (0.3.4)
actionpack (>= 4.2)
psych (5.1.2)
stringio
public_suffix (6.0.1)
@@ -437,7 +249,6 @@ GEM
nio4r (~> 2.0)
pundit (2.4.0)
activesupport (>= 3.0.0)
raabro (1.4.0)
racc (1.8.1)
rack (2.2.9)
rack-protection (3.2.0)
@@ -450,20 +261,20 @@ GEM
rackup (1.0.0)
rack (< 3)
webrick
rails (7.1.4)
actioncable (= 7.1.4)
actionmailbox (= 7.1.4)
actionmailer (= 7.1.4)
actionpack (= 7.1.4)
actiontext (= 7.1.4)
actionview (= 7.1.4)
activejob (= 7.1.4)
activemodel (= 7.1.4)
activerecord (= 7.1.4)
activestorage (= 7.1.4)
activesupport (= 7.1.4)
rails (7.2.1)
actioncable (= 7.2.1)
actionmailbox (= 7.2.1)
actionmailer (= 7.2.1)
actionpack (= 7.2.1)
actiontext (= 7.2.1)
actionview (= 7.2.1)
activejob (= 7.2.1)
activemodel (= 7.2.1)
activerecord (= 7.2.1)
activestorage (= 7.2.1)
activesupport (= 7.2.1)
bundler (>= 1.15.0)
railties (= 7.1.4)
railties (= 7.2.1)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
@@ -471,10 +282,10 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.1.4)
actionpack (= 7.1.4)
activesupport (= 7.1.4)
irb
railties (7.2.1)
actionpack (= 7.2.1)
activesupport (= 7.2.1)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
@@ -483,82 +294,57 @@ GEM
rake (13.2.1)
rdoc (6.7.0)
psych (>= 4.0.0)
receipts (2.4.0)
prawn (>= 1.3.0, < 3.0.0)
prawn-table (~> 0.2.1)
recursive-open-struct (1.1.3)
redis (5.3.0)
redis-client (>= 0.22.0)
redis-client (0.22.2)
connection_pool
redis (4.8.1)
regexp_parser (2.9.2)
reline (0.5.10)
io-console (~> 0.5)
responders (3.1.1)
actionpack (>= 5.2)
railties (>= 5.2)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.3.7)
rotp (6.3.0)
rqrcode (2.2.0)
chunky_png (~> 1.0)
rqrcode_core (~> 1.0)
rqrcode_core (1.2.0)
rubocop (1.65.1)
rubocop (1.66.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.4, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.32.3)
parser (>= 3.3.1.0)
rubocop-performance (1.21.1)
rubocop-minitest (0.36.0)
rubocop (>= 1.61, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-performance (1.22.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-oembed (0.17.0)
rubocop-rails (2.26.2)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.52.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails-omakase (1.0.0)
rubocop
rubocop-minitest
rubocop-performance
rubocop-rails
ruby-progressbar (1.13.0)
ruby-vips (2.2.2)
ffi (~> 1.12)
logger
rubyzip (2.3.2)
sassc (2.4.0)
ffi (~> 1.9)
sassc-rails (2.1.2)
railties (>= 4.0.0)
sassc (>= 2.0)
sprockets (> 3.0)
sprockets-rails
tilt
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
selectize-rails (0.12.6)
securerandom (0.3.1)
selenium-webdriver (4.25.0)
base64 (~> 0.2)
logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
smart_properties (1.17.0)
sidekiq (6.5.12)
connection_pool (>= 2.2.5, < 3)
rack (~> 2.0)
redis (>= 4.5.0, < 5)
sitemap_generator (6.3.0)
builder (~> 3.0)
snaky_hash (2.0.1)
hashie
version_gem (~> 1.1, >= 1.1.1)
solid_queue (0.9.0)
activejob (>= 7.1)
activerecord (>= 7.1)
concurrent-ruby (>= 1.3.1)
fugit (~> 1.11.0)
railties (>= 7.1)
thor (~> 1.3.1)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
@@ -566,46 +352,19 @@ GEM
actionpack (>= 6.1)
activesupport (>= 6.1)
sprockets (>= 3.0.0)
standard (1.40.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.65.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.4)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.4.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.21.0)
stimulus-rails (1.3.4)
railties (>= 6.0.0)
stringio (3.1.1)
tailwindcss-rails (2.7.6)
railties (>= 7.0.0)
tailwindcss-rails (2.7.6-aarch64-linux)
railties (>= 7.0.0)
tailwindcss-rails (2.7.6-arm-linux)
railties (>= 7.0.0)
tailwindcss-rails (2.7.6-arm64-darwin)
railties (>= 7.0.0)
tailwindcss-rails (2.7.6-x86_64-darwin)
railties (>= 7.0.0)
tailwindcss-rails (2.7.6-x86_64-linux)
railties (>= 7.0.0)
thor (1.3.2)
tilt (2.4.0)
timeout (0.4.1)
ttfunk (1.8.0)
bigdecimal (~> 3.1)
turbo-rails (2.0.10)
actionpack (>= 6.0.0)
railties (>= 6.0.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unaccent (0.4.0)
unicode-display_width (2.6.0)
uri (0.13.1)
useragent (0.16.10)
version_gem (1.1.4)
warden (1.2.9)
rack (>= 2.0.9)
@@ -614,19 +373,15 @@ GEM
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webmock (3.23.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.8.2)
websocket (1.2.11)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
whenever (1.0.0)
chronic (>= 0.6.3)
xpath (3.2.0)
nokogiri (~> 1.8)
yajl-ruby (1.4.3)
yaml-safe_load_stream3 (0.1.2)
zeitwerk (2.6.18)
PLATFORMS
@@ -638,68 +393,38 @@ PLATFORMS
x86_64-linux
DEPENDENCIES
administrate!
administrate-field-active_storage (~> 1.0.0)
annotate (~> 3.2)
bootsnap (>= 1.4.2)
bootsnap
brakeman
capybara (>= 3.39)
country_select (~> 9.0)
cssbundling-rails (~> 1.4.0)
capybara
cssbundling-rails
debug
devise!
devise-i18n (~> 1.10)
dotenv (~> 3.1)
erb_lint
friendly_id (~> 5.5)
image_processing (~> 1.12)
inline_svg (~> 1.6)
invisible_captcha (~> 2.0)
jbuilder!
jsbundling-rails (~> 1.3.0)
k8s-ruby (~> 0.16.0)
kubeclient (~> 4.11)
letter_opener_web (~> 3.0)
light-service (~> 0.18.0)
local_time (~> 3.0)
mission_control-jobs
name_of_person (~> 1.0)
nokogiri (>= 1.12.5)
noticed (~> 2.2)
octokit (~> 9.1)
oj (~> 3.8)
omniauth (~> 2.1)
omniauth-digitalocean (~> 0.3.2)
omniauth-github
omniauth-rails_csrf_protection (~> 1.0)
overcommit
pagy (~> 8.0)
pay (~> 7.1)
pg
prefixed_ids (~> 1.2)
pretender (~> 0.4)
pry (~> 0.14.2)
puma (~> 6.0)
devise (~> 4.9)
friendly_id (~> 5.4)
importmap-rails
jbuilder
jsbundling-rails
madmin
name_of_person!
noticed (~> 2.0)
omniauth-facebook (~> 8.0)
omniauth-github (~> 2.0)
omniauth-twitter (~> 1.4)
pg (~> 1.1)
pretender (~> 0.3.4)
puma (>= 5.0)
pundit (~> 2.1)
rails (~> 7.1.3)
receipts (~> 2.1)
redis (~> 5.1)
rotp (~> 6.2)
rqrcode (~> 2.1)
ruby-oembed (~> 0.17.0)
selenium-webdriver (>= 4.20.1)
solid_queue
sprockets-rails (>= 3.4.1)
standard
stimulus-rails (~> 1.0, >= 1.0.2)
tailwindcss-rails (~> 2.7)
turbo-rails (~> 2.0.3)
rails (~> 7.2.1)
responders!
rubocop-rails-omakase
selenium-webdriver
sidekiq (~> 6.2)
sitemap_generator (~> 6.1)
sprockets-rails
stimulus-rails
turbo-rails
tzinfo-data
web-console (>= 4.1.0)
webmock
RUBY VERSION
ruby 3.3.1p55
web-console
whenever
BUNDLED WITH
2.5.9
2.5.20

View File

@@ -1,2 +1,2 @@
web: bin/rails server
worker: bundle exec rake solid_queue:start
worker: bundle exec sidekiq

View File

@@ -1,4 +1,4 @@
web: bin/rails server -p 3000
worker: bundle exec rake solid_queue:start
worker: bundle exec sidekiq
js: yarn build --reload
css: yarn build:css --watch

View File

@@ -1,2 +1,2 @@
//= link_tree ../images
//= link_tree ../builds
//= link_tree ../images

View File

@@ -0,0 +1,21 @@
.announcement {
strong {
color: $gray-700;
font-weight: 900;
}
}
.unread-announcements:before {
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
border-radius: 50%;
-moz-background-clip: padding-box;
-webkit-background-clip: padding-box;
background-clip: padding-box;
background: $red;
content: '';
display: inline-block;
height: 8px;
width: 8px;
margin-right: 6px;
}

View File

@@ -1,4 +1,21 @@
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_user, :true_user
impersonates :user
def connect
self.current_user = find_verified_user
logger.add_tags "ActionCable", "User #{current_user.id}"
end
protected
def find_verified_user
if (current_user = env['warden'].user)
current_user
else
reject_unauthorized_connection
end
end
end
end

View File

@@ -0,0 +1,13 @@
class AnnouncementsController < ApplicationController
before_action :mark_as_read, if: :user_signed_in?
def index
@announcements = Announcement.order(published_at: :desc)
end
private
def mark_as_read
current_user.update(announcements_last_read_at: Time.zone.now)
end
end

View File

@@ -1,2 +1,15 @@
class ApplicationController < ActionController::Base
impersonates :user
include Pundit::Authorization
protect_from_forgery with: :exception
before_action :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:name])
devise_parameter_sanitizer.permit(:account_update, keys: [:name, :avatar])
end
end

View File

@@ -0,0 +1,10 @@
class HomeController < ApplicationController
def index
end
def terms
end
def privacy
end
end

View File

@@ -0,0 +1,14 @@
class Madmin::ImpersonatesController < Madmin::ApplicationController
impersonates :user
def impersonate
user = User.find(params[:id])
impersonate_user(user)
redirect_to root_path
end
def stop_impersonating
stop_impersonating_user
redirect_to root_path
end
end

View File

@@ -0,0 +1,7 @@
class NotificationsController < ApplicationController
before_action :authenticate_user!
def index
@notifications = current_user.notifications.includes(:event)
end
end

View File

@@ -0,0 +1,84 @@
module Users
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
before_action :set_service, except: [:failure]
before_action :set_user, except: [:failure]
attr_reader :service, :user
def failure
redirect_to root_path, alert: "Something went wrong"
end
def facebook
handle_auth "Facebook"
end
def twitter
handle_auth "Twitter"
end
def github
handle_auth "Github"
end
private
def handle_auth(kind)
if service.present?
service.update(service_attrs)
else
user.services.create(service_attrs)
end
if user_signed_in?
flash[:notice] = "Your #{kind} account was connected."
redirect_to edit_user_registration_path
else
sign_in_and_redirect user, event: :authentication
set_flash_message :notice, :success, kind: kind
end
end
def auth
request.env['omniauth.auth']
end
def set_service
@service = Service.where(provider: auth.provider, uid: auth.uid).first
end
def set_user
if user_signed_in?
@user = current_user
elsif service.present?
@user = service.user
elsif User.where(email: auth.info.email).any?
# 5. User is logged out and they login to a new account which doesn't match their old one
flash[:alert] = "An account with this email already exists. Please sign in with that account before connecting your #{auth.provider.titleize} account."
redirect_to new_user_session_path
else
@user = create_user
end
end
def service_attrs
expires_at = auth.credentials.expires_at.present? ? Time.at(auth.credentials.expires_at) : nil
{
provider: auth.provider,
uid: auth.uid,
expires_at: expires_at,
access_token: auth.credentials.token,
access_token_secret: auth.credentials.secret,
}
end
def create_user
User.create(
email: auth.info.email,
#name: auth.info.name,
password: Devise.friendly_token[0,20]
)
end
end
end

View File

@@ -0,0 +1,19 @@
module AnnouncementsHelper
def unread_announcements(user)
last_announcement = Announcement.order(published_at: :desc).first
return if last_announcement.nil?
# Highlight announcements for anyone not logged in, cuz tempting
if user.nil? || user.announcements_last_read_at.nil? || user.announcements_last_read_at < last_announcement.published_at
"unread-announcements"
end
end
def announcement_class(type)
{
"new" => "text-success",
"update" => "text-warning",
"fix" => "text-danger",
}.fetch(type, "text-success")
end
end

View File

@@ -0,0 +1,17 @@
module AvatarHelper
def avatar_path(object, options = {})
size = options[:size] || 180
default_image = options[:default] || "mp"
base_url = "https://secure.gravatar.com/avatar"
base_url_params = "?s=#{size}&d=#{default_image}"
if object.respond_to?(:avatar) && object.avatar.attached? && object.avatar.variable?
object.avatar.variant(resize_to_fill: [size, size])
elsif object.respond_to?(:email) && object.email
gravatar_id = Digest::MD5::hexdigest(object.email.downcase)
"#{base_url}/#{gravatar_id}#{base_url_params}"
else
"#{base_url}/00000000000000000000000000000000#{base_url_params}"
end
end
end

View File

@@ -0,0 +1,10 @@
module BootstrapHelper
def bootstrap_class_for(flash_type)
{
success: "alert-success",
error: "alert-danger",
alert: "alert-warning",
notice: "alert-primary"
}.stringify_keys[flash_type.to_s] || flash_type.to_s
end
end

View File

@@ -0,0 +1,28 @@
// This file is automatically compiled by Webpack, along with any other files
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
import "@hotwired/turbo-rails"
require("@rails/activestorage").start()
//require("trix")
//require("@rails/actiontext")
require("local-time").start()
require("@rails/ujs").start()
import './channels/**/*_channel.js'
import "./controllers"
import * as bootstrap from "bootstrap"
document.addEventListener("turbo:load", () => {
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl)
})
var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'))
var popoverList = popoverTriggerList.map(function (popoverTriggerEl) {
return new bootstrap.Popover(popoverTriggerEl)
})
})

View File

@@ -1,6 +0,0 @@
// Action Cable provides the framework to deal with WebSockets in Rails.
// You can generate new channels where WebSocket features live using the `bin/rails generate channel` command.
import { createConsumer } from "@rails/actioncable"
export default createConsumer()

View File

@@ -1,5 +0,0 @@
// Load all the channels within this directory and all subdirectories.
// Channel files must be named *_channel.js.
const channels = require.context('.', true, /_channel\.js$/)
channels.keys().forEach(channels)

View File

@@ -0,0 +1,6 @@
import { application } from "./application"
import controllers from './**/*_controller.js'
controllers.forEach((controller) => {
application.register(controller.name, controller.module.default)
})

View File

@@ -1,13 +0,0 @@
// This file is automatically compiled by Webpack, along with any other files
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
import Rails from "@rails/ujs"
import Turbolinks from "turbolinks"
import * as ActiveStorage from "@rails/activestorage"
import "channels"
Rails.start()
Turbolinks.start()
ActiveStorage.start()

View File

@@ -1,14 +1,13 @@
# == Schema Information
#
# Table name: announcements
#
# id :bigint not null, primary key
# announcement_type :string
# description :text
# name :string
# published_at :datetime
# created_at :datetime not null
# updated_at :datetime not null
#
class Announcement < ApplicationRecord
TYPES = %w{ new fix update }
after_initialize :set_defaults
validates :announcement_type, :description, :name, :published_at, presence: true
validates :announcement_type, inclusion: { in: TYPES }
def set_defaults
self.published_at ||= Time.zone.now
self.announcement_type ||= TYPES.first
end
end

View File

@@ -1,21 +0,0 @@
# == Schema Information
#
# Table name: clusters
#
# id :bigint not null, primary key
# kubeconfig :jsonb not null
# name :string not null
# created_at :datetime not null
# updated_at :datetime not null
# user_id :bigint not null
#
# Indexes
#
# index_clusters_on_user_id (user_id)
#
# Foreign Keys
#
# fk_rails_... (user_id => users.id)
#
class Cluster < ApplicationRecord
end

View File

@@ -1,27 +1,32 @@
# == Schema Information
#
# Table name: services
#
# id :bigint not null, primary key
# access_token :string
# access_token_secret :string
# auth :text
# expires_at :datetime
# provider :string
# refresh_token :string
# uid :string
# created_at :datetime not null
# updated_at :datetime not null
# user_id :bigint not null
#
# Indexes
#
# index_services_on_user_id (user_id)
#
# Foreign Keys
#
# fk_rails_... (user_id => users.id)
#
class Service < ApplicationRecord
belongs_to :user
Devise.omniauth_configs.keys.each do |provider|
scope provider, ->{ where(provider: provider) }
end
def client
send("#{provider}_client")
end
def expired?
expires_at? && expires_at <= Time.zone.now
end
def access_token
send("#{provider}_refresh_token!", super) if expired?
super
end
def twitter_client
Twitter::REST::Client.new do |config|
config.consumer_key = Rails.application.secrets.twitter_app_id
config.consumer_secret = Rails.application.secrets.twitter_app_secret
config.access_token = access_token
config.access_token_secret = access_token_secret
end
end
def twitter_refresh_token!(token); end
end

View File

@@ -1,28 +1,12 @@
# == Schema Information
#
# Table name: users
#
# id :bigint not null, primary key
# admin :boolean default(FALSE)
# announcements_last_read_at :datetime
# email :string default(""), not null
# encrypted_password :string default(""), not null
# first_name :string
# last_name :string
# remember_created_at :datetime
# reset_password_sent_at :datetime
# reset_password_token :string
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_users_on_email (email) UNIQUE
# index_users_on_reset_password_token (reset_password_token) UNIQUE
#
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :omniauthable, :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :validatable, :omniauthable
has_one_attached :avatar
has_person_name
has_many :notifications, as: :recipient, dependent: :destroy, class_name: "Noticed::Notification"
has_many :notification_mentions, as: :record, dependent: :destroy, class_name: "Noticed::Event"
has_many :services
end

View File

@@ -0,0 +1,28 @@
<h1>What's New</h1>
<div class="card">
<div class="card-body">
<% @announcements.each_with_index do |announcement, index| %>
<% if index != 0 %>
<div class="row"><div class="col"><hr /></div></div>
<% end %>
<div class="row announcement" id="<%= dom_id(announcement) %>">
<div class="col-sm-1 text-center">
<%= link_to announcements_path(anchor: dom_id(announcement)) do %>
<strong><%= announcement.published_at.strftime("%b %d") %></strong>
<% end %>
</div>
<div class="col">
<strong class="<%= announcement_class(announcement.announcement_type) %>"><%= announcement.announcement_type.titleize %>:</strong>
<strong><%= announcement.name %></strong>
<%= simple_format announcement.description %>
</div>
</div>
<% end %>
<% if @announcements.empty? %>
<div>Exciting stuff coming very soon!</div>
<% end %>
</div>
</div>

View File

@@ -0,0 +1,22 @@
<div class="row">
<div class="col-lg-4 offset-lg-4">
<h2 class="text-center">Resend confirmation instructions</h2>
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
<%= render "devise/shared/error_messages", resource: resource %>
<div class="mb-3">
<%= f.label :email, class: 'form-label' %><br />
<%= f.email_field :email, autofocus: true, class: 'form-control', value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
</div>
<div class="actions d-grid">
<%= f.submit "Resend confirmation instructions", class: 'btn btn-primary btn-lg' %>
</div>
<% end %>
<div class="text-center">
<%= render "devise/shared/links" %>
</div>
</div>
</div>

View File

@@ -0,0 +1,5 @@
<p>Welcome <%= @email %>!</p>
<p>You can confirm your account email through the link below:</p>
<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>

View File

@@ -0,0 +1,7 @@
<p>Hello <%= @email %>!</p>
<% if @resource.try(:unconfirmed_email?) %>
<p>We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.</p>
<% else %>
<p>We're contacting you to notify you that your email has been changed to <%= @resource.email %>.</p>
<% end %>

View File

@@ -0,0 +1,3 @@
<p>Hello <%= @resource.email %>!</p>
<p>We're contacting you to notify you that your password has been changed.</p>

View File

@@ -0,0 +1,8 @@
<p>Hello <%= @resource.email %>!</p>
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>

View File

@@ -0,0 +1,7 @@
<p>Hello <%= @resource.email %>!</p>
<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
<p>Click the link below to unlock your account:</p>
<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>

View File

@@ -0,0 +1,29 @@
<div class="row">
<div class="col-lg-4 offset-lg-4">
<h2 class="text-center">Change your password</h2>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
<%= render "devise/shared/error_messages", resource: resource %>
<%= f.hidden_field :reset_password_token %>
<div class="mb-3">
<%= f.password_field :password, autofocus: true, autocomplete: "off", class: 'form-control', placeholder: "Password" %>
<% if @minimum_password_length %>
<p class="text-muted"><small><%= @minimum_password_length %> characters minimum</small></p>
<% end %>
</div>
<div class="mb-3">
<%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control', placeholder: "Confirm Password" %>
</div>
<div class="mb-3 d-grid">
<%= f.submit "Change my password", class: 'btn btn-primary btn-lg' %>
</div>
<% end %>
<div class="text-center">
<%= render "devise/shared/links" %>
</div>
</div>
</div>

View File

@@ -0,0 +1,20 @@
<div class="row">
<div class="col-lg-4 offset-lg-4">
<h2 class="text-center">Reset your password</h2>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
<%= render "devise/shared/error_messages", resource: resource %>
<p class="text-center">Enter your email address below and we will send you a link to reset your password.</p>
<div class="mb-3">
<%= f.email_field :email, autofocus: true, placeholder: 'Email address', class: 'form-control' %>
</div>
<div class="mb-3 d-grid">
<%= f.submit "Send password reset email", class: 'btn btn-primary btn-lg' %>
</div>
<% end %>
<div class="text-center">
<%= render "devise/shared/links" %>
</div>
</div>
</div>

View File

@@ -0,0 +1,49 @@
<div class="row">
<div class="col-lg-4 offset-lg-4">
<h1 class="text-center">Account</h1>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
<%= render "devise/shared/error_messages", resource: resource %>
<div class="mb-3">
<%= f.text_field :name, autofocus: false, class: 'form-control', placeholder: "Full name" %>
</div>
<div class="mb-3">
<%= f.email_field :email, class: 'form-control', placeholder: 'Email Address' %>
</div>
<div class="mb-3">
<%= f.label :avatar, class: "form-label" %>
<%= f.file_field :avatar, accept:'image/*' %>
</div>
<%= image_tag avatar_path(f.object), class: "rounded border shadow-sm d-block mx-auto my-3" %>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<div class="alert alert-warning">Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
<% end %>
<div class="mb-3">
<%= f.password_field :password, autocomplete: "off", class: 'form-control', placeholder: 'Password' %>
<p class="form-text text-muted"><small>Leave password blank if you don't want to change it</small></p>
</div>
<div class="mb-3">
<%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control', placeholder: 'Confirm Password' %>
</div>
<div class="mb-3">
<%= f.password_field :current_password, autocomplete: "off", class: 'form-control', placeholder: 'Current Password' %>
<p class="form-text text-muted"><small>We need your current password to confirm your changes</small></p>
</div>
<div class="mb-3 d-grid">
<%= f.submit "Save Changes", class: 'btn btn-lg btn-primary' %>
</div>
<% end %>
<hr>
<p class="text-center"><%= link_to "Deactivate my account", registration_path(resource_name), data: { confirm: "Are you sure? You cannot undo this." }, method: :delete %></p>
</div>
</div>

View File

@@ -0,0 +1,33 @@
<div class="row">
<div class="col-lg-4 offset-lg-4">
<h1 class="text-center">Sign Up</h1>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= render "devise/shared/error_messages", resource: resource %>
<div class="mb-3">
<%= f.text_field :name, autofocus: false, class: 'form-control', placeholder: "Full name" %>
</div>
<div class="mb-3">
<%= f.email_field :email, autofocus: false, class: 'form-control', placeholder: "Email Address" %>
</div>
<div class="mb-3">
<%= f.password_field :password, autocomplete: "off", class: 'form-control', placeholder: 'Password' %>
</div>
<div class="mb-3">
<%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control', placeholder: 'Confirm Password' %>
</div>
<div class="mb-3 d-grid">
<%= f.submit "Sign up", class: "btn btn-primary btn-lg" %>
</div>
<% end %>
<div class="text-center">
<%= render "devise/shared/links" %>
</div>
</div>
</div>

View File

@@ -0,0 +1,32 @@
<div class="row">
<div class="col-lg-4 offset-lg-4">
<h1 class="text-center">Log in</h1>
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="mb-3">
<%= f.email_field :email, autofocus: true, placeholder: 'Email Address', class: 'form-control' %>
</div>
<div class="mb-3">
<%= f.password_field :password, autocomplete: "off", placeholder: 'Password', class: 'form-control' %>
</div>
<% if devise_mapping.rememberable? -%>
<div class="form-check">
<label class="form-check-label">
<%= f.check_box :remember_me, class: "form-check-input" %>
Remember me
</label>
</div>
<% end -%>
<div class="mb-3 d-grid">
<%= f.submit "Log in", class: "btn btn-primary btn-lg" %>
</div>
<% end %>
<div class="text-center">
<%= render "devise/shared/links" %>
</div>
</div>
</div>

View File

@@ -0,0 +1,15 @@
<% if resource.errors.any? %>
<div id="error_explanation" class="alert alert-danger">
<h6>
<%= I18n.t("errors.messages.not_saved",
count: resource.errors.count,
resource: resource.class.model_name.human.downcase)
%>
</h6>
<ul>
<% resource.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>

View File

@@ -0,0 +1,25 @@
<%- if controller_name != 'sessions' %>
<%= link_to "Log in", new_session_path(resource_name) %><br />
<% end %>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
<% end %>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
<% end %>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
<% end %>
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
<% end %>
<%- if devise_mapping.omniauthable? %>
<%- resource_class.omniauth_providers.each do |provider| %>
<%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), method: :post %><br />
<% end %>
<% end %>

View File

@@ -0,0 +1,20 @@
<div class="row">
<div class="col-lg-4 offset-lg-4">
<h1 class="text-center">Resend unlock instructions</h1>
<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
<%= render "devise/shared/error_messages", resource: resource %>
<div class="mb-3">
<%= f.label :email, class: "form-label" %>
<%= f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control" %>
</div>
<div class="mb-3">
<%= f.submit "Resend unlock instructions", class: "btn btn-lg btn-primary" %>
</div>
<% end %>
<%= render "devise/shared/links" %>
</div>
</div>

View File

@@ -0,0 +1,2 @@
<h1>Welcome to Jumpstart!</h1>
<p class="lead">Use this document as a way to quickly start any new project.<br> All you get is this text and a mostly barebones HTML document.</p>

View File

@@ -0,0 +1,2 @@
<h1>Privacy Policy</h1>
<p class="lead">Use this for your Privacy Policy</p>

View File

@@ -0,0 +1,2 @@
<h1>Terms of Service</h1>
<p class="lead">Use this for your Terms of Service</p>

View File

@@ -1,16 +1,19 @@
<!DOCTYPE html>
<html>
<html class="h-100">
<head>
<title>Myapp</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
<%= javascript_include_tag "application", "data-turbo-track": "reload", type: "module" %>
<%= render 'shared/head' %>
</head>
<body>
<%= yield %>
<body class="d-flex flex-column h-100">
<main class="flex-shrink-0">
<%= render 'shared/navbar' %>
<%= render 'shared/notices' %>
<div class="container mt-4 mx-auto">
<%= yield %>
</div>
</main>
<%= render 'shared/footer' %>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<h1>Notifications</h1>
<ul>
<% @notifications.each do |notification| %>
<%# Customize your notification format here. We typically recommend a `message` and `url` method on the Notifier classes. %>
<%#= link_to notification.message, notification.url %>
<li><%= notification.params %></li>
<% end %>
</ul>

View File

@@ -0,0 +1,22 @@
{
"name": "Canine",
"icons": [
{
"src": "/icon.png",
"type": "image/png",
"sizes": "512x512"
},
{
"src": "/icon.png",
"type": "image/png",
"sizes": "512x512",
"purpose": "maskable"
}
],
"start_url": "/",
"display": "standalone",
"scope": "/",
"description": "Canine.",
"theme_color": "red",
"background_color": "red"
}

View File

@@ -0,0 +1,26 @@
// Add a service worker for processing Web Push notifications:
//
// self.addEventListener("push", async (event) => {
// const { title, options } = await event.data.json()
// event.waitUntil(self.registration.showNotification(title, options))
// })
//
// self.addEventListener("notificationclick", function(event) {
// event.notification.close()
// event.waitUntil(
// clients.matchAll({ type: "window" }).then((clientList) => {
// for (let i = 0; i < clientList.length; i++) {
// let client = clientList[i]
// let clientPath = (new URL(client.url)).pathname
//
// if (clientPath == event.notification.data.path && "focus" in client) {
// return client.focus()
// }
// }
//
// if (clients.openWindow) {
// return clients.openWindow(event.notification.data.path)
// }
// })
// )
// })

View File

@@ -0,0 +1,10 @@
<footer class="bg-light footer mt-auto py-3">
<div class="container d-flex justify-content-between mx-auto text-muted">
<span>&copy; <%= Date.today.year %> Your Company</span>
<ul class="d-inline float-end list-inline mb-0">
<li class="list-inline-item mr-3"><%= link_to "Terms", terms_path %></li>
<li class="list-inline-item mr-3"><%= link_to "Privacy", privacy_path %></li>
</ul>
</div>
</footer>

View File

@@ -0,0 +1,10 @@
<title><%= Rails.configuration.application_name %></title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta2/css/all.min.css" integrity="sha512-YWzhKL2whUzgiheMoBFwW8CKV4qpHQAEuvilg9FAn5VJUDwKZZxkJNuGM4XkWuk94WCrrwslk8yWNGmY1EduTA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<%= stylesheet_link_tag "application", media: "all", "data-turbo-track": "reload" %>
<%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>

View File

@@ -0,0 +1,52 @@
<% if current_user != true_user %>
<div class="alert alert-warning text-center">
You're logged in as <b><%= current_user.name %> (<%= current_user.email %>)</b>
<%= link_to stop_impersonating_madmin_impersonates_path, method: :post do %><%= icon("fas", "times") %> Logout <% end %>
</div>
<% end %>
<nav class="navbar navbar-expand-md navbar-light bg-light">
<div class="container mx-auto">
<%= link_to Rails.configuration.application_name, root_path, class: "navbar-brand" %>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarMain" aria-controls="navbarsExample04" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarMain">
<ul class="navbar-nav me-auto mt-2 mt-md-0">
</ul>
<ul class="navbar-nav">
<li class="nav-item"><%= link_to "What's New", announcements_path, class: "nav-link #{unread_announcements(current_user)}" %></li>
<% if user_signed_in? %>
<li class="nav-item">
<%= link_to notifications_path, class: "nav-link" do %>
<span><i class="far fa-bell" aria-hidden="true"></i></span>
<% end %>
</li>
<li class="nav-item dropdown">
<%= link_to "#", id: "navbar-dropdown", class: "nav-link dropdown-toggle", data: { target: "nav-account-dropdown", bs_toggle: "dropdown" }, aria: { haspopup: true, expanded: false } do %>
<%= image_tag avatar_path(current_user, size: 40), height: 20, width: 20, class: "rounded" %>
<% end %>
<div id="nav-account-dropdown" class="dropdown-menu dropdown-menu-end" aria-labelledby="navbar-dropdown">
<%= link_to "Settings", edit_user_registration_path, class: "dropdown-item" %>
<% if current_user.admin? && respond_to?(:madmin_root_path) %>
<div class="dropdown-divider"></div>
<%= link_to "Admin Area", madmin_root_path, class: "dropdown-item" %>
<% end %>
<div class="dropdown-divider"></div>
<%= button_to "Logout", destroy_user_session_path, method: :delete, class: "dropdown-item" %>
</div>
</li>
<% else %>
<li class="nav-item"><%= link_to "Sign Up", new_user_registration_path, class: "nav-link" %></li>
<li class="nav-item"><%= link_to "Login", new_user_session_path, class: "nav-link" %></li>
<% end %>
</ul>
</div>
</div>
</nav>

View File

@@ -0,0 +1,8 @@
<% flash.each do |msg_type, message| %>
<div class="container mt-4 mx-auto">
<div class="alert <%= bootstrap_class_for(msg_type) %> alert-dismissible fade show" role="alert">
<%= message %>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
</div>
<% end %>

7
bin/brakeman Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env ruby
require "rubygems"
require "bundler/setup"
ARGV.unshift("--ensure-latest")
load Gem.bin_path("brakeman", "brakeman")

View File

@@ -1,5 +1,10 @@
#!/bin/bash -e
# Enable jemalloc for reduced memory usage and latency.
if [ -z "${LD_PRELOAD+x}" ] && [ -f /usr/lib/*/libjemalloc.so.2 ]; then
export LD_PRELOAD="$(echo /usr/lib/*/libjemalloc.so.2)"
fi
# If running the rails server then create or migrate existing database
if [ "${1}" == "./bin/rails" ] && [ "${2}" == "server" ]; then
./bin/rails db:prepare

View File

@@ -1,6 +0,0 @@
#!/usr/bin/env ruby
require_relative "../config/environment"
require "solid_queue/cli"
SolidQueue::Cli.start(ARGV)

8
bin/rubocop Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env ruby
require "rubygems"
require "bundler/setup"
# explicit rubocop config increases performance slightly while avoiding config confusion.
ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
load Gem.bin_path("rubocop", "rubocop")

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env ruby
require "fileutils"
# path to your application root.
APP_ROOT = File.expand_path("..", __dir__)
APP_NAME = "canine"
def system!(*args)
system(*args, exception: true)
@@ -30,4 +30,8 @@ FileUtils.chdir APP_ROOT do
puts "\n== Restarting application server =="
system! "bin/rails restart"
# puts "\n== Configuring puma-dev =="
# system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}"
# system "curl -Is https://#{APP_NAME}.test/up | head -n 1"
end

View File

@@ -1,14 +0,0 @@
#!/usr/bin/env ruby
if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"])
gem "bundler"
require "bundler"
# Load Spring without loading other gems in the Gemfile, for speed.
Bundler.locked_gems&.specs&.find { |spec| spec.name == "spring" }&.tap do |spring|
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
gem "spring", spring.version
require "spring/binstub"
rescue Gem::LoadError
# Ignore when Spring is not installed.
end
end

View File

@@ -1,17 +0,0 @@
#!/usr/bin/env ruby
APP_ROOT = File.expand_path('..', __dir__)
Dir.chdir(APP_ROOT) do
yarn = ENV["PATH"].split(File::PATH_SEPARATOR).
select { |dir| File.expand_path(dir) != __dir__ }.
product(["yarn", "yarn.cmd", "yarn.ps1"]).
map { |dir, file| File.expand_path(file, dir) }.
find { |file| File.executable?(file) }
if yarn
exec yarn, *ARGV
else
$stderr.puts "Yarn executable was not detected in the system."
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
exit 1
end
end

View File

@@ -1,17 +1,17 @@
require_relative 'boot'
require_relative "boot"
require 'rails/all'
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Myapp
module Canine
class Application < Rails::Application
config.active_job.queue_adapter = :solid_queue
config.active_job.queue_adapter = :sidekiq
config.application_name = Rails.application.class.module_parent_name
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.1
config.load_defaults 7.2
# Please, add to the `ignore` list any other `lib` subdirectories that do
# not contain `.rb` files, or that should not be reloaded or eager loaded.

View File

@@ -1,10 +1,13 @@
development:
adapter: async
adapter: redis
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
channel_prefix: streaming_logs_dev
test:
adapter: test
adapter: async
production:
adapter: redis
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
channel_prefix: myapp_production
channel_prefix: streaming_logs_production

View File

@@ -1 +1 @@
PEzPdJUKmNRCTqH7uOwK+h7Ko4LqYTmd3gX/GHfnFcn78wPYjtxWnZv+H1r3HDgT//f9k2JbbPuVl92E4GVWKC18yg9HXRl+zIi7rCevzddV0oOMwAFcVe2xCjQS3LG2DklsgnIGYGtU2ow4nUamRB9pLcRKobPRgynNTfjeO2GlNp5Bq4pPvm2W8Em0xeDikyYan6AcymVF+kTsT3QkkeKF1t9tyqQXnQj+nKualN4C7OIK1XQ3ZZlQBcXF6g0AmybLgHitZ/wf85rnfl1jGINKjUImiNzhLEsPMNgcO30wXxk/ez9rBuqlgXZ2nX6eS3ob3DtXHqZS/jq/3TlfuSfsTbxTD1hpDQp9PFU4Su0TOxwSP6d/zm8qqKbZPJzLnSo7muX0/5/0CUHcOhYNql+qgC/I9lAbNuSm--27b3pgOwA2/LYVK7--7IW2AxrQub9OzeJ2nEUUkQ==
2GDotYiS+i/6O3YBAAhdxq+Vwog5saS6ESDpLsWP02I79aLa+dRsjU8WAG+tKHE2PCB5kJpSbBfRRoZs8pqmq9S/fyzo4wTM7EPzHKnyvslM+57d6zFt1zk5E1OMsGyWFV6SK0zRTEDVb5oB7m7nklrU9u0SMR0QVC2YgL2gQ6qEthI7kP4qZBs78Zu9CAZEsVUWqZJgT1N/Kt3Wvz7XA39oElkjLn8n024prV4HrPjJJDQRtXa4+TsDnyz+e21yDpHgMnaGbFCWIpqNU54XQjLBbfw+/Q/O2R50Ruxkx5/RrlExrXo3C6Re2maoSwxDRdq5Ll/ai8CzxaPCWOTUO16dMJ9eBd9L9j+Tgv5HJN9w2adAhRWWQBbQJ9nABaswyD58mi7YkOmmiVdH2gq+4W+0TRKg--ZzU43VlUkcayEFNt--oZ59MtodBAD20i6fm+cpXA==

View File

@@ -19,15 +19,16 @@ default: &default
# https://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
development:
<<: *default
database: myapp_development
database: canine_development
# The specified database role being used to connect to PostgreSQL.
# To create additional roles in PostgreSQL see `$ createuser --help`.
# When left blank, PostgreSQL will use the default role. This is
# the same name as the operating system user running Rails.
#username: myapp
#username: canine
# The password associated with the PostgreSQL role (username).
#password:
@@ -55,7 +56,7 @@ development:
# Do not set this db to the same as development or production.
test:
<<: *default
database: myapp_test
database: canine_test
# As with config/credentials.yml, you never want to store sensitive information,
# like your database password, in your source code. If your source code is
@@ -79,6 +80,6 @@ test:
#
production:
<<: *default
database: myapp_production
username: myapp
password: <%= ENV["MYAPP_DATABASE_PASSWORD"] %>
database: canine_production
username: canine
password: <%= ENV["CANINE_DATABASE_PASSWORD"] %>

View File

@@ -1,8 +1,7 @@
require 'active_support/core_ext/integer/time'
require "active_support/core_ext/integer/time"
Rails.application.configure do
config.hosts << /.*\.github\.dev/
config.action_controller.allow_forgery_protection = false
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded any time
@@ -16,19 +15,17 @@ Rails.application.configure do
# Show full error reports.
config.consider_all_requests_local = true
# Enable server timing
# Enable server timing.
config.server_timing = true
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
if Rails.root.join('tmp/caching-dev.txt').exist?
if Rails.root.join("tmp/caching-dev.txt").exist?
config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true
config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{2.days.to_i}"
}
config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" }
else
config.action_controller.perform_caching = false
@@ -41,8 +38,12 @@ Rails.application.configure do
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Disable caching for Action Mailer templates even if Action Controller
# caching is enabled.
config.action_mailer.perform_caching = false
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
@@ -68,11 +69,14 @@ Rails.application.configure do
# config.i18n.raise_on_missing_translations = true
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
config.action_view.annotate_rendered_view_with_filenames = true
# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true
# Raise error when a before_action's only/except options reference missing actions
# Raise error when a before_action's only/except options reference missing actions.
config.action_controller.raise_on_missing_callback_actions = true
# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
# config.generators.apply_rubocop_autocorrect_after_generate!
end

View File

@@ -51,6 +51,9 @@ Rails.application.configure do
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = true
# Skip http-to-https redirect for the default health check endpoint.
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
# Log to STDOUT by default
config.logger = ActiveSupport::Logger.new(STDOUT)
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
@@ -68,11 +71,11 @@ Rails.application.configure do
# config.cache_store = :mem_cache_store
# Use a real queuing backend for Active Job (and separate queues per environment).
config.active_job.queue_adapter = :solid_queue
config.solid_queue.connects_to = { database: { writing: :queue } }
# config.active_job.queue_name_prefix = "myapp_production"
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "canine_production"
# Disable caching for Action Mailer templates even if Action Controller
# caching is enabled.
config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.

View File

@@ -18,10 +18,7 @@ Rails.application.configure do
config.eager_load = ENV["CI"].present?
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
}
config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{1.hour.to_i}" }
# Show full error reports and disable caching.
config.consider_all_requests_local = true
@@ -37,6 +34,8 @@ Rails.application.configure do
# Store uploaded files on the local file system in a temporary directory.
config.active_storage.service = :test
# Disable caching for Action Mailer templates even if Action Controller
# caching is enabled.
config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world.
@@ -44,6 +43,10 @@ Rails.application.configure do
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Unlike controllers, the mailer instance doesn't have any context about the
# incoming request so you'll need to provide the :host parameter yourself.
config.action_mailer.default_url_options = { host: "www.example.com" }
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
@@ -59,6 +62,6 @@ Rails.application.configure do
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
# Raise error when a before_action's only/except options reference missing actions
# Raise error when a before_action's only/except options reference missing actions.
config.action_controller.raise_on_missing_callback_actions = true
end

View File

@@ -1,8 +0,0 @@
# Be sure to restart your server when you modify this file.
# ActiveSupport::Reloader.to_prepare do
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
# end

View File

@@ -10,4 +10,4 @@ Rails.application.config.assets.paths << Rails.root.join("node_modules/bootstrap
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
# Rails.application.config.assets.precompile += %w[ admin.js admin.css ]

View File

@@ -1,8 +0,0 @@
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
# by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]

View File

@@ -1,5 +0,0 @@
# Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
Rails.application.config.action_dispatch.cookies_serializer = :json

View File

@@ -126,7 +126,7 @@ Devise.setup do |config|
config.stretches = Rails.env.test? ? 1 : 12
# Set up a pepper to generate the hashed password.
# config.pepper = '7ca924439345cb08813468fffcb208affed90964f9fa0df53c6745e16481b84c7f26fcc1253183f00c4ec36fdc37a2c9c8f99e3d64dd7e091b0cfc5d0b516ead'
# config.pepper = 'b19829491f2f6aa8de30412efc6aeb2288b4fc5029c1aca7c993a053476184cf3df1417b645cb22124d5901ea3cb99aa910d3ad4d5d145a4176a275f15155b16'
# Send a notification to the original email when the user's email is changed.
# config.send_email_changed_notification = false
@@ -273,7 +273,6 @@ Devise.setup do |config|
# up on your models and hooks.
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
env_creds = Rails.application.credentials[Rails.env.to_sym] || {}
%i{ facebook twitter github }.each do |provider|
if options = env_creds[provider]
@@ -281,7 +280,6 @@ Devise.setup do |config|
end
end
# ==> Warden configuration
# If you want to use other strategies, that are not supported by Devise, or
# change the failure app, you can configure them inside the config.warden block.

View File

@@ -4,5 +4,5 @@
# Use this to limit dissemination of sensitive information.
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
Rails.application.config.filter_parameters += [
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
]

View File

@@ -1,4 +0,0 @@
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf

View File

@@ -1,14 +0,0 @@
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json]
end
# To enable root element in JSON for ActiveRecord objects.
# ActiveSupport.on_load(:active_record) do
# self.include_root_in_json = true
# end

View File

@@ -2,43 +2,33 @@
# are invoked here are part of Puma's configuration DSL. For more information
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count
rails_env = ENV.fetch("RAILS_ENV") { "development" }
if rails_env == "production"
# If you are running more than 1 thread per process, the workers count
# should be equal to the number of processors (CPU cores) in production.
#
# It defaults to 1 because it's impossible to reliably detect how many
# CPU cores are available. Make sure to set the `WEB_CONCURRENCY` environment
# variable to match the number of processors.
worker_count = Integer(ENV.fetch("WEB_CONCURRENCY") { 1 })
if worker_count > 1
workers worker_count
else
preload_app!
end
end
# Specifies the `worker_timeout` threshold that Puma will use to wait before
# terminating a worker in development environments.
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
# Puma starts a configurable number of processes (workers) and each process
# serves each request in a thread from an internal thread pool.
#
# The ideal number of threads per worker depends both on how much time the
# application spends waiting for IO operations and on how much you wish to
# to prioritize throughput over latency.
#
# As a rule of thumb, increasing the number of threads will increase how much
# traffic a given process can handle (throughput), but due to CRuby's
# Global VM Lock (GVL) it has diminishing returns and will degrade the
# response time (latency) of the application.
#
# The default is set to 3 threads as it's deemed a decent compromise between
# throughput and latency for the average Rails application.
#
# Any libraries that use a connection pool or another resource pool should
# be configured to provide at least as many connections as the number of
# threads. This includes Active Record's `pool` parameter in `database.yml`.
threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
threads threads_count, threads_count
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
port ENV.fetch("PORT") { 3000 }
# Specifies the `environment` that Puma will run in.
environment rails_env
# Specifies the `pidfile` that Puma will use.
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
port ENV.fetch("PORT", 3000)
# Allow puma to be restarted by `bin/rails restart` command.
plugin :tmp_restart
# Specify the PID file. Defaults to tmp/pids/server.pid in development.
# In other environments, only set the PID file if requested.
pidfile ENV["PIDFILE"] if ENV["PIDFILE"]

View File

@@ -1,18 +0,0 @@
default: &default
dispatchers:
- polling_interval: 1
batch_size: 500
workers:
- queues: "*"
threads: 3
processes: <%= ENV.fetch("JOB_CONCURRENCY", 1) %>
polling_interval: 0.1
development:
<<: *default
test:
<<: *default
production:
<<: *default

View File

@@ -1,9 +0,0 @@
# periodic_cleanup:
# class: CleanSoftDeletedRecordsJob
# queue: background
# args: [ 1000, { batch_size: 500 } ]
# schedule: every hour
# periodic_command:
# command: "SoftDeletedRecord.due.delete_all"
# priority: 2
# schedule: at 5am every day

View File

@@ -1,22 +1,32 @@
require 'sidekiq/web'
Rails.application.routes.draw do
authenticate :user, ->(u) { u.admin? } do
namespace :madmin do
resources :impersonates do
post :impersonate, on: :member
post :stop_impersonating, on: :collection
end
get '/privacy', to: 'home#privacy'
get '/terms', to: 'home#terms'
authenticate :user, lambda { |u| u.admin? } do
mount Sidekiq::Web => '/sidekiq'
namespace :madmin do
resources :impersonates do
post :impersonate, on: :member
post :stop_impersonating, on: :collection
end
end
end
resources :notifications, only: [:index]
resources :announcements, only: [:index]
devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }
devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks" }
root to: 'home#index'
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
# Can be used by load balancers and uptime monitors to verify that the app is live.
get 'up' => 'rails/health#show', as: :rails_health_check
get "up" => "rails/health#show", as: :rails_health_check
# Render dynamic PWA files from app/views/pwa/*
get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker
get "manifest" => "rails/pwa#manifest", as: :pwa_manifest
# Defines the root path route ("/")
# root "posts#index"

View File

@@ -1,18 +0,0 @@
# default: &default
# dispatchers:
# - polling_interval: 1
# batch_size: 500
# workers:
# - queues: "*"
# threads: 3
# processes: 1
# polling_interval: 0.1
#
# development:
# <<: *default
#
# test:
# <<: *default
#
# production:
# <<: *default

View File

@@ -1,6 +0,0 @@
Spring.watch(
".ruby-version",
".rbenv-vars",
"tmp/restart.txt",
"tmp/caching-dev.txt"
)

View File

@@ -1,11 +0,0 @@
class CreateClusters < ActiveRecord::Migration[7.1]
def change
create_table :clusters do |t|
t.string :name, null: false
t.jsonb :kubeconfig, null: false, default: {}
t.references :user, null: false, foreign_key: true
t.timestamps
end
end
end

View File

@@ -1,6 +1,6 @@
# frozen_string_literal: true
class DeviseCreateUsers < ActiveRecord::Migration[7.1]
class DeviseCreateUsers < ActiveRecord::Migration[7.2]
def change
create_table :users do |t|
## Database authenticatable

View File

@@ -1,4 +1,4 @@
class CreateAnnouncements < ActiveRecord::Migration[7.1]
class CreateAnnouncements < ActiveRecord::Migration[7.2]
def change
create_table :announcements do |t|
t.datetime :published_at

View File

@@ -1,4 +1,4 @@
class CreateServices < ActiveRecord::Migration[7.1]
class CreateServices < ActiveRecord::Migration[7.2]
def change
create_table :services do |t|
t.references :user, null: false, foreign_key: true

View File

@@ -52,6 +52,6 @@ class CreateActiveStorageTables < ActiveRecord::Migration[7.0]
setting = config.options[config.orm][:primary_key_type]
primary_key_type = setting || :primary_key
foreign_key_type = setting || :bigint
[primary_key_type, foreign_key_type]
[ primary_key_type, foreign_key_type ]
end
end

View File

@@ -1,129 +0,0 @@
ActiveRecord::Schema[7.1].define(version: 2024_09_04_193154) do
create_table "solid_queue_blocked_executions", force: :cascade do |t|
t.bigint "job_id", null: false
t.string "queue_name", null: false
t.integer "priority", default: 0, null: false
t.string "concurrency_key", null: false
t.datetime "expires_at", null: false
t.datetime "created_at", null: false
t.index [ "concurrency_key", "priority", "job_id" ], name: "index_solid_queue_blocked_executions_for_release"
t.index [ "expires_at", "concurrency_key" ], name: "index_solid_queue_blocked_executions_for_maintenance"
t.index [ "job_id" ], name: "index_solid_queue_blocked_executions_on_job_id", unique: true
end
create_table "solid_queue_claimed_executions", force: :cascade do |t|
t.bigint "job_id", null: false
t.bigint "process_id"
t.datetime "created_at", null: false
t.index [ "job_id" ], name: "index_solid_queue_claimed_executions_on_job_id", unique: true
t.index [ "process_id", "job_id" ], name: "index_solid_queue_claimed_executions_on_process_id_and_job_id"
end
create_table "solid_queue_failed_executions", force: :cascade do |t|
t.bigint "job_id", null: false
t.text "error"
t.datetime "created_at", null: false
t.index [ "job_id" ], name: "index_solid_queue_failed_executions_on_job_id", unique: true
end
create_table "solid_queue_jobs", force: :cascade do |t|
t.string "queue_name", null: false
t.string "class_name", null: false
t.text "arguments"
t.integer "priority", default: 0, null: false
t.string "active_job_id"
t.datetime "scheduled_at"
t.datetime "finished_at"
t.string "concurrency_key"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index [ "active_job_id" ], name: "index_solid_queue_jobs_on_active_job_id"
t.index [ "class_name" ], name: "index_solid_queue_jobs_on_class_name"
t.index [ "finished_at" ], name: "index_solid_queue_jobs_on_finished_at"
t.index [ "queue_name", "finished_at" ], name: "index_solid_queue_jobs_for_filtering"
t.index [ "scheduled_at", "finished_at" ], name: "index_solid_queue_jobs_for_alerting"
end
create_table "solid_queue_pauses", force: :cascade do |t|
t.string "queue_name", null: false
t.datetime "created_at", null: false
t.index [ "queue_name" ], name: "index_solid_queue_pauses_on_queue_name", unique: true
end
create_table "solid_queue_processes", force: :cascade do |t|
t.string "kind", null: false
t.datetime "last_heartbeat_at", null: false
t.bigint "supervisor_id"
t.integer "pid", null: false
t.string "hostname"
t.text "metadata"
t.datetime "created_at", null: false
t.string "name", null: false
t.index [ "last_heartbeat_at" ], name: "index_solid_queue_processes_on_last_heartbeat_at"
t.index [ "name", "supervisor_id" ], name: "index_solid_queue_processes_on_name_and_supervisor_id", unique: true
t.index [ "supervisor_id" ], name: "index_solid_queue_processes_on_supervisor_id"
end
create_table "solid_queue_ready_executions", force: :cascade do |t|
t.bigint "job_id", null: false
t.string "queue_name", null: false
t.integer "priority", default: 0, null: false
t.datetime "created_at", null: false
t.index [ "job_id" ], name: "index_solid_queue_ready_executions_on_job_id", unique: true
t.index [ "priority", "job_id" ], name: "index_solid_queue_poll_all"
t.index [ "queue_name", "priority", "job_id" ], name: "index_solid_queue_poll_by_queue"
end
create_table "solid_queue_recurring_executions", force: :cascade do |t|
t.bigint "job_id", null: false
t.string "task_key", null: false
t.datetime "run_at", null: false
t.datetime "created_at", null: false
t.index [ "job_id" ], name: "index_solid_queue_recurring_executions_on_job_id", unique: true
t.index [ "task_key", "run_at" ], name: "index_solid_queue_recurring_executions_on_task_key_and_run_at", unique: true
end
create_table "solid_queue_recurring_tasks", force: :cascade do |t|
t.string "key", null: false
t.string "schedule", null: false
t.string "command", limit: 2048
t.string "class_name"
t.text "arguments"
t.string "queue_name"
t.integer "priority", default: 0
t.boolean "static", default: true, null: false
t.text "description"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index [ "key" ], name: "index_solid_queue_recurring_tasks_on_key", unique: true
t.index [ "static" ], name: "index_solid_queue_recurring_tasks_on_static"
end
create_table "solid_queue_scheduled_executions", force: :cascade do |t|
t.bigint "job_id", null: false
t.string "queue_name", null: false
t.integer "priority", default: 0, null: false
t.datetime "scheduled_at", null: false
t.datetime "created_at", null: false
t.index [ "job_id" ], name: "index_solid_queue_scheduled_executions_on_job_id", unique: true
t.index [ "scheduled_at", "priority", "job_id" ], name: "index_solid_queue_dispatch_all"
end
create_table "solid_queue_semaphores", force: :cascade do |t|
t.string "key", null: false
t.integer "value", default: 1, null: false
t.datetime "expires_at", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index [ "expires_at" ], name: "index_solid_queue_semaphores_on_expires_at"
t.index [ "key", "value" ], name: "index_solid_queue_semaphores_on_key_and_value"
t.index [ "key" ], name: "index_solid_queue_semaphores_on_key", unique: true
end
add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
add_foreign_key "solid_queue_ready_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
add_foreign_key "solid_queue_recurring_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
add_foreign_key "solid_queue_scheduled_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
end

132
db/schema.rb generated
View File

@@ -1,132 +0,0 @@
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rails
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
# be faster and is potentially less error prone than running all of your
# migrations from scratch. Old migrations may fail to apply correctly if those
# migrations use external dependencies or application code.
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.1].define(version: 2024_09_25_185426) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "active_storage_attachments", force: :cascade do |t|
t.string "name", null: false
t.string "record_type", null: false
t.bigint "record_id", null: false
t.bigint "blob_id", null: false
t.datetime "created_at", null: false
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
end
create_table "active_storage_blobs", force: :cascade do |t|
t.string "key", null: false
t.string "filename", null: false
t.string "content_type"
t.text "metadata"
t.string "service_name", null: false
t.bigint "byte_size", null: false
t.string "checksum"
t.datetime "created_at", null: false
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
end
create_table "active_storage_variant_records", force: :cascade do |t|
t.bigint "blob_id", null: false
t.string "variation_digest", null: false
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
end
create_table "announcements", force: :cascade do |t|
t.datetime "published_at"
t.string "announcement_type"
t.string "name"
t.text "description"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "clusters", force: :cascade do |t|
t.string "name", null: false
t.jsonb "kubeconfig", default: {}, null: false
t.bigint "user_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["user_id"], name: "index_clusters_on_user_id"
end
create_table "friendly_id_slugs", force: :cascade do |t|
t.string "slug", null: false
t.integer "sluggable_id", null: false
t.string "sluggable_type", limit: 50
t.string "scope"
t.datetime "created_at"
t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true
t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type"
t.index ["sluggable_type", "sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_type_and_sluggable_id"
end
create_table "noticed_events", force: :cascade do |t|
t.string "type"
t.string "record_type"
t.bigint "record_id"
t.jsonb "params"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "notifications_count"
t.index ["record_type", "record_id"], name: "index_noticed_events_on_record"
end
create_table "noticed_notifications", force: :cascade do |t|
t.string "type"
t.bigint "event_id", null: false
t.string "recipient_type", null: false
t.bigint "recipient_id", null: false
t.datetime "read_at", precision: nil
t.datetime "seen_at", precision: nil
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["event_id"], name: "index_noticed_notifications_on_event_id"
t.index ["recipient_type", "recipient_id"], name: "index_noticed_notifications_on_recipient"
end
create_table "services", force: :cascade do |t|
t.bigint "user_id", null: false
t.string "provider"
t.string "uid"
t.string "access_token"
t.string "access_token_secret"
t.string "refresh_token"
t.datetime "expires_at"
t.text "auth"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["user_id"], name: "index_services_on_user_id"
end
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.string "first_name"
t.string "last_name"
t.datetime "announcements_last_read_at"
t.boolean "admin", default: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["email"], name: "index_users_on_email", unique: true
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
add_foreign_key "clusters", "users"
add_foreign_key "services", "users"
end

96
esbuild.config.mjs Normal file
View File

@@ -0,0 +1,96 @@
#!/usr/bin/env node
// Esbuild is configured with 3 modes:
//
// `yarn build` - Build JavaScript and exit
// `yarn build --watch` - Rebuild JavaScript on change
// `yarn build --reload` - Reloads page when views, JavaScript, or stylesheets change
//
// Minify is enabled when "RAILS_ENV=production"
// Sourcemaps are enabled in non-production environments
import * as esbuild from "esbuild"
import path from "path"
import rails from "esbuild-rails"
import chokidar from "chokidar"
import http from "http"
import { setTimeout } from "timers/promises"
const clients = []
const entryPoints = [
"application.js"
]
const watchDirectories = [
"./app/javascript/**/*.js",
"./app/views/**/*.erb",
"./app/assets/builds/**/*.css", // Wait for cssbundling changes
]
const config = {
absWorkingDir: path.join(process.cwd(), "app/javascript"),
bundle: true,
entryPoints: entryPoints,
minify: process.env.RAILS_ENV == "production",
outdir: path.join(process.cwd(), "app/assets/builds"),
plugins: [rails()],
sourcemap: process.env.RAILS_ENV != "production"
}
async function buildAndReload() {
// Foreman & Overmind assign a separate PORT for each process
const port = parseInt(process.env.PORT)
const context = await esbuild.context({
...config,
banner: {
js: ` (() => new EventSource("http://localhost:${port}").onmessage = () => location.reload())();`,
}
})
// Reload uses an HTTP server as an even stream to reload the browser
http
.createServer((req, res) => {
return clients.push(
res.writeHead(200, {
"Content-Type": "text/event-stream",
"Cache-Control": "no-cache",
"Access-Control-Allow-Origin": "*",
Connection: "keep-alive",
})
)
})
.listen(port)
await context.rebuild()
console.log("[reload] initial build succeeded")
let ready = false
chokidar
.watch(watchDirectories)
.on("ready", () => {
console.log("[reload] ready")
ready = true
})
.on("all", async (event, path) => {
if (ready === false) return
if (path.includes("javascript")) {
try {
await setTimeout(20)
await context.rebuild()
console.log("[reload] build succeeded")
} catch (error) {
console.error("[reload] build failed", error)
}
}
clients.forEach((res) => res.write("data: update\n\n"))
clients.length = 0
})
}
if (process.argv.includes("--reload")) {
buildAndReload()
} else if (process.argv.includes("--watch")) {
let context = await esbuild.context({...config, logLevel: 'info'})
context.watch()
} else {
esbuild.build(config)
}

View File

@@ -1,59 +0,0 @@
# NOTE: only doing this in development as some production environments (Heroku)
# NOTE: are sensitive to local FS writes, and besides -- it's just not proper
# NOTE: to have a dev-mode tool do its thing in production.
if Rails.env.development?
require 'annotate'
task :set_annotation_options do
# You can override any of these by setting an environment variable of the
# same name.
Annotate.set_defaults(
'active_admin' => 'false',
'additional_file_patterns' => [],
'routes' => 'false',
'models' => 'true',
'position_in_routes' => 'before',
'position_in_class' => 'before',
'position_in_test' => 'before',
'position_in_fixture' => 'before',
'position_in_factory' => 'before',
'position_in_serializer' => 'before',
'show_foreign_keys' => 'true',
'show_complete_foreign_keys' => 'false',
'show_indexes' => 'true',
'simple_indexes' => 'false',
'model_dir' => 'app/models',
'root_dir' => '',
'include_version' => 'false',
'require' => '',
'exclude_tests' => 'false',
'exclude_fixtures' => 'false',
'exclude_factories' => 'false',
'exclude_serializers' => 'false',
'exclude_scaffolds' => 'true',
'exclude_controllers' => 'true',
'exclude_helpers' => 'true',
'exclude_sti_subclasses' => 'false',
'ignore_model_sub_dir' => 'false',
'ignore_columns' => nil,
'ignore_routes' => nil,
'ignore_unknown_models' => 'false',
'hide_limit_column_types' => 'integer,bigint,boolean',
'hide_default_column_types' => 'json,jsonb,hstore',
'skip_on_db_migrate' => 'false',
'format_bare' => 'true',
'format_rdoc' => 'false',
'format_yard' => 'false',
'format_markdown' => 'false',
'sort' => 'false',
'force' => 'false',
'frozen' => 'false',
'classified_sort' => 'true',
'trace' => 'false',
'wrapper_open' => nil,
'wrapper_close' => nil,
'with_comment' => 'true'
)
end
Annotate.load_tasks
end

View File

@@ -0,0 +1,50 @@
<%%= form_with(model: <%= model_resource_name %>) do |form| %>
<%% if <%= singular_table_name %>.errors.any? %>
<div id="error_explanation">
<h2><%%= pluralize(<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h2>
<ul>
<%% <%= singular_table_name %>.errors.full_messages.each do |message| %>
<li><%%= message %></li>
<%% end %>
</ul>
</div>
<%% end %>
<% attributes.each do |attribute| -%>
<div class="mb-3">
<% if attribute.password_digest? -%>
<%%= form.label :password, class: 'form-label' %>
<%%= form.password_field :password, class: 'form-control' %>
</div>
<div class="mb-3">
<%%= form.label :password_confirmation, class: 'form-label' %>
<%%= form.password_field :password_confirmation, class: 'form-control' %>
<% else -%>
<%%= form.label :<%= attribute.column_name %>, class: 'form-label' %>
<% if attribute.field_type == "checkbox" -%>
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %> %>
<% else -%>
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: 'form-control' %>
<% end -%>
<% end -%>
</div>
<% end -%>
<div class="mb-3">
<%% if <%= model_resource_name %>.persisted? %>
<div class="float-end">
<%%= link_to 'Destroy', <%= model_resource_name %>, method: :delete, class: "text-danger", data: { confirm: 'Are you sure?' } %>
</div>
<%% end %>
<%%= form.submit class: 'btn btn-primary' %>
<%% if <%= model_resource_name %>.persisted? %>
<%%= link_to "Cancel", <%= model_resource_name %>, class: "btn btn-link" %>
<%% else %>
<%%= link_to "Cancel", <%= index_helper %>_path, class: "btn btn-link" %>
<%% end %>
</div>
<%% end %>

Some files were not shown because too many files have changed in this diff Show More