Capistrano always overrides config/Routes.Rb for the standard Rails code

Asked

Viewed 40 times

1

Good morning guys!

I have the following problem: Every time I run cap production deploy, Capistrano wrote the Routes.Rb with the standard Rails code.

Rails.application.routes.draw do
  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end

No matter how much I change on each deploy, it will always be with that same content.

Does anyone have any idea what it might be?

Thanks in advance!

Gemfile

source 'https://rubygems.org'

gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
gem 'mysql2', '>= 0.3.18', '< 0.5'
gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'jquery-rails'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
gem 'redis', '~> 3.0'
gem 'bcrypt', '~> 3.1.7'

group :development, :test do
  gem 'byebug', platform: :mri
end

group :development do
  gem 'web-console'
  gem 'listen', '~> 3.0.5'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
  gem 'capistrano-rails'
  gem 'capistrano3-nginx'
  gem 'capistrano3-puma'
  gem 'highline'
end

group :production do
  gem 'therubyracer', platforms: :ruby
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Capfile

require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rails'
require 'capistrano/nginx'
require 'capistrano/puma'
require 'capistrano/puma/nginx'

Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }

config/deploy.Rb

lock '3.6.1'

set :application, 'demo-ror'
set :repo_url, '<my_git_repo>'
set :scm, :git
set :branch, :master
set :deploy_to, '/var/www/demo-ror'
set :tmp_dir, '/home/ubuntu/tmp'
set :pty, true
set :format, :airbrussh
set :format_options, command_output: true, log_file: 'log/capistrano.log', color: :auto, truncate: :auto
set :keep_releases, 5
set :keep_assets, 2
set :app_server, true
set :app_server_host, "127.0.0.1"
set :app_server_port, 8080

# nginx
set :nginx_sudo_paths, [:nginx_sites_enabled_dir, :nginx_sites_available_dir]
set :nginx_domains, "<my_domain>"
set :nginx_service_path, "service nginx"
set :nginx_roles, :web
set :nginx_log_path, "#{shared_path}/log"
set :nginx_static_dir, "public"
set :nginx_application_name, "#{fetch(:application)}"
set :nginx_sites_available_dir, "/etc/nginx/sites-available"
set :nginx_sites_enabled_dir, "/etc/nginx/sites-enabled"
set :nginx_template, :default
set :nginx_use_ssl, false
set :nginx_ssl_certificate, "#{fetch(:application)}.crt"
set :nginx_ssl_certificate_path, "/etc/ssl/certs"
set :nginx_ssl_certificate_key, "#{fetch(:application)}.key"
set :nginx_ssl_certificate_key_path, "/etc/ssl/private"
set :nginx_read_timeout, 30

# puma
set :puma_user, fetch(:user)
set :puma_rackup, -> { File.join(current_path, 'config.ru') }
set :puma_state, "#{shared_path}/tmp/pids/puma.state"
set :puma_pid, "#{shared_path}/tmp/pids/puma.pid"
set :puma_bind, "unix://#{shared_path}/tmp/sockets/puma.sock"
set :puma_default_control_app, "unix://#{shared_path}/tmp/sockets/pumactl.sock"
set :puma_conf, "#{shared_path}/puma.rb"
set :puma_access_log, "#{shared_path}/log/puma_access.log"
set :puma_error_log, "#{shared_path}/log/puma_error.log"
set :puma_role, :app
set :puma_env, fetch(:rack_env, fetch(:rails_env, 'production'))
set :puma_threads, [0, 16]
set :puma_workers, 0
set :puma_worker_timeout, nil
set :puma_init_active_record, false
set :puma_preload_app, false
set :puma_plugins, []

namespace :puma do
  desc 'Create Directories for Puma Pids and Socket'
  task :make_dirs do
    on roles(:app) do
      execute "mkdir #{shared_path}/tmp/sockets -p"
      execute "mkdir #{shared_path}/tmp/pids -p"
    end
  end

  before :start, :make_dirs
end

config/Routes.Rb

Rails.application.routes.draw do
  root 'home#index'
end
  • It alters locally or in production?

  • Only when I execute cap Production deploy the Capistrano replaces the Routes.Rb of /var/www/demo-ror/Current/config/Routes.Rb and in the folder releases to the Routes.Rb Rails standard. Locally and in the repository, everything normal.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.