not show GUI proper on RAILS_ENV=production server - html

RAIL_ENV= testing or development server looks proper, but on production server not show proper GUI

As per the images shared it seems that the css and styling is not working in production environment.
For it to work, following command would be used:
RAILS_ENV=production rake assets:precompile
Reload the page and check if the css and js rules are being picked or not.

If you're using heroku perhaps you could try it on heroku. First run RAILS_ENV=production rake assets:precompile then run git add . within your working folder. Commit, push and then push to heroku master. See if you still have this issue.

Related

gitlab Health Check is Unhealthy

I'm migration my gitlab to another server. the old gitlab server use postgresql and the new gitlab server use mysql.
I'm convert it with tools calld “DBConvert for MySQL & PostgreSQL”.
Database had sucess convert , and the repo files also copyd to the new gitlab server.
But my projects can't use , when click the projects it notice http code 500.
In gitlab Health check ,it notice
Migrations are pending.
To resolve this issue, run: bin/rake db:migrate RAILS_ENV=production"
And when I run this cmd , it notice "No Rakefile found"
How to proceed from there?
Make sure to execute bin/rake db:migrate RAILS_ENV=production from your GitLab-CE installation folder.
Or try from the same GitLab folder:
bundle exec rake db:migrate RAILS_ENV=production"
my src and dst gitlab version are 8.8.4 , it's the same
In that case, simply do not execute any db:migrate RAILS_ENV=production: that will avoid creating duplicate tables.
Problem is resloved , see link How to resloved "Migrations are pending. To resolve this issue, run: bin/rake db:migrate RAILS_ENV=production".

Ruby on Rails missing nokogiri /nokogiri

I'm doing a tutorial on Ruby on Rails from Lynda, and everything has gone the way it should. All installations and everything has worked flawless.
But after creating a project, when I try to start the server (cmd: rails server) I get the error message:
LoadError: cannot load such file -- nokogiri/nokogiri
I have
* Windows 7 x64
* Rails 4.2.4,
* Gem 2.4.8.
I'm in the directory of the project. All files are there, everything looks ok. I created my project like this: ruby new test_cms and I also tried this: ruby new my_cms -d mysql . Same result.
Any ideas?
It looks as though nokogiri isn't be loaded, so you need it. So first think to do is check that it is in your Gemfile. If it is - move it to the top (I know - strange but it sometimes sorts out similar issues). If it's not, add it:
gem 'nokogiri'
Then run bundle install again.
Then try running bundle exec rails server to run the server with your bundle. You may be running it out of context.
If 'nokogirl' is located in your Gemfile maybe try updating your gems. try $ gem update --system.

Heroku - CSS not loading on a single page but everywhere else

Sorry in advance, I know there are topics on this subject, but this is maddening! I wouldn't be as frustrated if this problem wasn't limited to just the index. The CSS loads fine all on the pages of my app except the post/index page. I should note it runs perfectly locally and I've been banging my head against this since this morning so I may have overlooked something banal and apologize in advance.
Gem file
gem 'rails_12factor', group: :production
gem 'pg', group: :production
Production.rb
config.cache_classes = true
config.serve_static_assets = true
config.assets.compile = true
config.assets.digest = true
Running the following was unsuccessful:
RAILS_ENV=production bundle exec rake assets:precompile
bundle exec rake assets:precompile
Specifying while assets to precompile in production.rb was unsuccessful
config.assets.precompile += %w( public.css public.js )
config.assets.precompile += %w( assets/stylesheets )
Also tried changing the extensions from .css to .scss and adding a new custom.scssand linking to it without success.
Link to my app and the page in question:
https://clickbait22.herokuapp.com/
Link to its Github repository:
https://github.com/4thking/clickbait
Try running...
heroku run bundle exec rake assets:precompile
heroku open
In production, you must run rake assets:precompile to serve up anything in your app/assets folder. In development mode, Rails constantly checks for updates to the files and serves them each one separately.
It is nice when you're developing, but is quite slow in production. So, to speed things up, Rails has you run a single, longer task that shrinks and combines a bunch of files in app/assets, speeding up page loading times and reducing server load.
Hope this helps you out!
UPDATE:
Whilst you said that you have tried doing the following, I want to include it for clarity regardless. Quite often it is important to precompile your assets before you push to Heroku. Inside the terminal this process would look similar to this...
rake assets:precompile
git commit -m 'Assets precompiled'
git push heroku master

How to run db:setup in Capistrano 3 and Rails 4

Just getting started with Capistrano 3, and I noticed on one of my first deploys for my_app that it was complaining about the MySQL database not existing.
DEBUG [aec39935] ActiveRecord::NoDatabaseError: Unknown database 'my_app'
Well that's expected, since this a brand new deploy to a clean server. I included the capistrano-rails gem that's meant to take care of db migrations
require 'capistrano/rails/migrations'
I'd expect it to run db:create before db:migrate so that the database is created, but looks like it doesn't.
Is there a way for me to manually add this in, or reconfigure it so that it does run it?
Thanks.
To my knowledge, you can either create a special task to do this, or just run db:setup manually once. I'd personally recommend the latter.
If you want to make a custom task, take a look at the rails/migration task as an example: https://github.com/capistrano/rails/blob/master/lib/capistrano/tasks/migrations.rake#L15

rake failure due to imagemagick

I'm seeding a development database (mysql) using rake db:seed in Rails 3. The rake task fails, stating,
Validation failed: Logo /var/folders/.../logo.png is not recognized by the 'identify' command.
When I run which identify, I get the expected path /usr/local/bin/identify. ImageMagick is indeed installed (via Homebrew), and appears to work with png images just fine from the command line.
I even rebuilt the app on another machine, thinking that my environment is borked, and I got the same error.
Is there a poltergeist in my terminal sessions?
Have you tried running a bundle exec before the rake. In the past this has often solved these sorts of problems for me. It will ensure your rails environment is loaded before running the rake task.
bundle exec rake db:seed
Hope that helps!
// Addition
Also are you using the Paperclip gem to do this import? I do remember that I needed to ensure the path to ImageMagick was set in my development.rb file to ensure this was picked up.
Eg.
Paperclip.options[:command_path] = "/usr/local/bin"