diff --git a/packages/web-server/Capfile b/packages/web-server/Capfile deleted file mode 100644 index 532cfeef5..000000000 --- a/packages/web-server/Capfile +++ /dev/null @@ -1,36 +0,0 @@ -# Load DSL and set up stages -require "capistrano/setup" - -# Include default deployment tasks -require "capistrano/deploy" - -require "capistrano/scm/git" -install_plugin Capistrano::SCM::Git - -require "capistrano/scm/git-with-submodules" -install_plugin Capistrano::SCM::Git::WithSubmodules - -# Include tasks from other gems included in your Gemfile -# -# For documentation on these, see for example: -# -# https://github.com/capistrano/rvm -# https://github.com/capistrano/rbenv -# https://github.com/capistrano/chruby -# https://github.com/capistrano/bundler -# https://github.com/capistrano/rails -# https://github.com/capistrano/passenger -# -require 'capistrano/rvm' -# require 'capistrano/rbenv' -# require 'capistrano/chruby' -require 'capistrano/bundler' -require 'capistrano/rails/assets' -# require 'capistrano/rails/migrations' -require 'capistrano/passenger' -# require 'capistrano/sidekiq' -# require "whenever/capistrano" # Update crontab on deploy - - -# Load custom tasks from `lib/capistrano/tasks` if you have any defined -Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r } diff --git a/packages/web-server/Gemfile b/packages/web-server/Gemfile index 3de81edf9..8174592e1 100644 --- a/packages/web-server/Gemfile +++ b/packages/web-server/Gemfile @@ -1,53 +1,16 @@ source 'https://rubygems.org' -# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' +gem 'dotenv-rails' +gem 'lograge', '~> 0.11.2' +gem 'newrelic_rpm', '~> 7.0' +gem 'non-stupid-digest-assets' +gem 'rack-cors', require: 'rack/cors' gem 'rails', '5.1.7' - -gem 'sass' - -gem "non-stupid-digest-assets" - gem 'secure_headers' -gem 'uglifier' - -gem 'rack-cors', :require => 'rack/cors' - -gem 'dotenv-rails' - -# bundle exec rake doc:rails generates the API under doc/api. -gem 'sdoc', '~> 0.4.0', group: :doc - -# Used for 'respond_to' feature -gem 'responders', '~> 2.0' - -gem 'tzinfo-data' - group :development, :test do - # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug' - - # Access an IRB console on exception pages or by using <%= console %> in views - gem 'web-console', '3.5.1' - - # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring - gem 'spring' - gem 'puma' - - gem 'haml' - - # Deployment tools - gem 'capistrano' - gem 'capistrano-bundler' - gem 'capistrano-passenger', '>= 0.2.0' - gem 'capistrano-rails' - gem 'capistrano-rvm' - gem 'capistrano-sidekiq' - gem 'capistrano-git-with-submodules', '~> 2.0' + gem 'spring' + gem 'web-console', '3.5.1' end - - -gem "lograge", "~> 0.11.2" - -gem "newrelic_rpm", "~> 7.0" diff --git a/packages/web-server/Gemfile.lock b/packages/web-server/Gemfile.lock index 94c4a73dc..5c0e4a8aa 100644 --- a/packages/web-server/Gemfile.lock +++ b/packages/web-server/Gemfile.lock @@ -38,52 +38,21 @@ GEM i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - airbrussh (1.4.0) - sshkit (>= 1.6.1, != 1.7.0) arel (8.0.0) bindex (0.8.1) builder (3.2.4) byebug (11.1.3) - capistrano (3.16.0) - airbrussh (>= 1.0.0) - i18n - rake (>= 10.0.0) - sshkit (>= 1.9.0) - capistrano-bundler (2.0.1) - capistrano (~> 3.1) - capistrano-git-with-submodules (2.0.4) - capistrano (~> 3.7) - capistrano-passenger (0.2.1) - capistrano (~> 3.0) - capistrano-rails (1.6.1) - capistrano (~> 3.1) - capistrano-bundler (>= 1.1, < 3) - capistrano-rvm (0.1.2) - capistrano (~> 3.0) - sshkit (~> 1.2) - capistrano-sidekiq (2.0.0) - capistrano (>= 3.9.0) - capistrano-bundler - sidekiq (>= 6.0) concurrent-ruby (1.1.9) - connection_pool (2.2.5) crass (1.0.6) dotenv (2.7.6) dotenv-rails (2.7.6) dotenv (= 2.7.6) railties (>= 3.2) erubi (1.10.0) - execjs (2.8.1) - ffi (1.15.5) - ffi (1.15.5-x64-mingw32) globalid (1.0.0) activesupport (>= 5.0) - haml (5.2.2) - temple (>= 0.8.0) - tilt i18n (1.10.0) concurrent-ruby (~> 1.0) - json (1.8.6) lograge (0.11.2) actionpack (>= 4) activesupport (>= 4) @@ -98,9 +67,6 @@ GEM mini_mime (1.1.2) mini_portile2 (2.7.1) minitest (5.15.0) - net-scp (3.0.0) - net-ssh (>= 2.6.5, < 7.0.0) - net-ssh (6.1.0) newrelic_rpm (7.2.0) nio4r (2.5.8) nokogiri (1.13.1) @@ -146,29 +112,9 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (13.0.6) - rb-fsevent (0.11.1) - rb-inotify (0.10.1) - ffi (~> 1.0) - rdoc (4.3.0) - redis (4.6.0) request_store (1.5.1) rack (>= 1.4) - responders (2.4.1) - actionpack (>= 4.2.0, < 6.0) - railties (>= 4.2.0, < 6.0) - sass (3.7.4) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - sdoc (0.4.2) - json (~> 1.7, >= 1.7.7) - rdoc (~> 4.0) secure_headers (6.3.3) - sidekiq (6.4.1) - connection_pool (>= 2.2.2) - rack (~> 2.0) - redis (>= 4.2.0) spring (3.1.1) sprockets (4.0.2) concurrent-ruby (~> 1.0) @@ -177,19 +123,10 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sshkit (1.21.2) - net-scp (>= 1.1.2) - net-ssh (>= 2.8.0) - temple (0.8.2) thor (1.2.1) thread_safe (0.3.6) - tilt (2.0.10) tzinfo (1.2.9) thread_safe (~> 0.1) - tzinfo-data (1.2021.5) - tzinfo (>= 1.0.0) - uglifier (4.2.0) - execjs (>= 0.3.0, < 3) web-console (3.5.1) actionview (>= 5.0) activemodel (>= 5.0) @@ -207,28 +144,15 @@ PLATFORMS DEPENDENCIES byebug - capistrano - capistrano-bundler - capistrano-git-with-submodules (~> 2.0) - capistrano-passenger (>= 0.2.0) - capistrano-rails - capistrano-rvm - capistrano-sidekiq dotenv-rails - haml lograge (~> 0.11.2) newrelic_rpm (~> 7.0) non-stupid-digest-assets puma rack-cors rails (= 5.1.7) - responders (~> 2.0) - sass - sdoc (~> 0.4.0) secure_headers spring - tzinfo-data - uglifier web-console (= 3.5.1) BUNDLED WITH diff --git a/packages/web-server/Rakefile b/packages/web-server/Rakefile index ba6b733dd..6d53e7cb2 100644 --- a/packages/web-server/Rakefile +++ b/packages/web-server/Rakefile @@ -1,5 +1,4 @@ -# Add your own tasks in files placed in lib/tasks ending in .rake, -# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. +# Add your own tasks in files placed in lib/tasks ending in .rakeand they will automatically be available to Rake. require File.expand_path('../config/application', __FILE__) diff --git a/packages/web-server/config/application.rb b/packages/web-server/config/application.rb index 44305e849..9ff8798e1 100644 --- a/packages/web-server/config/application.rb +++ b/packages/web-server/config/application.rb @@ -1,5 +1,4 @@ require_relative 'boot' -# require 'rails/all' require "active_model/railtie" require "action_controller/railtie" @@ -24,10 +23,6 @@ module Web end end - # config.action_dispatch.default_headers = { - # 'X-Frame-Options' => 'ALLOWALL' - # } - SecureHeaders::Configuration.default do |config| # Handled by server config.x_frame_options = SecureHeaders::OPT_OUT @@ -59,8 +54,6 @@ module Web } end - # config.middleware.use Rack::Deflater - config.middleware.insert_before(Rack::Sendfile, Rack::Deflater) # Disable auto creation of additional resources with "rails generate" @@ -74,18 +67,5 @@ module Web end config.action_mailer.default_url_options = { host: ENV['APP_HOST'] } - - # SMTP settings - config.action_mailer.delivery_method = :smtp - config.action_mailer.smtp_settings = { - :address => ENV['SMTP_HOST'], - :port => ENV['SMTP_PORT'], - :domain => ENV['SMTP_DOMAIN'], - :user_name => ENV['SMTP_USERNAME'], - :password => ENV['SMTP_PASSWORD'], - :authentication => 'login', - :enable_starttls_auto => true # detects and uses STARTTLS - } - end end diff --git a/packages/web-server/config/cap.example.yml b/packages/web-server/config/cap.example.yml deleted file mode 100644 index 5f63e670c..000000000 --- a/packages/web-server/config/cap.example.yml +++ /dev/null @@ -1,15 +0,0 @@ -default: &default - key_path: /path/to/key.pem - repo_url: https://github.com/sn-project/sn-web-client.git - user: ssh_username - -staging: - <<: *default - server: staging.yourdomain.com - branch: staging - deploy_to: ~/sn-staging-client - -production: - <<: *default - server: yourdomain.com - deploy_to: ~/sn-prod-client diff --git a/packages/web-server/config/deploy.rb b/packages/web-server/config/deploy.rb deleted file mode 100644 index 4db44cb86..000000000 --- a/packages/web-server/config/deploy.rb +++ /dev/null @@ -1,49 +0,0 @@ -CAP_CONFIG = YAML.load_file("config/cap.yml") - -set :application, 'standard-notes' -set :repo_url, CAP_CONFIG["default"]["repo_url"] - -# Default branch is :master -set :branch, `git rev-parse --abbrev-ref main`.chomp - -# Default deploy_to directory is /var/www/my_app_name -# set :deploy_to, '/var/www/my_app_name' - -# Default value for :format is :airbrussh. -# set :format, :airbrussh - -# You can configure the Airbrussh format using :format_options. -# These are the defaults. -# set :format_options, command_output: true, log_file: 'log/capistrano.log', color: :auto, truncate: :auto - -# Default value for :pty is false -# set :pty, true - -# Default value for :linked_files is [] -# set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml') -set :linked_files, fetch(:linked_files, []).push('.env') - -# Default value for linked_dirs is [] -# set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'public/system') -set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'public/system', 'public/uploads') - -# Default value for keep_releases is 5 -# set :keep_releases, 5 - -namespace :deploy do - - after :restart, :clear_cache do - on roles(:web), in: :groups, limit: 3, wait: 5 do - # Here we can do anything such as: - within release_path do - - end - end - end -end - -set :ssh_options, { - keys: %W( #{CAP_CONFIG['default']['key_path']} ), - forward_agent: false, - auth_methods: %w(publickey) -} diff --git a/packages/web-server/config/deploy/production.rb b/packages/web-server/config/deploy/production.rb deleted file mode 100644 index b521af732..000000000 --- a/packages/web-server/config/deploy/production.rb +++ /dev/null @@ -1,63 +0,0 @@ -# server-based syntax -# ====================== -# Defines a single server with a list of roles and multiple properties. -# You can define all roles on a single server, or split them: - -# server 'example.com', user: 'deploy', roles: %w{app db web}, my_property: :my_value -# server 'example.com', user: 'deploy', roles: %w{app web}, other_property: :other_value -# server 'db.example.com', user: 'deploy', roles: %w{db} - -server CAP_CONFIG['production']['server'], user: CAP_CONFIG['production']['user'], roles: %w{app db web} - -set :deploy_to, CAP_CONFIG['production']['deploy_to'] - -# role-based syntax -# ================== - -# Defines a role with one or multiple servers. The primary server in each -# group is considered to be the first unless any hosts have the primary -# property set. Specify the username and a domain or IP for the server. -# Don't use `:all`, it's a meta role. - -# role :app, %w{deploy@example.com}, my_property: :my_value -# role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value -# role :db, %w{deploy@example.com} - - - -# Configuration -# ============= -# You can set any configuration variable like in config/deploy.rb -# These variables are then only loaded and set in this stage. -# For available Capistrano configuration variables see the documentation page. -# http://capistranorb.com/documentation/getting-started/configuration/ -# Feel free to add new variables to customise your setup. - - - -# Custom SSH Options -# ================== -# You may pass any option but keep in mind that net/ssh understands a -# limited set of options, consult the Net::SSH documentation. -# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start -# -# Global options -# -------------- -# set :ssh_options, { -# keys: %w(/home/rlisowski/.ssh/id_rsa), -# forward_agent: false, -# auth_methods: %w(password) -# } -# -# The server-based syntax can be used to override options: -# ------------------------------------ -# server 'example.com', -# user: 'user_name', -# roles: %w{web app}, -# ssh_options: { -# user: 'user_name', # overrides user setting above -# keys: %w(/home/user_name/.ssh/id_rsa), -# forward_agent: false, -# auth_methods: %w(publickey password) -# # password: 'please use keys' -# } diff --git a/packages/web-server/config/deploy/staging.rb b/packages/web-server/config/deploy/staging.rb deleted file mode 100644 index aab109547..000000000 --- a/packages/web-server/config/deploy/staging.rb +++ /dev/null @@ -1,65 +0,0 @@ -# server-based syntax -# ====================== -# Defines a single server with a list of roles and multiple properties. -# You can define all roles on a single server, or split them: - -# server 'example.com', user: 'deploy', roles: %w{app db web}, my_property: :my_value -# server 'example.com', user: 'deploy', roles: %w{app web}, other_property: :other_value -# server 'db.example.com', user: 'deploy', roles: %w{db} - -server CAP_CONFIG['staging']['server'], user: CAP_CONFIG['staging']['user'], roles: %w{app db web} - -set :branch, CAP_CONFIG['staging']['branch'] - -set :deploy_to, CAP_CONFIG['staging']['deploy_to'] - -# role-based syntax -# ================== - -# Defines a role with one or multiple servers. The primary server in each -# group is considered to be the first unless any hosts have the primary -# property set. Specify the username and a domain or IP for the server. -# Don't use `:all`, it's a meta role. - -# role :app, %w{deploy@example.com}, my_property: :my_value -# role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value -# role :db, %w{deploy@example.com} - - - -# Configuration -# ============= -# You can set any configuration variable like in config/deploy.rb -# These variables are then only loaded and set in this stage. -# For available Capistrano configuration variables see the documentation page. -# http://capistranorb.com/documentation/getting-started/configuration/ -# Feel free to add new variables to customise your setup. - - - -# Custom SSH Options -# ================== -# You may pass any option but keep in mind that net/ssh understands a -# limited set of options, consult the Net::SSH documentation. -# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start -# -# Global options -# -------------- -# set :ssh_options, { -# keys: %w(/home/rlisowski/.ssh/id_rsa), -# forward_agent: false, -# auth_methods: %w(password) -# } -# -# The server-based syntax can be used to override options: -# ------------------------------------ -# server 'example.com', -# user: 'user_name', -# roles: %w{web app}, -# ssh_options: { -# user: 'user_name', # overrides user setting above -# keys: %w(/home/user_name/.ssh/id_rsa), -# forward_agent: false, -# auth_methods: %w(publickey password) -# # password: 'please use keys' -# }