I have a ruby on rails project to be deployed with capistrano. Basically I could deploy it with the following code.
cap production deploy
But it gives me the following failure message.
** Invoke staging (first_time)
** Execute staging
** Invoke load:defaults (first_time)
** Execute load:defaults
cap aborted!
Capfile locked at 3.2.1, but 3.3.3 is loaded
I can not find anything on this exception. Do you know what is the real problem. BTW bundle update does not work.
See your config/deploy.rb if there is something such as lock '3.2.1'. Because if your Gemfile has gem capistrano, '~>3.2.1', it will be updated to 3.3.3 but it is locked on deploy.rb. Even using lock '>=3.2.1' i am still having problem with .capistrano/metrics in version 3.3.3.
I added gem 'capistrano', '~> 3.2.1' to Gemfile. After $ bundle update the problem fixed.
Uninstall version 3.3.3 and install 3.2.1 will solve your problem.
1: sudo gem uninstall capistrano
select the version you want to uninstall(3.3.3 in your case)
bundle exec cap production deploy
You need to use the cap command in the context of your bundle rather than the system.
Related
I'm running the run rake db:migration command and terminal is telling me that rake is not a command
$ heroku run rake db:migrate --app"glacial-lake-5597"
Running `rake db:migrate --appglacial-lake-5597` attached to terminal... up, run.1930
bash: rake: command not found
$ heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.4588
bash: rake: command not found
i've already bundle installed and committed changes to git.
I've looked all over StackOverflow and I cannot find the answer
Can someone point me in the right direction
I had the same problem,
The cause was that I hadn't specified a remote branch when first pushing to Heroku, Heroku apps start with a blank repository – they have no branches and no code. So the first time you deploy, you need to specify a remote branch.
git push heroku master
I hadn't done this initially and in doing so this fixed my rake problem.
See if the gem sqlite is in development only.
like this
group :development do
gem 'sqlite3'
gem 'web-console'
gem 'listen', '~> 3.0.5'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
To check to see if your app deployed correctly just look at the trace in your shell after you attempt to push to Heroku. I had been running mine in Cloud 9 and not really looking at the results because they were so small, I'm new to this, and, heck, it had always deployed perfectly before....
When I scrolled through I found two errors mentioned; I corrected these errors, then the heroku db migration ran fine. One error was a missing line of code, the other I found on SO (which I can't refind the link to, sorry), and it had to do with the file extensions for my css files, which I changed from .css to .css.scss.
I know It's better to use this cms on a Virtual machine, with some OS like linux, etc. (because this command: $ wagon serve doesn't run on windows at all)
I decided to use nitrous io and it's working really good (on a ubuntu os) the only problem is when I do the Preview of my locomotive cms installation it shows the backend without the styles (css).
Rails 3.2.19
ruby 2.1.0
Here step by step commands I ran, that didn't work for me:
First, my gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '3.2.19'
gem 'locomotive_cms', '~> 2.4.1', :require => 'locomotive/engine'
group :assets do
gem 'compass', '~> 0.12.7'
gem 'compass-rails', '~> 1.0.2'
gem 'sass-rails', '~> 3.2.6'
gem 'coffee-rails', '~> 3.2.2'
gem 'uglifier', '~> 2.5.1'
gem 'therubyracer', :platforms => :ruby
end
# Use unicorn as the app server
gem 'unicorn'
gem 'rake', '10.0.4'
As suggested in the locomotivecms documentation, I started creating a new rails project for the engine:
$ rails new codigos_comentados_engine --skip-active-record --skip-test-unit --skip-javascript --skip-bundle
$ bundle
Creating the locomotivecms engine:
$ rails generate locomotive:install
Then, some files in the project didn't work in environment/production.rb and environment/development.rb:
Error: undefined method `configure' for #<CodigosComentadosEngine::Application:0x007f8
03fe43bf0> (NoMethodError)
Solved when changing this:
Rails.Aplication.configure do
by this:
CodigosComentadosEngine::Application.configure do
Then, locomotive engine worked well and I got this nice output :
1. blah blah
2. bundle exec unicorn_rails
3. Open your browser
open localhost:8080
4. Follow the installation wizard steps
5. Enjoy !
Then:
$ bundle exec unicorn_rails
I got this warning But the server was working anyway:
WARNING: unable to load the content types, Could not connect to any secondary or primary nodes for replica set <Moped::Cluster nodes=[<Moped::Node resolved_address="127.0.0.1:270
17">]>
OK. when I opened this url in my browser: myprojectblahblahblah.nitrousbox.com:8080
I got the next message:
ArgumentError: A secret is required to generate an integrity hash for cookie session data. Use config.secret_token = "some secret phrase of at least 30 characters"in config/initializers/secret_token.rb
Ok. I created the secret token file in config/initializers/secret_token.rb
CodigosComentadosEngine::Application.config.secret_token = 'blahblahblahblahblahblahblahblahblahblahblah'
Installing mongodb according to nitrous help docs:
$ parts install mongodb
Starting mongodb:
$ parts start mongodb
ok. => Started: mongodb
Starting server unicorn again:
$ bundle exec unicorn_rails
everything alright.
...
Preview in the browser: myprojectblahblahblah.nitrousbox.com:8080
BUT The styles of the backend doesn't appear, loads everthing, without the styles I could even create an user and see my site.
When I inspected the html the path of the <script></script> in the head was:
myprojectblahblah.nitrousbox.com:8080/javascripts/locomotive/not_logged_in.js
myprojectblahblah.nitrousbox.com:8080/stylesheets/locomotive/not_logged_in.css
In a forum I found this step by step that worked for them, not for me on nitrous with ubuntu:
link [https://locomotivecms.tenderapp.com/discussions/problems/309-backend-themestyles-does-not-apply-missing-files-reopen#comment_31593155][1]
To make the public/assets directory "appears" in the link was suggested to run this command:
$ RAILS_ENV=production bundle exec rake assets:precompile
After running this command, I got this output:
Digest::Digest is deprecated; use Digest
/home/action/.parts/packages/ruby2.1/2.1.1/bin/ruby /home/action/.gem/ruby/2.1.1/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
Digest::Digest is deprecated; use Digest
But puplic/assets was not appearing in the directory, and not showing any style in the backend of locomotive (the forms, and web is loading)
After that, I ran the same command but with --trace, and i got the following output:
$ RAILS_ENV=production bundle exec rake --trace assets:precompile
OUTPUT:
rake aborted!
Don't know how to build task 'default'
/home/action/.gem/ruby/2.1.1/gems/rake-10.0.4/lib/rake/application.rb:142:in `invoke_task'
...
/home/action/.gem/ruby/2.1.1/gems/rake-10.0.4/bin/rake:33:in `<top (required)>'
/home/action/.gem/ruby/2.1.1/bin/rake:23:in `load'
/home/action/.gem/ruby/2.1.1/bin/rake:23:in `<main>'
I google "rake aborted! Don't know how to build task 'default'" and I noticed that in the Rakefile i had this line:
`Rails.application.load_tasks`
and I changed by:
CodigosComentadosEngine::Application.load_tasks
I added this line in GemFile: gem rake '10.0.4'
Then I ran this command with a successful output: (both RAILS_ENV=development and RAILS_ENV=production return a successful output)
$ RAILS_ENV=development bundle exec rake --trace assets:precompile
Output:
/home/action/.parts/packages/ruby2.1/2.1.1/bin/ruby /home/action/.gem/ruby/2.1.1/bin/rake assets:precompile:all RAILS_ENV=development RAILS_GROUPS=assets --trace
Digest::Digest is deprecated; use Digest
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
**.....
** Execute assets:precompile:primary
....
After that, (according to the forum link I posted) the idea was that you MUST to see the public/assets directory, but I don't see it. The weird thing is that when I installed it on Windows (7) the backend styles loaded perfect, the problem there was the $wagon serve command, that was a known win issue.
I'm going to try in a ubuntu locally, without nitrous. I'll update this question if I have success. Have you got a similar issue with this cms and nitrous?
PS. Sorry My English maybe is not perfect. Thanks for any help!
Running : rake sunspot:reindex --trace
Returned: Don't know how to build task sunspot:reindex.
Tried running rake sunspot:solr:start --trace and got the following output:
** Invoke sunspot:solr:start (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute sunspot:solr:start
Sunspot 2.0.0 | Solr 1.0.9 | rails 2.3.5 | MacOS X
I imagine whats going on here is the gem did not properly reinstall. Also it when working with old apps, you need to make sure that you update your system gems to the right version.
Start from scratch and do the following :
rvm gemset delete your_gemset
cd .
gem update --system 0.0.0 # Whatever version you know worked with the app you are using.
rake gems:install
rake gems:install is very flaky and is essentially why it was replaced with Bundler. Assuming your gems did not install all the way, try to manually install what didn't work :
gem install sunspot_solr
Then finally try the command :
rake sunspot:solr:start
You should have an active PID start that you can reveal by typing :
ps aux | grep solr
If you are running sunspot in a windows environement, then rake sunspot:solr:start will not work.
First you have to change in your C:\Ruby187\lib\ruby\gems\1.8\gems\sunspot-1.2.1\lib\sunspot\server.rb
comment the line
exec(Escape.shell_command(command))
and add the following line
exec(Escape.shell_command(command).gsub("'",'"'))
Then try using rake sunspot:solr:run
This is applicable only for your windows environment
I have trouble deploying my app on heroku. I have added 'pg' gem to Gemfile, and even try to include something like gem 'therubyracer-heroku'.
during
heroku rake db:migrate
I get something like this:
>heroku rake db:migrate
--trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adap
ter` (pg is not part of the bundle. Add it to Gemfile.)
/app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connectio
n_adapters/abstract/connection_specification.rb:71:in `rescue in establish_conne
ction'
Another interesting part is that while pushing to heroku pg is not mentioned during bundle install operation like if it was ignored. I also watched the Gemfile.lock and pg is mentioned there to:
pg (0.11.0-x86-mingw32)
I wonder if it is a Windows gem issue that cause heroku to ignore the pg gem or something ?
Can anyone help or had similar problem ?
//EDIT
Seems related: enter link description here
And looks unsolveable
In your Gemfile limit postgres to your production group;
group :production do
gem "pg"
end
rebundle
bundle --without production
and commit to git (Gemfile and Gemfile.lock) and push to Heroku. That should solve your problem.
Having some issues deploying this. I've tried to deploy it twice now. Here's what I've done so far....
Installed the gems and versions required on the install page:
gem install -v=2.3.5 rails
gem install -v=1.0.1 rack
gem install -v=0.8.7 rake
gem install -v=0.4.2 i18n
Downloaded the package:
git clone git://github.com/chiliproject/chiliproject.git
cd chiliproject
git checkout stable
Had to find and set bundle since it wasn't in my path:
BUNDLE="/usr/lib/ruby/gems/1.8/bin/bundle"
Put my database info into database.yml:
And then started the bundle stuff:
$BUNDLE install --without=postgres rmagick
$BUNDLE exec rake generate_session_store
The last command got the error:
rake aborted!
can't activate rails (= 2.3.5, runtime), already activated rails-2.3.12. Make sure all dependencies are added to Gemfile.
So I changed 2.3.12 to 2.3.5 in the Gemfile and carried on:
RAIL_ENV=production $BUNDLE exec rake db:migrate
Then I got an error on this command too:
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method `autoload_paths' for #<Rails::Configuration:0x68a68dbb82c0>
/home/USERNAME/DOMAIN/public/config/environment.rb:44
I tried commenting out line 44 there, but then it threw another error undefined methodconvert_to_without_fallback_on_iso_8859_1' for class Class' so I didn't want to play around with it further. Note this only happened the second time I tried to deploy it. The first time I tried db:migrate succeeded (and I checked there was not data already in the DB).
*So for the second try I am stuck here :-( *
But this is what happened the first time after db:migrate succeded....
RAILS_ENV=production $BUNDLE exec rake redmine:load_default_data
With the last command however it failed saying permission denied for mysql 'user'#'173.236.128.0/255.255.128.0' and I was like WTF is it trying to connect to a network as if it were a host?
So I moved on, copied my configuration file and environment files in. Changed/added these lines:
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.5'# unless defined? RAILS_GEM_VERSION
if ENV['RAILS_ENV'] == 'production' # don't bother on dev
ENV['GEM_PATH'] = '/home/USERNAME/.gems' + ':/usr/lib/ruby/gems/1.8'
end
Then made this stuff writable and restarted Passenger:
chmod -R 777 files log tmp public/plugin_assets/
touch tmp/restart.txt
Sorry for the wall of text, is anybody able to shine some light on something I've done wrong?
Thanks in advance.
EDIT: So this is all wrong, here's how I got it working
rm ~/.gem*
gem install bundler
PATH=$PATH:/usr/lib/ruby/gems/1.8/bin
cd ~
git clone git://github.com/chiliproject/chiliproject.git
cd chiliproject
git checkout stable
cp * ../example.com/ -R
cd ../example.com
# Make sure database is working
bundle install --without postgres rmagick test
bundle exec rake generate_session_store
RAILS_ENV=production bundle exec rake db:migrate
# No output is no good, check database.yml
RAILS_ENV=production bundle exec rake redmine:load_default_data
Or see this: https://gist.github.com/1127306
The current ChiliProject stable releases (2.x) require the use of bundler. Thus the answer by Slotos is incorrect here. gen install doesn't work anymore, we NEED bundler.
Also, we require Rails 2.3.12 now. You won't get any working results if you arbitrarily edit files. On certain platforms, you need to adapt the Gemfile (e.g. when using Ruby 1.8.6 or for certain versions of ImageMagick). For the currently suggested setup using Ruby 1.8.7 or REE, you don't need to adapt anything though.
For installing the dependencies of the currently stable ChiliProject 2.x releases, you basically need to do the following:
At first you need to make sure that the directory where gem binaries re installed to is in your $PATH. This can be temporarily be achieved by running this (in your case)
export PATH=/usr/lib/ruby/gems/1.8/bin:$PATH
Then you need to install the bundler gem and instruct it to install all dependencies
gem install bundler
bundle install --without rmagick postgres test # in your case
What is really strange in your case is that rake seems to try to enable Rails 2.3.5. It should not do that (and doesn't unless you have changed certain files). I strongly recommend to start with a new clean source tree and don't change any arbitrary files.
Don't mix up gem install commands with bundler package management. You will get unexpected results from doing so.
If you really want to use bundler - add all the gems you want into a Gemfile.
Otherwise just omit it.
Quick search for "bundler chiliproject" lead me to chiliproject-gemfile. Apparently it have been merged into unstable already.