mina-deploy / mina Goto Github PK
View Code? Open in Web Editor NEWBlazing fast deployer and server automation tool
Home Page: https://rubygems.org/gems/mina
License: Other
Blazing fast deployer and server automation tool
Home Page: https://rubygems.org/gems/mina
License: Other
Is there any option like
set :use_sudo, true
of capistrano?
are there plans to make it possible to overwrite the default tasks ?
I know I can fork it and make the changes, but I think its better to keep the forks to a minimum..
like if I use git
I think on the initial setup, it should just clone the repository, but on subsequent deploys it should just do a git fetch origin,
when I try to overwrite the git:clone task I get
-----> Cloning the Git repository
fatal: destination path '.' already exists and is not an empty directory.
no matter what i put in the
namespace :git do
desc "Clones the Git repository to the release path."
task :clone do
queue "echo $PATH"
end
end
it does echo the $PATH though..
I apologize if this is user error, but I am unable to get mina
to deploy gems as the shell script generated by git.rb
deletes the .git
directory before executing the user defined portions of the deploy
task. This is a problem as our .gemspec
files use git ls-files
to fill in the file list for the Gemspec DSL.
When rake build
or gem build foo.gemspec
is invoked in the deploy
task, an error is thrown as the .git
directory no longer exists. For rails, deleting the .git
directory is probably not a big deal, but it makes things very difficult when deploying stand alone gems that are built on the remote server and pushed to a local instance of Gem-in-a-box.
Would anyone be opposed to moving the rm -rf .git
command out of git.rb
and into data/deploy.sh.erb
. A good place might be right after the bootstrap section.
Again, if there is something I'm missing here and anyone can suggest a way to accomplish what I want (i.e. building gems on the remote server while still having git ls-files
populating the file list in the .gemspec
) I will happily use your suggestion. However, from what I have attempted so far this seems to be an issue in mina
related to the fact that the .git
directory is deleted prior to executing the user defined portion of the deploy
task.
Thanks.
Hi,
I'm deploying my app as root. Everything is working fine, there is just a problem: I must set the permissions at the #{app_path}/tmp to "nobody:nogroup".
I added a task like
namespace :deploy do
desc "set permissions on tmp directory"
task :fix_permissions => :environment do
queue! %[ echo "---> fixing permission at #{app_path}/tmp"]
queue! %[ chown nobody:nogroup -R "#{app_path}/tmp" ]
end
end
if I add this task to the "deploy" block, it doesn't work *i think the link to current is set after the deploy, because of that it sets the permission in the old release. If i add it to the launch block, i get an error saying that the directory /var/foo/current/tmp (my app_path/tmp) doesn't exist. There is any solution other then switch the deploy user?
Hi,
I was curious how you would handle the case where conditional code is required, something like
if something is installed then
install this
else
install that
I'm in the process of testing out mina with some existing projects and enjoying it so far.
One downside I have noticed is that it it quite a bit slower than Vlad in some cases as Vlad keeps an "scm" folder on the server so that the whole repository doesn't need to be checked out each deploy, is this something that is planned?
For the life of me, I can't figure out how to handle the delayed job daemon. You need to stop the daemon from the currently active release then start it from the new release path. How do you handle a failed release?
task :deploy => :environment do
deploy do
to :prepare do
queue "cd #{deploy_to}/current && RAILS_ENV=production script/delayed_job stop"
end
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:db_migrate'
invoke :'rails:assets_precompile'
to :launch do
queue "touch #{deploy_to}/shared/tmp/restart.txt"
queue "cd #{deploy_to}/current && RAILS_ENV=production script/delayed_job start"
end
end
end
Is this even close?
I am currently using Vlad and Mina looks like a much cleaner alternative as Vlad isn't maintained much anymore.
I might be missing something obvious but is there a way to roll back to a previous release?
Im using mina to deploy multiple apps from single server, which does not have project's source code, but only has scripts to deploy (mina scripts). I created a simple hack that allows you to pass --config
parameter.
So the use case is something like this:
mina deploy --config=/path/to/script
Would it be possible to integrate into master?
You can check out my implementation here - https://github.com/sosedoff/mina/tree/external-config
Not sure if its a correct way to integrate with rake.
I have the following in my deploy.rb: https://gist.github.com/4475871
When I run mina deploy
, Sidekiq is started just as it should be.
However, if I kill sidekiq, and then run mina sidekiq:start
, it never runs. I get this message:
> mina sidekiq:start --verbose 1.9.3p194 master@2ac0d22+rebase โ
-----> Start sidekiq
$ (cd /var/www/site/current && nohup bundle exec sidekiq -e production -C ./config/sidekiq.yml -P /var/www/site/shared/tmp/pids/sidekiq.pid >> ./log/sidekiq.log 2>&1 </dev/null &)
Connection to devbox.lcl closed.
Elapsed time: 1.00 seconds
When calling mina deploy -s
, mina errors out with the message
mina aborted!
fork() function is unimplemented on this machine
(See full trace by running task with --trace)
I called this mina command from within my git bash (msysgit installation) on a Windows 7 64 bit machine. The problem is located at open4 which tries to use the fork command not available on windows.
Is windows support planned?
Rake 10 was released. Should we update readme to test against this version?
# Run specs
$ rspec
$ rspec -t ssh # Run SSH tests (read test_env/config/deploy.rb first)
$ rake=0.9 rspec
$ rake=0.8 rspec
Is there any way to specify which environment Rails should run in for when you have for example a staging environment?
The migrations etc. will also need to run in that environment.
is Gemfile line
gem 'spree', '1.2.0', :git => "https://#{ENV['GUSER']}:#{ENV['GPASS']}@bitbucket.org/constella/spree.git", :branch => "1-2-stable"
how i can set variable GUSER and GPASS ?
.bashrc on server - not
.profile on server - not
queue! "export GUSER=memo" in deploy - no
You have changed in the Gemfile:
* spree from https://:@bitbucket.org/constella/spree.git (at 1-2-stable)
to no specified source
ERROR: Deploy failed.
I think it's a problem that the repository for documentation mina-docs isn't getting maintained well. I think it should be consolidated into the main mina
repository.
Furthermore, I'm not sure how I feel about maintaining separate files for documentation, when there's lots of inline documentation. I'm neither for or against it, though I personally appreciate having both the convenient inline documentation and the ability to make detailed documentation, but maintenance of both are becoming a bit of a burden.
Ideas:
mina-docs
into the main repo. Pro: least work possible, Con: duplication of documentation with inlineRails, RAILS_ENV, and so on are not loading.
I have the following .bash_profile on the server:
export MONGODB_URI="mongodb://localhost/db"
However when assets get precompiled an thus the Rails app gets loaded I get
rake aborted!
db_name must be a string or symbol
Tasks: TOP => environment
(See full trace by running task with --trace)
rake aborted!
Meaning mongodb's ENV variable isn't picked up.
When I force mina to invoke source ~/.bash_profile && rake assets:precompile
everything goes right.
Need help debugging some issue. I have this config for a Rails 3.2.8 app:
require 'mina/bundler' require 'mina/rails' require 'mina/git' set :user, 'user' set :domain, 'somedomain.com' set :deploy_to, "/home/#{user}/public_html/#{domain}" set :repository,"" 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 :'bundle:install' invoke :'rails:db_migrate' invoke :'rails:assets_precompile' to :launch do queue "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml" queue 'touch tmp/restart.txt' end end end
Bundle install task is working.
rails:db_migrate and rails:assets_precompile give me this error:
FATAL: Ident authentication failed for user "katherine"
Issue: My local user name is "katherine" but I specfically set :user to something else which is the username for the server
Why am I getting that error? I also don't have that username in any config file in the production server.
Other info: I do not use RVM. I have a capistrano config file that is working just fine with this line:
require 'bundler/capistrano'
Any help would be greatly appreciated.
Trying to deploy through JRuby using the provided bundle:install
task.
-----> Using revision origin/master
-----> Installing gem dependencies using Bundler
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.3.6)
Using activesupport (3.2.6)
Using builder (3.0.0)
Using activemodel (3.2.6)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.3)
Using actionpack (3.2.6)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.4.4)
Using actionmailer (3.2.6)
Using arel (3.0.2)
Using tzinfo (0.3.33)
Using activerecord (3.2.6)
Using activeresource (3.2.6)
Using addressable (2.2.7)
Using coffee-script-source (1.3.1)
Using execjs (1.3.0)
Using coffee-script (2.2.0)
Using eco-source (1.1.0.rc.1)
Using eco (1.0.0)
Using ejs (1.0.0)
Using rack-ssl (1.3.2)
Using json (1.7.3)
Using rdoc (3.12)
Using thor (0.15.4)
Using railties (3.2.6)
Using jquery-rails (2.0.2)
Using backbone-on-rails (0.9.2.0)
Using backbone-support (0.2.0)
Using bcrypt-ruby (3.0.1)
Using bootstrap-sass (2.0.2)
Using bson (1.6.4)
Using bson_ext (1.6.2)
Using celluloid (0.10.0)
Using multi_xml (0.4.4)
Using httparty (0.8.2)
Using cheddargetter_client_ruby (0.3.2)
Using chunky_png (1.2.5)
Using clockwork (0.4.0)
Using coderay (1.0.6)
Using coffee-rails (3.2.2)
Using fssm (0.2.9)
Using sass (3.1.15)
Using compass (0.12.1)
Using compass-rails (1.0.1)
Using connection_pool (0.9.1)
Using crack (0.3.1)
Using draper (0.11.1)
Using term-ansicolor (1.0.7)
Using foreman (0.39.0)
Using gibberish (1.2.0)
Using haml (3.1.4)
Using haml-rails (0.3.4)
Using launchy (2.1.0)
Using netrc (0.7.1)
Using rest-client (1.6.7)
Using rubyzip (0.9.7)
Using heroku (2.24.1)
Using method_source (0.7.1)
Using mongo (1.6.2)
Using mongoid (2.4.11)
Using parallel (0.5.16)
Using slop (2.4.4)
Using pry (0.9.8.4)
Using puma (1.4.0)
Using rabl (0.6.10)
Using rack-protection (1.2.0)
Using bundler (1.1.4)
Using rails (3.2.6)
Using redis (2.2.2)
Using redis-namespace (1.1.0)
Using sass-rails (3.2.5)
Using sidekiq (1.2.0)
Using sinatra (1.3.2)
Using temple (0.3.5)
Using slim (1.0.4)
Using uglifier (1.2.4)
Your bundle is complete!
-----> Precompiling asset files
Bundler::GemNotFound: Could not find rake-0.9.2.2 in any of the sources
materialize at /home/deployer/.rvm/gems/jruby-1.7.0.preview1@global/gems/bundler-1.1.4/lib/bundler/spec_set.rb:90
map! at org/jruby/RubyArray.java:2382
materialize at /home/deployer/.rvm/gems/jruby-1.7.0.preview1@global/gems/bundler-1.1.4/lib/bundler/spec_set.rb:83
specs at /home/deployer/.rvm/gems/jruby-1.7.0.preview1@global/gems/bundler-1.1.4/lib/bundler/definition.rb:127
specs_for at /home/deployer/.rvm/gems/jruby-1.7.0.preview1@global/gems/bundler-1.1.4/lib/bundler/definition.rb:172
requested_specs at /home/deployer/.rvm/gems/jruby-1.7.0.preview1@global/gems/bundler-1.1.4/lib/bundler/definition.rb:161
requested_specs at /home/deployer/.rvm/gems/jruby-1.7.0.preview1@global/gems/bundler-1.1.4/lib/bundler/environment.rb:23
setup at /home/deployer/.rvm/gems/jruby-1.7.0.preview1@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:11
setup at /home/deployer/.rvm/gems/jruby-1.7.0.preview1@global/gems/bundler-1.1.4/lib/bundler.rb:107
(root) at /home/deployer/.rvm/gems/jruby-1.7.0.preview1@global/gems/bundler-1.1.4/lib/bundler/setup.rb:17
require at org/jruby/RubyKernel.java:991
(root) at /home/deployer/.rvm/rubies/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/custom_require.rb:1
! ERROR: Deploy failed.
-----> Cleaning up build
Unlinking current
OK
! Command failed.
Failed with status 19
It keeps saying it can't find certain gems during the precompile stage. Any idea why?
When running a mina setup --verbose
, it seems like everything works appropriately, but after all of the steps are finished, I receive this in the terminal:
mina aborted!
class or module required
/home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.0/lib/mina/helpers.rb:118:in `is_a?'
/home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.0/lib/mina/helpers.rb:118:in `ssh'
/home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.0/lib/mina/helpers.rb:48:in `block in run!'
/home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.0/lib/mina/helpers.rb:65:in `measure'
/home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.0/lib/mina/helpers.rb:55:in `report_time'
/home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.0/lib/mina/helpers.rb:48:in `run!'
/home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.0/lib/mina/helpers.rb:146:in `mina_cleanup!'
/home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.0/bin/mina:55:in `block (2 levels) in <top (required)>'
/home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.0/bin/mina:26:in `block in <top (required)>'
/home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.0/bin/mina:25:in `instance_eval'
/home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.0/bin/mina:25:in `<top (required)>'
/home/adam/.rvm/gems/ruby-1.9.3-p286/bin/mina:19:in `load'
/home/adam/.rvm/gems/ruby-1.9.3-p286/bin/mina:19:in `<main>'
/home/adam/.rvm/gems/ruby-1.9.3-p286/bin/ruby_noexec_wrapper:14:in `eval'
/home/adam/.rvm/gems/ruby-1.9.3-p286/bin/ruby_noexec_wrapper:14:in `<main>'
(See full trace by running task with --trace)
Any thoughts? I've got gem 'mina', github: 'nadarei/mina'
in the Gemfile.
To not have to download the entire repository over and over it would be nice to be able to keep a local copy.
I've implemented an example of how this could work at jacobat/mina@cf176f7
I'm not sure if there are any issues with the implementation, so for now it's only meant for inspiration.
What do you think?
If I'm not mistaken it's possible to deploy only to single box. I.e. if I have a bunch of identical boxes I have to deploy to each of them explicitly specifying to which box I deploy. Something like this:
mina deploy to=prodbox1 && mina deploy to=prodbox2 && mina deploy to=prodbox3
Is parallel deployment planned anytime soon?
First things first - thanks for great tool ๐
I am using Windows now (yeah...) and trying to deploy with Mina.
I found that generated bash script on Windows Git Bash (mingw32 standard shell) has CRLF line endings, but linux use LF, so there are errors like "Unexpected EOF".
I write this generated script to file, convert line endings to LF and use it manually - everything works fine.
Is this a Mina feature or a mingw32 bug or misconfiguration? :)
Running deploy with the last git commit message containing a non ASCII character throws:
invalid byte sequence in US-ASCII
-----> Creating a temporary build path
$ touch "deploy.lock"
$ mkdir -p "./tmp/build-134148678619043"
$ cd "./tmp/build-134148678619043"
-----> Cloning the Git repository
$ git clone "[email protected]:..." . -n --recursive
Cloning into '.'...
...
remote: Total 55232 (delta 39408), reused 55070 (delta 39262)
Receiving objects: 100% (55232/55232), 57.94 MiB | 1.65 MiB/s, done.
Resolving deltas: 100% (39408/39408), done.
-----> Using revision origin/master
$ git checkout "origin/master" -b current_release 1>/dev/null
Switched to a new branch 'current_release'
$ rm -rf .git
-----> Symlinking shared paths
$ mkdir -p "./config"
$ ln -s "shared/config/database.yml" "./config/database.yml"
The symlink in the last line does not work. Preferably it should be a full path to the original file.
I've found that Debain (and Ubuntu) dont support -s on which
so the new rbenv code doesn't work so I get:
-----> Loading rbenv
Illegal option -s
! rbenv not found
! If rbenv is installed, check your :rbenv_path setting.
! Command failed.
Failed with status 1
If you remove -s on line 19 of mina/lib/rbenv.rb everything seems to work fine. I did a quick test on MacOS and Debian to make sure everything will work as expected:
MacOS:
$ if ! which rbenv >/dev/null; then; echo "not pathed right"; fi
$ if ! which rvm >/dev/null; then; echo "not pathed right"; fi
not pathed right
Debian:
$ if ! which rbenv >/dev/null; then echo "not pathed right"; fi
$ if ! which rvm >/dev/null; then echo "not pathed right"; fi
not pathed right
So it works as expected on both without the -s
Should be a nice quick fix, didn't really feel it was worth opening a pull request to remove 3 characters.
Hi,
I'm trying to deploy to a server where ruby is installed using rbenv
for the deploy user. However, mina doesn't seem to pick it up:
bundle install --without development:test --path "./vendor/bundle" --binstubs bin/ --deployment
bash: line 77: bundle: command not found
I'm never sure which init file gets run on ssh login -- I tried adding the required export PATH=...
statements to .bashrc
, .bash_profile
, and .profile
none of which seemed to help. I also tried setting up the PATH
manually in the deploy task:
# ...
queue 'export PATH=$HOME/.rbenv/bin:$HOME/.rbenv/shims'
queue 'echo "path=$PATH"' # this doesn't include the paths above :(
invoke :'bundle:install'
# ...
without success (I assume each task runs in a subshell maybe?)
Any advice on how to get this setup working?
Thanks!
The "current" link will be briefly nonexistent during a deploy, which would break things like serving static files. Note the unlink()
before symlink()
in the strace below. For an atomic replacement, you can do ln
and then mv
, as in ln -sfn 2 current.new && mv -fv current.new current
.
$ mkdir 1 2
$ ln -s 1 current
$ strace ln -sfn 2 current
execve("/bin/ln", ["ln", "-sfn", "2", "current"], [/* 52 vars */]) = 0
...
lstat("current", {st_mode=S_IFLNK|0777, st_size=1, ...}) = 0
stat("2", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
symlink("2", "current") = -1 EEXIST (File exists)
unlink("current") = 0
symlink("2", "current") = 0
close(0) = 0
close(1) = 0
close(2) = 0
exit_group(0) = ?
That happens pretty often, so I want to know, can we automate this.
~/projects/project_name
folder.me@my_mac ~/dev/project_name[master*]$ mina deploy
-----> Creating a temporary build path
-----> Cloning the Git repository
Cloning into bare repository /home/hosting/projects/project_name/scm...
Host key verification failed.
fatal: The remote end hung up unexpectedly
! ERROR: Deploy failed.
-----> Cleaning up build
Unlinking current
OK
! Command failed.
Failed with status 19
As you can see, deploy fails with Host key verification failed.
3. My fast workaround is ssh
to a server, and git clone
to get a prompt and add repo to the known hosts list.
hosting@fluorine:~/projects/project_name/current$ git clone [email protected]:killthekitten/project_name.git
Cloning into project_name...
The authenticity of host 'github.com (207.97.227.239)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.
remote: Counting objects: 1945, done.
remote: Compressing objects: 100% (941/941), done.
remote: Total 1945 (delta 1040), reused 1862 (delta 958)
Receiving objects: 100% (1945/1945), 5.47 MiB | 977 KiB/s, done.
Resolving deltas: 100% (1040/1040), done.
Can we delegate this Are you sure you want to continue connecting (yes/no)? yes
prompt to a second described step instead of third?
When i run "mina git:clone" the git password prompt works fine. But with "mina deploy" it does not prompt for the git password and the cloning fails.
$ mina git:clone
Password:
-----> Cloning the Git repository
Cloning into bare repository /.../scm...
Enter passphrase for key '/.../.ssh/id_dsa':
remote: Counting objects: 7641, done.
remote: Compressing objects: 100% (3050/3050), done.
remote: Total 7641 (delta 4574), reused 7137 (delta 4252)
Receiving objects: 100% (7641/7641), 53.25 MiB | 11.39 MiB/s, done.
Resolving deltas: 100% (4574/4574), done.
-----> Using git branch 'master'
$ mina deploy
Password:
-----> Creating a temporary build path
-----> Cloning the Git repository
Cloning into bare repository /.../scm...
Permission denied (publickey,keyboard-interactive).
fatal: The remote end hung up unexpectedly
! ERROR: Deploy failed.
-----> Cleaning up build
Unlinking current
OK
! Command failed.
Failed with status 19
I use revision 2033592
In the set of deploy scripts I currently use for most Rails projects I have Capistrano prompt for a password to insert into the database.yml file that will go on the server.
Here's the tutorial I originally followed: http://www.simonecarletti.com/blog/2009/06/capistrano-and-database-yml/ and here's the Cap command: Capistrano::CLI.ui.ask("Enter MySQL database password: ")
Before attempting to build a helper method like this for Mina I figured I'd just ask if anyone else has attempted this or has other preferred methods of getting passwords into config files.
(By the way, a big thanks to the folks who have been working on Mina. It's such a clean and well-documented library in comparison with Capistrano!)
After running mina init
and modifying my deploy.rb to point to my web server, I try to run mina setup
and it hangs after I enter my SSH password. I hit enter, nothing happens, and when I break, it errors out with a broken pipe error. I know I can SSH in using the same account and password. Any thoughts?
The setup part of my deploy.rb is as follows:
set :domain, 'adammargherio.com'
set :deploy_to, '/srv/www/adammargherio.com'
set :repository, 'git://github.com/amargherio/personal.git'
set :branch, 'master'
set :user, 'deploy'
set :port, '22'
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 %[-----> Be sure to edit 'shared/config/database.yml'.]
end
And the results from executing the setup
command are:
[email protected]'s password:
-----> Mina: SIGINT received.
Elapsed time: 68.00 seconds
/home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.1/lib/mina/output_helpers.rb:111:in `write': Broken pipe (Errno::EPIPE)
from /home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.1/lib/mina/output_helpers.rb:111:in `putc'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.1/lib/mina/output_helpers.rb:111:in `block (2 levels) in pretty_system'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.1/lib/mina/output_helpers.rb:108:in `fork'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.1/lib/mina/output_helpers.rb:108:in `block in pretty_system'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/gems/open4-1.3.0/lib/open4.rb:107:in `call'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/gems/open4-1.3.0/lib/open4.rb:107:in `do_popen'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/gems/open4-1.3.0/lib/open4.rb:30:in `popen4'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.1/lib/mina/tools.rb:11:in `popen4'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.1/lib/mina/output_helpers.rb:83:in `pretty_system'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.1/lib/mina/ssh_helpers.rb:43:in `ssh'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.1/lib/mina/helpers.rb:49:in `block in run!'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.1/lib/mina/helpers.rb:76:in `measure'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.1/lib/mina/helpers.rb:65:in `report_time'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.1/lib/mina/helpers.rb:49:in `run!'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.1/lib/mina/helpers.rb:86:in `mina_cleanup!'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.1/bin/mina:55:in `block (2 levels) in <top (required)>'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.1/bin/mina:26:in `block in <top (required)>'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.1/bin/mina:25:in `instance_eval'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/gems/mina-0.2.1/bin/mina:25:in `<top (required)>'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/bin/mina:19:in `load'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/bin/mina:19:in `<main>'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/bin/ruby_noexec_wrapper:14:in `eval'
from /home/adam/.rvm/gems/ruby-1.9.3-p286/bin/ruby_noexec_wrapper:14:in `<main>'
Hello.
I'm running into a strange problem that I hope someone can give me a pointer on. The deployment runs fine but the symlink to <deployment_root>/current is wrong. Each deployment creates a broken symlink to a release path beneath current. Logging in to the server and manually running "ln -s <any_release_path> current" instead of ln -nsf will correctly symlink a release path to current.
desc "Deploys the current version to the server."
task :deploy => :environment do
deploy do
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
to :launch do
queue "touch #{deploy_to}/shared/tmp/restart.txt"
end
end
end
$ mina deploy --verbose
# this is what's creating broken symlinks to current
-----> Updating the current symlink
$ ln -nfs "$release_path" "current"
# an ls of {deploy_to}/current shows this
$ ls -l /var/www/apps/recording-service/current/
total 0
lrwxrwxrwx 1 deployer deployer 10 Dec 23 09:55 1 -> releases/1
lrwxrwxrwx 1 deployer deployer 10 Dec 23 10:06 2 -> releases/2
Is it at all possible to add support for SVN. Or would this best be suited for a complimentary gem. AKA svn-mina.
I could be doing something stupid, but no mina commands work with my fresh project.
mina aborted!
Task Argument Error
/Users/jesse/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task_manager.rb:99:in `resolve_args_with_dependencies'
/Users/jesse/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task_manager.rb:62:in `resolve_args'
/Users/jesse/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task_manager.rb:24:in `define_task'
/Users/jesse/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:310:in `define_task'
/Users/jesse/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/dsl_definition.rb:32:in `task'
/Users/jesse/git/locksmith/config/deploy.rb:22:in `block in <top (required)>'
/Users/jesse/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task_manager.rb:207:in `in_namespace'
/Users/jesse/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/dsl_definition.rb:102:in `namespace'
/Users/jesse/git/locksmith/config/deploy.rb:19:in `<top (required)>'
/Users/jesse/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/Users/jesse/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/jesse/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/Users/jesse/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile'
/Users/jesse/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/jesse/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/Users/jesse/.rvm/gems/ruby-1.9.3-p194@locksmith/gems/mina-0.1.2/bin/mina:45:in `block (2 levels) in <top (required)>'
/Users/jesse/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/jesse/.rvm/gems/ruby-1.9.3-p194@locksmith/gems/mina-0.1.2/bin/mina:26:in `block in <top (required)>'
/Users/jesse/.rvm/gems/ruby-1.9.3-p194@locksmith/gems/mina-0.1.2/bin/mina:25:in `instance_eval'
/Users/jesse/.rvm/gems/ruby-1.9.3-p194@locksmith/gems/mina-0.1.2/bin/mina:25:in `<top (required)>'
/Users/jesse/.rvm/gems/ruby-1.9.3-p194@locksmith/bin/mina:23:in `load'
/Users/jesse/.rvm/gems/ruby-1.9.3-p194@locksmith/bin/mina:23:in `<main>'
Using:
mina (0.1.2)
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.1]
rake (0.9.2.2)
Please advise.
Hi Nadarei,
Agent Forwarding is probably one of the more appealing features of Capistrano. With this option enabled, you won't get this error because it allows you to use your local ssh keys. Normally, like in this case, you have to log in to your server, generate a new SSH key and apply that SSH key to for example Github. Then, this command would work. However with Agent Forwarding you do not need to do that and you can simply use your own local machine's SSH key instead.
-----> Cloning the Git repository
Initialized empty Git repository in /home/deployer/app/tmp/build-1340639447120/.git/
Host key verification failed.
fatal: The remote end hung up unexpectedly
See:
If you're using your own private keys for git, you want to tell Capistrano to use agent forwarding with this command. Agent forwarding can make key management much simpler as it uses your local keys instead of keys installed on the server.
ssh_options[:forward_agent] = true # in Capistrano
It would be great if Mina could also support this feature as it's always pain to add a new key to GitHub for every single server you want to hook up to it.
Note that I looked around and didn't find the option, but if I overlooked something please let me know.
Cheers,
Michael
$ mina deploy
-----> Using git branch 'master'
warning: --depth is ignored in local clones; use file:// instead.
Cloning into ....
done.
hi,
i can't find out how to deploy a local git repository. any advice how to do this? i actually don't want to clone, but take the current branch and upload it.
thanks!
I thought it would be useful to skip database migration task if the database is up to date.
Could utilize rake db:version
and save it as a file somewhere at shared/.schema_version
.
Ideas?
Noticed this on a project where particular needs had me telling rails to dump the schema in SQL format. Result: db does not get migrated on deploy.
I encountered the issue with asset precompilation.
Our app has config option config.assets.compile = false
, which triggers exception when required asset (in our case admin.css
) is not precompiled. Adding the asset into the precompilation list should solve it: config.assets.precompile += ['admin.css']
Here is the issue. Mina skips asset precompilation and thus causes application to fail after next successful deploy. I fixed it by removing the asset folder and ran the deploy again.
Any tips on this?
I'm loving Mina,
but I didn't find how to clean up old releases and/or limit releases
thanks.
Is it on the plans?
Is there a way to mix local shell commands and remote commands?
I take a quick look and it seems that the gem queue all the remote commands until the end, then mina execute the remote commands.
I have an small vps and I can't compile the assets there, I need to precomplile the assets in my local machine first. And it would be nice if I could mix local and remote commands in one task.
I can't even create a task like this:
task :deploy => :prepare_assets do ... end
All the commands will mixed up if I do something like that.
The only solution for me was to create 3 tasks: prepare_assets, deploy and deploy_assests
What do you recommend?
Mina needs to check both db/structure.sql
and db/schema.rb
. See #57 for previous discussions.
All of the Rails tasks are failing. It correctly SSHes to the server, but then fails with:
-----> Precompiling asset files
Could not locate Gemfile
Connection to xxx closed.
! Command failed.
Failed with status 2560
There IS a Gemfile though.
I tried to deploy the same codebase multiple times without commit changes but it seems it keeps recompiling the assets.
According to:
it should not re-compile if no changes took place.
cc @mikong @nadarei/team-nadarei @nadarei.
Take a look at https://github.com/rails/rails/blob/3-2-stable/actionpack/lib/sprockets/assets.rake -- some interesting things of note:
assets:precompile
task simple reinvokes the entire Rake+Rails stack and runs assets:precompile:all
with the right Rake groups (RAILS_ENV=production RAILS_GROUPS=assets
). This is slow.assets:precompile:all
task reinvokes the stack again to render the non-digest assets.Hence we have two optimization options.
Run asset compilation as rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
to bypass the first reinvocation. This speeds it up by a little.
Run asset compilation as rake assets:precompile:primary assets:precompile:nondigest RAILS_ENV=production RAILS_GROUPS=assets
. This speeds it up by at least 100%.
This is a 3.2-specific tweak. I like #2 but it assumes you want digest and non-digest assets.
I haven't delved too deep, but I'm pretty sure Rails 4.0 changes the way this works now.
set :revision, 'some-branch'
git checkout "some-branch" -b current_release 1>/dev/null
fatal: git checkout: updating paths is incompatible with switching branches.
$ git --version
git version 1.7.5.4
Kind of a dumb question, but might I suggest renaming domain to host to better align with ssh conventions? Not really a big deal but given that the two don't necessarily line up it might avoid confusion for users (i.e., I'll use hosts in my ssh conf setup as deploy.hostname to handle the connection so I don't have to worry about it in a bunch of deploy files or others stick an IP in as :domain, etc.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.