Merge master

This commit is contained in:
Michael Ball 2020-02-06 01:20:11 -08:00
commit 7586112f72
217 changed files with 2853 additions and 3035 deletions

View file

@ -1,63 +1,49 @@
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
set :domain, 'proxy-opensuse.suse.de'
set :port, 2252
set :user, 'osem'
set :deploy_to, '/srv/www/vhosts/opensuse.org/events'
set :repository, 'https://github.com/openSUSE/osem.git'
OSEM_DEPLOY_DOMAIN = ENV.fetch('OSEM_DEPLOY_DOMAIN', 'dale.infra.opensuse.org')
OSEM_DEPLOY_PORT = ENV.fetch('OSEM_DEPLOY_PORT', '22')
OSEM_DEPLOY_USER = ENV.fetch('OSEM_DEPLOY_USER', 'osem')
OSEM_DEPLOY_DIR = ENV.fetch('OSEM_DEPLOY_DIR', '/home/osem/events')
OSEM_DEPLOY_REPO = ENV.fetch('OSEM_DEPLOY_REPO', 'https://github.com/openSUSE/osem.git')
OSEM_DEPLOY_BRANCH = ENV.fetch('OSEM_DEPLOY_BRANCH', 'master')
# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
# They will be linked in the 'deploy:link_shared_paths' step.
set :shared_paths, %w{ config/database.yml log public/system config/secrets.yml config/piwik.yml tmp .env.production}
set :application_name, 'osem'
set :domain, OSEM_DEPLOY_DOMAIN
set :user, OSEM_DEPLOY_USER
set :port, OSEM_DEPLOY_PORT
set :deploy_to, OSEM_DEPLOY_DIR
set :repository, OSEM_DEPLOY_REPO
set :branch, OSEM_DEPLOY_BRANCH
task setup: :environment do
queue! %[mkdir -p "#{deploy_to}/shared/log"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/log"]
queue! %[mkdir -p "#{deploy_to}/shared/config"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/config"]
queue! %[touch "#{deploy_to}/shared/config/database.yml"]
queue! %[touch "#{deploy_to}/shared/system"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/system"]
queue %[echo "-----> Be sure to edit 'shared/config/database.yml'."]
end
desc 'Deploys the current version to the server.'
task deploy: :environment do
to :prepare do
queue "cd #{deploy_to}/current && RAILS_ENV=production bin/delayed_job stop"
end
# Shared dirs and files will be symlinked into the app-folder by the 'deploy:link_shared_paths' step.
# Some plugins already add folders to shared_dirs like `mina/rails` add `public/assets`, `vendor/bundle` and many more
# run `mina -d` to see all folders and files already included in `shared_dirs` and `shared_files`
set :shared_dirs, fetch(:shared_dirs, []).push('public/system')
set :shared_files, fetch(:shared_files, []).push('.env.production')
desc "Deploys the current version to the server."
task :deploy do
deploy do
# Put things that will set up an empty directory into a fully set-up
# instance of your project.
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'dump_db'
invoke :'rails:db_migrate'
invoke :'rails:assets_precompile'
#invoke :notify_errbit
to :launch do
queue "sudo /usr/bin/systemctl restart apache2"
queue "cd #{deploy_to}/current && RAILS_ENV=production bin/delayed_job start"
end
invoke :'deploy:cleanup'
on :launch do
in_path(fetch(:current_path)) do
command %{mkdir -p tmp/}
command %{touch tmp/restart.txt}
command %{sudo systemctl restart osem-dj}
end
end
end
end
desc 'Notifies the exception handler of the deploy.'
task :notify_errbit do
revision = `git rev-parse HEAD`.strip
user = ENV['USER']
queue "cd #{deploy_to}/current && RAILS_ENV=production bundle exec rake hoptoad:deploy TO=#{rails_env} REVISION=#{revision} REPO=#{repository} USER=#{user}"
end
desc 'Back ups the database'
task :dump_db do
queue "bundle exec rake dump_db"
end
# For help in making your deploy script, see the Mina documentation:
#
# - https://github.com/mina-deploy/mina/tree/master/docs

View file

@ -1,11 +1,7 @@
Osem::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Allow the web console from the vagrant host ip
config.web_console.whitelisted_ips = '10.0.2.2'
# Use letter_opener_web for Vagrant (launchy won't work)
config.action_mailer.delivery_method = ENV['USER'] == 'vagrant' ? :letter_opener_web : :letter_opener
config.action_mailer.delivery_method = :letter_opener
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development

View file

@ -33,7 +33,7 @@ Osem::Application.configure do
# config.assets.manifest = YOUR_PATH
# Specifies the header that your server uses for sending files
config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for apache
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
@ -43,20 +43,25 @@ Osem::Application.configure do
config.log_level = ENV['OSEM_LOG_LEVEL'].try(:to_sym) || :info
# Prepend all log lines with the following tags
# config.log_tags = [ :subdomain, :uuid ]
config.log_tags = [:uuid]
# Use a different logger for distributed setups
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
# Use a different cache store in production
# config.cache_store = :mem_cache_store
if ENV["MEMCACHEDCLOUD_SERVERS"]
config.cache_store = :dalli_store, ENV["MEMCACHEDCLOUD_SERVERS"].split(','), {
username: ENV["MEMCACHEDCLOUD_USERNAME"],
password: ENV["MEMCACHEDCLOUD_PASSWORD"]
if ENV["OSEM_MEMCACHED_SERVERS"]
config.cache_store = :mem_cache_store, ENV["OSEM_MEMCACHED_SERVERS"].split(','), {
username: ENV["OSEM_MEMCACHED_USERNAME"],
password: ENV["OSEM_MEMCACHED_PASSWORD"]
}
else
config.cache_store = :memory_store, { size: 64.megabytes }
end
# Enable serving of images, stylesheets, and JavaScripts from an asset server

View file

@ -1,7 +1,7 @@
Airbrake.configure do |config|
# Change this to some sensible data for your errbit instance
config.project_id = ENV['OSEM_ERRBIT_APIKEY'] || Rails.application.secrets.errbit_key || ''
config.project_key = ENV['OSEM_ERRBIT_APIKEY'] || Rails.application.secrets.errbit_key || ''
config.project_id = ENV['OSEM_ERRBIT_ID'] || Rails.application.secrets.errbit_id || ''
config.project_key = ENV['OSEM_ERRBIT_KEY'] || Rails.application.secrets.errbit_key || ''
config.host = ENV['OSEM_ERRBIT_HOST']
config.environment = Rails.env
if config.project_key.blank? || config.host.blank?

View file

@ -9,4 +9,3 @@ Rails.application.config.assets.version = '1.0'
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )
Rails.application.config.assets.precompile += %w( Chart.min.js )

View file

@ -0,0 +1,4 @@
Chartkick.options = {
height: '150px',
content_for: :charts_js
}

View file

@ -243,7 +243,7 @@ Devise.setup do |config|
# config.omniauth_path_prefix = "/my_engine/users/auth"
# You will always need to set this parameter.
config.ichain_base_url = "https://events.opensuse.org"
config.ichain_base_url = ENV.fetch('OSEM_ICHAIN_BASE_URL', 'https://events.opensuse.org')
# Paths (relative to ichain_base_url) used by your proxy
# config.ichain_login_path = "ICSLogin/"

View file

@ -20,6 +20,3 @@ ActiveSupport.to_time_preserves_timezone = false
# Require `belongs_to` associations by default. Previous versions had false.
Rails.application.config.active_record.belongs_to_required_by_default = false
# Do not halt callback chains when a callback returns false. Previous versions had true.
ActiveSupport.halt_callback_chains_on_return_false = true

View file

@ -0,0 +1,3 @@
en:
booth: 'booth'
booth_responsible: 'booth responsible'

View file

@ -21,7 +21,7 @@ environment ENV.fetch("RAILS_ENV") { "development" }
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
workers ENV.fetch("WEB_CONCURRENCY") { 2 }
workers ENV.fetch("WEB_CONCURRENCY") { 1 }
# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code

View file

@ -14,11 +14,6 @@ Osem::Application.routes.draw do
path: 'accounts'
end
# Use letter_opener_web to open mails in browser (e.g. necessary for Vagrant)
if Rails.env.development?
mount LetterOpenerWeb::Engine, at: "/letter_opener"
end
resources :users, except: [:new, :index, :create, :destroy] do
resources :openids, only: :destroy
end
@ -174,6 +169,7 @@ Osem::Application.routes.draw do
end
end
resource :program, only: [] do
get 'proposal/:id', to: 'proposals#show' # For backward compatibility
resources :proposals, except: :destroy do
get 'commercials/render_commercial' => 'commercials#render_commercial'
resources :commercials, only: [:create, :update, :destroy]
@ -201,6 +197,9 @@ Osem::Application.routes.draw do
resources :physical_tickets, only: [:index, :show]
resource :subscriptions, only: [:create, :destroy]
resource :schedule, only: [:show] do
collection do
get 'app'
end
member do
get :events
end