Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant 'mina setup' but can 'mina ssh' #423

Closed
Francismb opened this issue Aug 29, 2016 · 11 comments
Closed

Cant 'mina setup' but can 'mina ssh' #423

Francismb opened this issue Aug 29, 2016 · 11 comments

Comments

@Francismb
Copy link

So I just thought I would give Mina a go instead of my own server deployment solution...

I configured everything and can connect to the server through 'mina ssh' but if I try 'mina setup' it just hangs after I enter my password and if I press enter again I get a permission denied, almost as if it never registered me entering my password.

@devvmh
Copy link
Contributor

devvmh commented Aug 29, 2016

Can you post the task :setup section of your config/deploy.rb?

Also, are you able to try passwordless authentication using a private key file?

@Francismb
Copy link
Author

Francismb commented Aug 29, 2016

@devvmh I don't believe that i changed anything in the setup task.

task :setup => :environment do
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/log"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/log"]

queue! %[mkdir -p "#{deploy_to}/#{shared_path}/config"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/config"]

queue! %[touch "#{deploy_to}/#{shared_path}/config/database.yml"]
queue! %[touch "#{deploy_to}/#{shared_path}/config/secrets.yml"]
queue %[echo "-----> Be sure to edit '#{deploy_to}/#{shared_path}/config/database.yml' and 'secrets.yml'."]

if repository
repo_host = repository.split(%r{@|://}).last.split(%r{:|/}).first
repo_port = /:([0-9]+)/.match(repository) && /:([0-9]+)/.match(repository)[1] || '22'

queue %[
  if ! ssh-keygen -H  -F #{repo_host} &>/dev/null; then
    ssh-keyscan -t rsa -p #{repo_port} -H #{repo_host} >> ~/.ssh/known_hosts
  fi
]

end
end

@Francismb
Copy link
Author

Francismb commented Aug 30, 2016

This may help, i did get it working entering my ssh password a weird way... mina setup -> Enter password -> Press Enter -> Enter password again -> press enter again... Its odd, its difficult to get the password to be entered.

This is on Arch Linux.

@devvmh
Copy link
Contributor

devvmh commented Aug 30, 2016

Ah ha! That is interesting that it works like that. I'll say again that maybe all you need to do to fix it is set up passwordless authentication to the deploy server with ssh-keygen.

I'm not super familiar with the internals of version 0.3.8... Some good general advice is in the readme here https://github.com/mina-deploy/mina/blob/v0.3.8/Readme.md, including the idea that mina is just shell scripts - so if you have it working, it must be some confusing property of the communication between the server, ssh, and your local machine.

To help diagnose, you can run mina deploy --simulate > mydeploy.sh, and then view and edit the script. In theory, you could even then run ssh [email protected] "bash -s" < mydeploy.sh and it should have roughly the same effect as a regular mina deploy (but including any edits you made). Investigating that way may help with diagnosis.

Another command that might help is mina deploy --trace --verbose, which will give more helpful output so you can see what's going on when it does the deploy. If you could post some of the traceback/output from this command, it might help to find the problem.

@Francismb
Copy link
Author

Francismb commented Sep 13, 2016

[francis@francis-pc Mina-Test]$ mina deploy --trace --verbose
** Invoke deploy (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute deploy
** Invoke git:clone (first_time)
** Execute git:clone
** Invoke deploy:link_shared_paths (first_time)
** Execute deploy:link_shared_paths
** Invoke bundle:install (first_time)
** Execute bundle:install
** Invoke rails:db_migrate (first_time)
** Execute rails:db_migrate
** Invoke rails:assets_precompile (first_time)
** Execute rails:assets_precompile
** Invoke deploy:cleanup (first_time)
** Execute deploy:cleanup
[email protected]'s password:

@Francismb
Copy link
Author

@devvmh Using the tools to dump the bash script works, I now manually connect via ssh and run the bash script.

@devvmh
Copy link
Contributor

devvmh commented Sep 14, 2016

@frazboyz is there a reason you aren't setting up passwordless authentication with a certificate?

@Francismb
Copy link
Author

@devvmh should I need to? Also i can do 'mina console' perfectly fine and i assume the other mina commands that connect over ssh... just not the deploy or setup.

@devvmh
Copy link
Contributor

devvmh commented Sep 15, 2016

The only compelling reason to do it (other than convenience) would be to
identify if it's ssh causing the password prompts, or some other program on
Arch Linux.

I know my Ubuntu servers will ask for a database password if I screw up my
deploy.rb, so it could be something like that. Without seeing your exact
setup it's hard to say.

On Thu, Sep 15, 2016 at 6:12 AM Francis [email protected] wrote:

@devvmh https://github.com/devvmh should I need to? Also i can do 'mina
console' perfectly fine and i assume the other mina commands that connect
over ssh... just not the deploy or setup.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#423 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABVELP6p51COrx_0isGT4KAULkUMIRStks5qqHExgaJpZM4JvD2-
.

@d4be4st
Copy link
Member

d4be4st commented Sep 17, 2016

Mina (both 0.3.8 and 1.0) assume you are communication with your server through publickey, not password.

If you want to use password you will need to change execution mode:

0.3.8 -> add set :term, :system
1.0.0 -> add set :execution_mode, :system

@d4be4st d4be4st closed this as completed Sep 17, 2016
@Francismb
Copy link
Author

@d4be4st setting term does not fix the issue. This is also happing on mac OSX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants