Git Product home page Git Product logo

Comments (15)

javierm avatar javierm commented on August 29, 2024

Hi @FabriceHecht πŸ˜„.

Could you provide the contents of your config/deploy-secrets.yml file?

from installer.

FabriceHecht avatar FabriceHecht commented on August 29, 2024

HI @javierm

fabrice@fabrice-VirtualBox:~/consul/config$ cat deploy-secrets.yml
production:
deploy_to: "/home/fabrice/consul"
server1: "192.168.178.85"
user: "fabrice"
db_server: "localhost"
server_name: "192.168.178.85"
ssh_port: "22"
full_app_name: "consul"


fabrice@fabrice-VirtualBox:~/consul/config$ cat deploy.rb
# config valid only for current version of Capistrano
lock "~> 3.14.1"

def deploysecret(key)
  @deploy_secrets_yml ||= YAML.load_file("config/deploy-secrets.yml")[fetch(:stage).to_s]
  @deploy_secrets_yml.fetch(key.to_s, "undefined")
end

set :rails_env, fetch(:stage)
set :rvm1_map_bins, -> { fetch(:rvm_map_bins).to_a.concat(%w[rake gem bundle ruby]).uniq }

set :application, "consul"
set :deploy_to, deploysecret(:deploy_to)
set :ssh_options, port: deploysecret(:ssh_port)

set :repo_url, "https://github.com/FabriceHecht/consul.git"

set :revision, `git rev-parse --short #{fetch(:branch)}`.strip

set :log_level, :info
set :pty, true
set :use_sudo, false

set :linked_files, %w[config/database.yml config/secrets.yml]
set :linked_dirs, %w[.bundle log tmp public/system public/assets public/ckeditor_assets]

set :keep_releases, 5

set :local_user, ENV["USER"]

set :puma_conf, "#{release_path}/config/puma/#{fetch(:rails_env)}.rb"

set :delayed_job_workers, 2
set :delayed_job_roles, :background

set :whenever_roles, -> { :app }

namespace :deploy do
  Rake::Task["delayed_job:default"].clear_actions
  Rake::Task["puma:smart_restart"].clear_actions

  after :updating, "rvm1:install:rvm"
  after :updating, "rvm1:install:ruby"

  after "deploy:migrate", "add_new_settings"

  after :publishing, "setup_puma"

  after :published, "deploy:restart"
  before "deploy:restart", "puma:restart"
  before "deploy:restart", "delayed_job:restart"
  before "deploy:restart", "puma:start"

  after :finished, "refresh_sitemap"

  desc "Deploys and runs the tasks needed to upgrade to a new release"
  task :upgrade do
    after "add_new_settings", "execute_release_tasks"
    invoke "deploy"
  end
end

task :refresh_sitemap do
  on roles(:app) do
    within release_path do
      with rails_env: fetch(:rails_env) do
        execute :rake, "sitemap:refresh:no_ping"
      end
    end
  end
end

task :add_new_settings do
  on roles(:db) do
    within release_path do
      with rails_env: fetch(:rails_env) do
        execute :rake, "settings:add_new_settings"
      end
    end
  end
end

task :execute_release_tasks do
  on roles(:app) do
    within release_path do
      with rails_env: fetch(:rails_env) do
        execute :rake, "consul:execute_release_tasks"
      end
    end
  end
end

desc "Create pid and socket folders needed by puma"
task :setup_puma do
  on roles(:app) do
    with rails_env: fetch(:rails_env) do
      execute "mkdir -p #{shared_path}/tmp/sockets; true"
      execute "mkdir -p #{shared_path}/tmp/pids; true"
    end
  end
end

from installer.

javierm avatar javierm commented on August 29, 2024

@FabriceHecht I take the production server is on the same local network as your computer; is that right? Did you use the installer to install CONSUL with the default deploy user? If not, which user did you create on the production server?

from installer.

FabriceHecht avatar FabriceHecht commented on August 29, 2024

@javierm

I take the production server is on the same local network as your computer; is that right?

Yes, the production server runs (for testing purposes) on an old laptop and the local installation is on my usual working laptop.
They both are in the same network. SSH it self works fine and without password request. I also tried to deploy my fork from my local installation to a server in our data center, which also doesn't work with the same error.

Did you use the installer to install CONSUL with the default deploy user? If not, which user did you create on the production server?

I used the installer for the production installation. The name of my user is fabrice. As I mentioned, I also tried it on a second machine in the datacenter. For this second Installation I used the default deploy user, but with the same result.

from installer.

javierm avatar javierm commented on August 29, 2024

In the second installation, were you also using deploy_to: "/home/fabrice/consul" and user: "fabrice" in the deploy-secrets.yml fiel or did you modified those lines so deploy was used?

from installer.

FabriceHecht avatar FabriceHecht commented on August 29, 2024

@javierm
Yes, I changed it to deploy in the second installation.

from installer.

javierm avatar javierm commented on August 29, 2024

Could you paste the error messages you got in the second installation? Right now I'm not sure on which machine the error is taking place since on both machines the user is fabrice πŸ€”.

from installer.

FabriceHecht avatar FabriceHecht commented on August 29, 2024

@javierm

00:00 rvm1:hook
      01 mkdir -p undefined/rvm1scripts/
#<Thread:0x0000562028b9d310@/home/fabrice/.rvm/gems/ruby-3.0.0/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
	17: from /home/fabrice/.rvm/gems/ruby-3.0.0/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
	16: from /home/fabrice/.rvm/gems/ruby-3.0.0/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:31:in `run'
	15: from /home/fabrice/.rvm/gems/ruby-3.0.0/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
	14: from /home/fabrice/.rvm/gems/ruby-3.0.0/gems/rvm1-capistrano3-1.4.0/lib/rvm1/tasks/capistrano3.rake:5:in `block (3 levels) in <top (required)>'
	13: from /home/fabrice/.rvm/gems/ruby-3.0.0/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:80:in `execute'
	12: from /home/fabrice/.rvm/gems/ruby-3.0.0/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:148:in `create_command_and_execute'
	11: from /home/fabrice/.rvm/gems/ruby-3.0.0/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:148:in `tap'
	10: from /home/fabrice/.rvm/gems/ruby-3.0.0/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:148:in `block in create_command_and_execute'
	 9: from /home/fabrice/.rvm/gems/ruby-3.0.0/gems/sshkit-1.21.2/lib/sshkit/backends/netssh.rb:130:in `execute_command'
	 8: from /home/fabrice/.rvm/gems/ruby-3.0.0/gems/sshkit-1.21.2/lib/sshkit/backends/netssh.rb:177:in `with_ssh'
	 7: from /home/fabrice/.rvm/gems/ruby-3.0.0/gems/sshkit-1.21.2/lib/sshkit/backends/connection_pool.rb:63:in `with'
	 6: from /home/fabrice/.rvm/gems/ruby-3.0.0/gems/sshkit-1.21.2/lib/sshkit/backends/connection_pool.rb:63:in `call'
	 5: from /home/fabrice/.rvm/gems/ruby-3.0.0/gems/net-ssh-6.1.0/lib/net/ssh.rb:251:in `start'
	 4: from /home/fabrice/.rvm/gems/ruby-3.0.0/gems/net-ssh-6.1.0/lib/net/ssh.rb:251:in `new'
	 3: from /home/fabrice/.rvm/gems/ruby-3.0.0/gems/net-ssh-6.1.0/lib/net/ssh/transport/session.rb:73:in `initialize'
	 2: from /home/fabrice/.rbenv/versions/2.6.6/lib/ruby/2.6.0/socket.rb:631:in `tcp'
	 1: from /home/fabrice/.rbenv/versions/2.6.6/lib/ruby/2.6.0/socket.rb:227:in `foreach'
/home/fabrice/.rbenv/versions/2.6.6/lib/ruby/2.6.0/socket.rb:227:in `getaddrinfo': getaddrinfo: Servname not supported for ai_socktype (SocketError)
	1: from /home/fabrice/.rvm/gems/ruby-3.0.0/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/home/fabrice/.rvm/gems/ruby-3.0.0/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as undefined@undefined: getaddrinfo: Servname not supported for ai_socktype (SSHKit::Runner::ExecuteError)
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as undefined@undefined: getaddrinfo: Servname not supported for ai_socktype


Caused by:
SocketError: getaddrinfo: Servname not supported for ai_socktype

Tasks: TOP => rvm1:hook
(See full trace by running task with --trace)

from installer.

javierm avatar javierm commented on August 29, 2024
3: from /home/fabrice/.rvm/gems/ruby-3.0.0/gems/net-ssh-6.1.0/lib/net/ssh/transport/session.rb:73:in `initialize'
2: from /home/fabrice/.rbenv/versions/2.6.6/lib/ruby/2.6.0/socket.rb:631:in `tcp'

@FabriceHecht Are you using both rvm and rbenv on your working laptop? πŸ€” Also RVM seems to be using Ruby 3.0.0, while CONSUL depends on Ruby 2.6.6.

from installer.

FabriceHecht avatar FabriceHecht commented on August 29, 2024

@javierm Yes, I am using both. Should In uninstall one of it? How can I tell RVM to use Ruby 2.6.6?

from installer.

javierm avatar javierm commented on August 29, 2024

They might be incompatible, so yes, uninstall one of them unless you're sure you need both for some reason.

How can I tell RVM to use Ruby 2.6.6?

It should do it automatically because it reads the .ruby-version file present in CONSUL. It's probably failing now because both rvm and rbenv are installed πŸ€”.

from installer.

javierm avatar javierm commented on August 29, 2024

By the way, on your local machine, it doesn't matter whether you use rbenv or RVM. On the production server CONSUL expects RVM though, and that's what the installer sets up.

from installer.

FabriceHecht avatar FabriceHecht commented on August 29, 2024

@javierm I uninstalled rbenv and had to bundle again and set the default ruby version for rvm and now its running into the same error but with rvm instead of rbenv.

fabrice@fabrice-VirtualBox:~/consul$ cap production deploy
00:00 rvm1:hook
      01 mkdir -p undefined/rvm1scripts/
#<Thread:0x00005648a8e0a488@/home/fabrice/.rvm/gems/ruby-2.6.6/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
	17: from /home/fabrice/.rvm/gems/ruby-2.6.6/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
	16: from /home/fabrice/.rvm/gems/ruby-2.6.6/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:31:in `run'
	15: from /home/fabrice/.rvm/gems/ruby-2.6.6/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
	14: from /home/fabrice/.rvm/gems/ruby-2.6.6/gems/rvm1-capistrano3-1.4.0/lib/rvm1/tasks/capistrano3.rake:5:in `block (3 levels) in <top (required)>'
	13: from /home/fabrice/.rvm/gems/ruby-2.6.6/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:80:in `execute'
	12: from /home/fabrice/.rvm/gems/ruby-2.6.6/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:148:in `create_command_and_execute'
	11: from /home/fabrice/.rvm/gems/ruby-2.6.6/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:148:in `tap'
	10: from /home/fabrice/.rvm/gems/ruby-2.6.6/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:148:in `block in create_command_and_execute'
	 9: from /home/fabrice/.rvm/gems/ruby-2.6.6/gems/sshkit-1.21.2/lib/sshkit/backends/netssh.rb:130:in `execute_command'
	 8: from /home/fabrice/.rvm/gems/ruby-2.6.6/gems/sshkit-1.21.2/lib/sshkit/backends/netssh.rb:177:in `with_ssh'
	 7: from /home/fabrice/.rvm/gems/ruby-2.6.6/gems/sshkit-1.21.2/lib/sshkit/backends/connection_pool.rb:63:in `with'
	 6: from /home/fabrice/.rvm/gems/ruby-2.6.6/gems/sshkit-1.21.2/lib/sshkit/backends/connection_pool.rb:63:in `call'
	 5: from /home/fabrice/.rvm/gems/ruby-2.6.6/gems/net-ssh-6.1.0/lib/net/ssh.rb:251:in `start'
	 4: from /home/fabrice/.rvm/gems/ruby-2.6.6/gems/net-ssh-6.1.0/lib/net/ssh.rb:251:in `new'
	 3: from /home/fabrice/.rvm/gems/ruby-2.6.6/gems/net-ssh-6.1.0/lib/net/ssh/transport/session.rb:73:in `initialize'
	 2: from /home/fabrice/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/socket.rb:631:in `tcp'
	 1: from /home/fabrice/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/socket.rb:227:in `foreach'
/home/fabrice/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/socket.rb:227:in `getaddrinfo': getaddrinfo: Servname not supported for ai_socktype (SocketError)
	1: from /home/fabrice/.rvm/gems/ruby-2.6.6/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/home/fabrice/.rvm/gems/ruby-2.6.6/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as undefined@undefined: getaddrinfo: Servname not supported for ai_socktype (SSHKit::Runner::ExecuteError)
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as undefined@undefined: getaddrinfo: Servname not supported for ai_socktype


Caused by:
SocketError: getaddrinfo: Servname not supported for ai_socktype

Tasks: TOP => rvm1:hook
(See full trace by running task with --trace)

from installer.

javierm avatar javierm commented on August 29, 2024

Just realized something:

fabrice@fabrice-VirtualBox:~/consul/config$ cat  -secrets.yml
production:
deploy_to: "/home/fabrice/consul"
server1: "192.168.178.85"
user: "fabrice"
db_server: "localhost"
server_name: "192.168.178.85"
ssh_port: "22"
full_app_name: "consul"

Are the file contents literally these ones? I'm asking because every line except the first one should start with two spaces πŸ€”.

from installer.

javierm avatar javierm commented on August 29, 2024

@FabriceHecht We've added more precise instructions about configuring the deploy-secrets.yml file. Hope that helps!

from installer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.