Can I use my web server to host my rails application? - ruby-on-rails

I have now build my first Ruby on Rails site and I want to publish/deploy/show it to the world on internet. I have access to space on a web server trough a university that I am associated with. But after some searching I realized that publishing a Rails site is slightly more complicated than publishing a regular html production.
Is there any way to use the space I have? How can I know if the server I have access to is up for the task? Is there any guides on how to do this via SSH or git or whatever? I have search a lot but not found anything useful. It doesn't have to be easy, I just have to work. And it's good if I can learn and understand what I am doing.
I have tried quite extensively to make it work with Heroku (everybody claims it to be so easy) but failed since it will not accept my push. Probably because I use Rails 4.2.2 (I don't want to change this, too many things stopped working when I tried to update) and Paperclip which seems to be known issues.
Please, I'm getting desperate, any help pointing in the right direction is very appreciated.

Related

Custom "Rails Port" (openstreetmap-website) implemention, Ruby-on-Rails "Authenticity Token" problems

I am not trained nor experienced in Ruby-on-Rails. I am a hobbyist developer trying to implement a customization of the openstreetmap-website. So far much of it is working well, and I'm happy with the result.
It is running here: https://opengeofiction.net
This is a reimplementation of a site that has been active since 2012. We have about 200 active users. The former developer decided to abandon the site so I and a group of users have been working to host it.
Most aspects of the site are working fine, but my users keep seeing two issues (I'm guessing they are related) which is driving us all crazy:
"ActionController::InvalidAuthenticityToken" errors
frequent random forced logouts while navigating the site
I think I more-or-less understand what the Authenticity Tokens are and what they're trying to do, but that doesn't help me to even troubleshoot the problem, given I am not an experienced Rails developer.
Can anyone make any suggestions of places to look for answers (either within the application itself, or online forums)?
Is there a way to disable, site-wide, the Authenticity Token system? I don't think it's necessarily needed for a hobbyist site without anything much at stake.
I tried a way I found, a kind of "per controller" disabling of the tokens, using this line at the top of each of the controller pages:
skip_before_action :verify_authenticity_token
This made the ActionController error disappear, but made the forced logout problem worse.
Perhaps the forced logout problem is unrelated? I don't think so, though.
Please be forgiving in your responses. I have worked as a SQL coder and database developer in the past, but this "front end" stuff is pretty much alien to me.
The website is running on Ubuntu 20.04 LTS virtual server. I downloaded a commit of the openstreetmap-website code in late May. Happy to append any other information if people have suggestions for what's relevant.
Thank you in advance.
Credit to my one responder, for their suggestion. As it turned out, we didn't get so far as to try that, because we found out the underlying problem.
Apparently, the openstreetmap-website ("rails port") expects that a production instance will have a tool called memcache installed. It was another member of our team who figured this out, so I don't have the details, but I think that's enough of a hint if someone finds this question in the future and is trying to solve the issue.
Although we are still running the "rails port" as a development instance (rather than production), we are doing so as a de facto production instance, with 100's of active users.
This level of deployment requires memcache to manage the authenticity tokens, I guess.
If I get more details from my colleague about specific steps he took, I'll amend this answer.
Meanwhile, our site is up and running quite well, now.

Deploying a ruby/rails site on register.com

Im new to rails as well as relatively new to web development. Anywho, I've fully developed a site utilizing js, jquery, and rails and now Im hoping to use register.com as the host for it however Im a bit confused on how to go about this. Could someone who perhaps has dealth with register.com and rails provide me with a bit of insight as to how to go about this.
Thanks and sorry for the vagueness of the question im just confused on how to move my project from my computer to register.com
I would recommend using heroku.com instead. Register.com is meant for static webpages, not web applications. Heroku can host your app for free unless you require more resources. You'll just need to buy a domain name. Check it out!

Flex and Ruby on Rails start up

I'm new at Ruby on Rails, but already developed a start project.
Now I figure out that I have to use flash for it, and the best way as I see is Flex.
The problem is that I didn't find no start up guide how to combine these two things. Should I use RubyAMF or WebORB? or both? And will such combination will work fine on Heroku cloud?
For sum up, I'm Looking for some basic info or a short guide for combining RoR and Flex.
Well, here is a really good book on the subject: "Flexible Rails". It has a ton of good info for the combo.
For me, I have done this with a lot of success. I use RoR to develop my RESTfull service and I put the Flex app in the public folder of the Rails app. Of course, an Air app can connect to the service the same way.
I then publish the app using Heroku. The entire end-to-end story is quite solid... assuming, of course, that a Flex-based web app is what you want. I also like a HTML/Coffeescript/Backbone client that does the same thing... but that is a different story all together :)
Good luck. This is certainly a fun combo to be developing with.

How to extend an existing Ruby on Rails CMS to host multiple sites?

I am trying to build a CMS I can use to host multiple sites. I know I'm going to end up reinventing the wheel a million times with this project, so I'm thinking about extending an existing open source Ruby on Rails CMS to meet my needs.
One of those needs is to be able to run multiple sites, while using only one code-base. That way, when there's an update I want to make, I can update it in one place, and the change is reflected on all of the sites. I think that this will be able to scale by running multiple instances of the application.
I think that I can use the domain/subdomain to determine which data to display. For example, someone goes to subdomain1.mysite.com and the application looks in the database for the content for subdomain1.
The problem I see is with most pre-built CMS solutions, they are only designed to host one site, including the one I want to use. So the database is structured to work with one site. However, I had the idea that I could overcome this by "creating a new database" for each site, then specifying which database to connect to based on the domain/subdomain as I mentioned above.
I'm thinking of hosting this on Heroku, so I'm wondering what my options for this might be. I'm not very familiar with Amazon S3, or Amazon SimpleDB, but I feel like there's some sort of "cloud database" that would make this solution a lot more realistic, than creating a new MySQL database for each site.
What do you think? Am I thinking about this the wrong way? What advice do you have to offer in this area?
I've worked on a Rails app like this, and the way it was done there was named-based virtual hosts, with db entries for each site running. Each record was scoped to a site if necessary (blog posts, etc.) while users would have access to all sites running out of that db. Administrator permissions could be global or scoped to one or more sites.
You're absolutely correct when you say you'll reinvent the wheel a million times during the project. Plugins will likely require hacking on top of the CMS itself.
In my situation, it ended up being a waste of almost a million dollars of company money to build that codebase to run multiple sites while still being able to cater to the whims of each client site. It worked, but was not very maintainable due to the number of site-specific hacks that subsequently entered the codebase. You may be able to make it work if you don't have to worry about catering to specific client sites running on your platform.
In the end, you're going to need a layer of indirection to handle the different sites regardless of methodology. We ended up putting it in the database itself. If you go with the different-db-for-each-site method you mentioned, you'll put that layer in your code instead. I'm not sure which one is the better method.
I hope you're able to pull this off. I failed.
Also, as I learned today, Heroku offers postgres instead of mysql for rails apps.
There's James Stewart's Theme Support Plugin for Rails 2.3, and lucasefe's themes_for_rails gem for Rails 3+.
I just started using the 2.3 version and it's working well so far.

Advice for Setting Up Rails Sites for Prototyping

I'm learning Ruby on Rails and have just signed up with LunarPages as my webhosting company. To start, I want to write some test applications and get them uploaded and running on my website just to understand how things work. However, I don't want anyone looking at what I'm working on as I learn. Does anyone have any advice as to how I should structure my pages and sites in such a way that I can keep them hidden until I'm ready to go live? Can I easily do something like this?
www.mysite.com <- everyone can see
www.mysite.com/testapplication1 <- no one can see for now
www.mysite.com/testapplication2 <- no one can see for now
Sorry if this sounds like a stupid question. I'm just starting out. By the way, I have heard of Heroku but I've already paid for this webhosting service so I'd like to get my money's worth, at least until my subscription is up.
Thanks!
I'm not sure if LunarPages offers the level of configurability that is required to run rails apps from sub-directories. I'd use subdomains (testapp1.mysite.com, testapp2.mysite.com) and then use appropriate access control (could be htaccess, HTTP BASIC AUTH in your app, or something more complex like authlogic)

Resources