Why am I getting 404 error after Ubuntu upgrade? - ruby-on-rails

Update:
OK, I'm planning on working with someone to get the site updated ;) , but in the meantime (as I said) I really need to get the site up-and-running. The issue I am having is that the rvm make is failing on that (very old) Ruby version that I need:
Error running '__rvm_make -j8',
please read /home/<user>/.rvm/log/1567793172_ruby-1.8.7-p357/make.log
There has been an error while running make. Halting the installation.
I looked in the log file and it's very long and (to my eyes) incomprehensible, but I've done some research and apparently the most likely issue is that the ssl 1.0 libs (?) are missing. Some folks have used:
apt install libssl1.0-dev openssl1.0
but I'm on a shared hosted server and don't have root access so that doesn't work for me.
Again, I know this is incredibly outdated and I should expect it to work, but if anyone has any ideas I'd be grateful.
======================
Our site was broken (again) when my hosting service upgraded to to Ubuntu Linux version 18.04.1 LTS.
My apologies for my (severely) limited knowledge - the site was put together years ago by a vendor and now as I.T. guy it's fallen on me (I'm well-versed in infrastructure, Windows Server, etc., but not this).
The site is running Ruby on Rails. After the last upgrade (to Ubuntu 16.x AIR) I had issues, and I dove in and with some help from folks here I figured out how to use and install gems, so I managed to install a newer version of Ruby and all the other the requisite gems and got everything working again.
Now I'm trying to get Ruby 2.5.x running. I've installed it and upgraded all the gems, ruby -v shows 2.5.6, Rails shows 6.0.0, Phusion Passenger 6.0.2. I haven't touched any of the site code, other than specifying the newer version numbers in environment.rb and preinitializer.rb.
I must be missing something completely basic because although the main page loads just fine, any subpage throws:
`Not Found
The requested URL /home/join was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.`
so I'm thinking however the paths are being constructed is broken somehow. I did see something online about "." and ".." path constructions having been changed in latest Ubuntu, so I'm wondering if that's related. The folder structure is standard:
home/username/me.com/public
home/username/me.com/config
etc.
and again, I haven't moved anything.
The last time I was at least getting some meaningful errors from Passenger, but I'm not even getting that now. It doesn't seem to be writing anything to the log files, either.
Apologies again for the basic question. Thank you for anything at all that can point me int the right direction.

Related

Can't Load Rails Server Even Could not find pg-0.17.1 in any of the sources

pretty new to all this and ran into a real ditch. I had ruby 2.0.0p353 running with rails 4.1+, everything was setup with homebrew, xcode, git,heroku etc.... I'm on OSX 10.9.4
then came time to try out S3 and install the aws-sdk gem. I was unable to install the nokogiri gem after scouring stackoverflow for days to no avail. I then came across this article online that suggested to update rails and ruby versions. In my attempt to upgrade my ruby version to the latest, I followed the instructions given here as follows:
in terminal and in my app folder:
/usr/local/opt/ruby/bin
export PATH="/usr/local/opt/ruby/bin:$PATH"
source ~/.bash_profile
gem update --system
..I subsequently tried bundle update / installs as well... and receive this error shown on pastebin: http://pastebin.com/Q64j0LwD
Now, things are completely messed up as I am unable to even run a rails server. Getting this error Could not find pg-0.17.1 in any of the sources
I currently have Ruby 2.1.2p95 installed. I don't know what else is installed during this trial and error probably several versions of many things unfortunately. Any advice would be great.
: Could not find pg-0.17.1 in any of the sources
Try postgresapp and use documentation for install and configure postgresql server.
The easiest way to get started with PostgreSQL on the Mac
You're clearly new to rails coding. I made a lot of mistakes when I started. I still make a lot of mistakes, but they're more complex mistakes now, mostly ;)
I'd start by using "RailsInstaller". Excellent way to get all the pieces... except Postgres. As suggested by someone with a name consisting of a lot of non-ASCII characters, PostgresApp is incredibly useful to get a more up to date Postgres without messing with compiling stuff outside the project.
You probably should use "rvm" or "rbenv" to manage your rubies. I've tried both, and I favour rvm. rbenv is recommended, but I spent an awkward half day trying to disentangle the consequence of typing "bundle exec rails new app", before I decided to go back to rvm. rvm works more naturally for me, at the expense of creating gemsets for each project. Which, personally, I like. I want to isolate each thing I add to an OS, so I can work on multiple projects with less contamination, and without having to create a VM for each project.
Contamination is, I think the problem with Nokogiri. Everyone tells you to go install brew or Macports or build it all for yourself from scratch. When you do, you get lots of stuff installed. And that stuff affects the compilation process. I'm about 80% certain that I can't compile Nokogiri with system libraries because other projects have dropped include files that rename iconv_open to libiconv_open - which isn't in the native library. I have Nokogiri compiling now, but only as a result of using GNU iconv, and using the arcane "bundle config" to set up a build time dependency for nokogiri alone to use the /opt/local/include version of iconv. That was time consuming.
So, some advice that I haven't taken for myself yet. Clean out the brew/ports stuff. I suspect that you can run anything you need to, in locally installed project directories, rather than interfering with the OS. Unless you really need something that doesn't ship with a Mac, like an up to date ruby (solved by rbenv/rvm)
Look into Heroku. Low cost way to get started with publishing your small apps.
Make sure you have GitHub and BitBucket accounts. Personally I contribute to projects on GitHub, but my private stuff is on BitBucket - pricing models.
Git looks mad. But git is wonderful. Learn to branch. Lots. Learn to merge. Learn to tag, and learn how to push and pull from an upstream repo. These words may mean nothing to you now, but they will save your sanity. You'll use git to push your projects to Heroku. Just freaking amazing. Learn how to have a staging branch and a live branch, and push each to a different Heroku instance, so you can be testing user acceptance on a public facing server, without contaminating dev or live versions. Git/Heroku. Joyful.
Watch out for several things that bit me... Ruby gets lots of patches. They are meaningful. I spent days trying to work out why a piece of ruby code failed, only to discover it worked in a different patch level. Watch for the updates and apply them - except for 'bundle update'. Don't do 'bundle update' until you are old and wise.
Gem versions - that also bit me. Got a project that worked. Then it didn't, with no code changes at all... except that I'd updated my gems. A later version of a gem upset the code. So...
Bundler is your other friend. Lock down the versions of gems that you need for a project. Don't use "bundle update" unless you are prepared for strange things to happen. Make nice Gemfiles.
You probably need to get to grips with TDD and preferably BDD.
So next thing you need is to get the Qt library installed, and use "gem 'capybara-webkit'" and Cucumber with Rspec-Rails to help you write tests that the browser will execute. Butt saver central, if you start changing gem versions. At least you know when the tests stopped working, and can use git to revert to a known working chunk. More importantly, it saves, eventually, a lot of tedious checking around when something unexpectedly stops working.
Also... make sure that your development group of gems (in Gemfile) includes "better_errors" and "binding_of_caller". A REPL in the browser pane when your code fails, is wonderful.
If you want to just throw some stuff together, e.g. office admin projects that you don't want to spend a load of time refining the UI on, but just build something that works. Try 'hobo'. I find it very useful for rapidly building something. Faster to code it than to spec it or draw it. Seriously. And it is all over-rideable, though I've never turned any Hobo code into something for high scaled usage...
Welcome to the amazing world of developing in Rails, on a Mac. It's a rapidly evolving hoot. Hope that helps. :)

Wrong number of arguments(1 for 0) on every page, even info

I have created a rails 4.0.0.rc1 project on my desktop pc using Ruby 1.9.3. When I try to run it on my laptop I always get the above exception, no matter which page I request. It even happens on /rails/info/properties. Both computers use the same Ruby and Rails version.
The project still works fine on my desktop PC. I am using a Rubymine development server, I have tried running Rails S in command prompt, but I still get the same error.
I realise this means that I am somehow passing a parameter when I should not be, but I have no idea how I'm doing that. What is going on here?
I have tracked down the gem that seems to be causing this. In this case it seems to be 'Therubyracer' causing this issue for me. For some reason I do not have to include it in my gemfile on my desktop, but my laptop does require it to be included.

Rails server always crashing no error

My rails server is always crashing (Ruby console)
I am using windows 7 and I dont get any error in the console. Just an windows error telling my the ruby console how stop working.
Will be great if you add more information about version of Ruby you're using (ruby -v), Version of Rails (saying version 3 is not enough) and any more specific on your settings, like if you're using a MySQL database and how you're connecting to it.
So far, I can point you the the following resources:
Incorrect usage of MySQL library (libmysql.dll) can result in random crashes of Ruby/Rails. See manual installation and compilation steps here
There is a known issue with Ruby 1.9.2 that make it crash on concurrent/multiple threads, reported in Ruby bug tracker #3840. It was not solved in 1.9.2-p290 but is part of Ruby 1.9.3 (due to release in August)
Again, those are the two thing that I can think of based on the scarce information you provided. Please update your question with more details (the development.log file inside log directory should contain something) or even the output that is displayed prior the crash in the console.
I would strongly suggest checking Windows event log and/or ROR logs. Also, what version of ROR are you running?

Ruby on Rails app not loading stylesheet despite it being accessible on the server

I'm currently migrating my Ruby on Rails 2.3.8 apps to a new server running Apache 2.2.17 on FreeBSD 8.1 with Passenger 3, Ruby Enterprise Edition 1.8.7. For some reason, despite the stylesheets being accessible, the apps are not loading them. The code is correct and runs fine on the old setup. Has anyone ran into this?
Update: Wowwww it was an issue with the version of chromium. All is good after updating. Thanks for the help everyone.
I'd check on the permissions -- what user is the ruby process running under (for passenger), and does that user have access to the stylesheet in question.
you can use ls -l to see permission sets for the stylesheets.
This was an issue with the edge-version of Chrome I was using... Should have checked another browser before posting.

How to begin with Ruby on Rails using Windows

I've tried downloading the Rails package and installing it on Windows, but have no idea to make it work.
I have had some experience with this commbination:
PHP 4.x + 5.x (Windows)
LIGHTTPD (Windows)
Connecting to a Firebird Database (Windows)
Can anybody enlighten me?
I've gotten Rails up and running on Windows just following the instructions on the RoR website. To paraphrase:
Download Ruby Windows installer from here. I recommend this one.
Execute the .exe [ruby186-26.exe]
Verify your Windows environment variables now includes C:\ruby\bin in the PATH variable. (My Computer -> Properties -> Advanced -> Environment Variables). If it's not there, add it.
Download Ruby Gems from here.
Extract the zip [rubygems-1.3.0.zip] to a temporary directory.
Open a command window and cd to the temp directory.
Type ruby setup.rb in the command window and hit enter.
After that from the command window type gem install rails
Boom! You have rails on windows.
I've heard good things about Instant Rails I've avoided it though. I highly recommend RadRails for Eclipse. I do all my RoR development in Windows using RadRails to connect to a MySQL database.
Either try Instant Rails, which hasn't been updated in a while.
Or try this tutorial and install everything yourself: http://beans.seartipy.com/2008/06/09/setting-up-rails-development-environment-on-windows-vistaxp/
If you're really beginning and have no special attachment to the stuff you've downloaded, try getting the latest Netbeans (v6.1) which comes with Ruby and Rails build in. Its massively simple to install and get running. (A double click install). Then, once you've done that do a "File > New Project > Ruby > Ruby On Rails Application", press F6 and you'll be looking at the start page of your first Rails App.
To get to grips with it all, I'd suggest Sang Shin's free Ruby On Rails course. Its been running a while, but its free, is hands on, has some excellent material, and covers a great deal. I'm doing it and have learned a lot about Rails and Ruby also.
HTH
I use Heroku this is the Signup page for all my Rails Development
You don't have to install or set up anything and you are up and running Fast.
Also, this is a good tutorial for setting up Instant Rails on Vista:
You should really consider just install a Virtual Machine using VMWare if possible. You can still get start with Windows, but you could come across a lot of hiccups on various packages you want to use. I was from Windows too... now I switched myself to a mac and never looked back....
The point is, Ruby runs just a lot better on any POSIX other than using Windows, so its better not to try forcing anything suppose to work properly on one platform on another one. Practically, you will NEVER consider hosting a rails application in Windows (similarly, I doubted if you should ever consider hosting a PHP app in Windows too... you are just putting more cost to hurt your own feet by doing so...)
Another possibility is try to get Ubuntu setup on a USB memory/ hard drive and boot using that when you want to play Rails, slightly problematic, but better performance.
NetBeans as suggested as beginner IDE is good. Although if you get start properly with a good book (Pragmatic defacto Rails book 3rd edition is a good choice, you will never put that one down even after so long as the references are just too useful). Alternatively Rails Guide is something you shouldn't miss.
These are the best tutorials that I have seen for setting up rails on Windows.
Xp: http://www.buildingwebapps.com/articles/6467-setting-up-rails-on-windows-xp
Vista: http://www.buildingwebapps.com/articles/6491-setting-up-rails-on-windows-vista
I used this tutorial just yesterday and it worked well. BUT you need to install RubyGems yourself, after installing Ruby and before installing Rails. I found this guide helpful for RubyGems installation.
I was not able to use an environment variable to set up the http proxy; instead I must pass that as a param on the CL when installing gems (-p [myproxy].[mysite]:[port])
Late to the party, but could you try this tutorial instead?
Getting Started with Rails and MySQL
Two observations:
--source http://gems.rubyinstaller.org is no longer needed. remove that part from the command
Install latest RC1 for either 1.9.1 or 1.8.6 from here
Hope that helps
Here's some tools that have helped me in Windows for general RoR development
TextMate-like editor: http://www.e-texteditor.com/
Multi-tab SSH client: http://www.vandyke.com/products/securecrt/index.html
Full featured UNIX shell (including git): http://code.google.com/p/msysgit/
I just followed this tutorial, and it worked great the first time, and gives steps to take if you encounter common errors. I HIGHLY recommend it. it's one of the best tutorials I've ever gone through. I'm an ASP .NET guy, and I had no trouble.
My suggestion is to begin with a microframework. Something like Sinatra. You can move to Rails / Merb afterwards.
checkout Rails Windows Installer
it installs :
Ruby 1.8.7-p330
Rails 3.0.3
Git 1.7.3.1
Sqlite 3.7.3
DevKit
Rubystack is a free, all-in-one installer for Windows that installs Apache, MySQL, Ruby, Rails and all other third-party libraries typically used on a development environment (such as Imagemagick). We include PHP as well, but no lighttpd

Resources