Rails hosting for small photo app - ruby-on-rails

I'm making a small photo-gallery app. The photos will be hosted locally. Right now I use dreamhost but their rails implementation looks horrible. So I'm looking for other options. I know Heroku gives you one 'web dyno' for free, but they don't say anything about how much space you get. As I said, I want my photos stored locally with the app, I don't want to deal with s3 or other cloud storage.

there is no local storage with heroku - only temporary space. you'll need to use S3 or some off-site storage with heroku.
(and I agree, rails on DH is awful, even if you enable passenger)

Use Openshift to deploy your app
checkout this deploying rails app in openshift
openshift provides one permanent data directory to store data and its free

If you are interested in VPS, Digital Ocean - https://www.digitalocean.com/, provides excellent hosting starting from $5. And you can store your photos on the local disc.
There are very good tutorials on their site to get you started with.

Check out Shelly Cloud: https://shellycloud.com/ You get persistent storage (so you don't lose data in case of disk failure) and the deployment is optimized for Rails applications.

With Heroku you can host images that you store in the repository of your project. Just try this:
rails new mytest
create a simple page and link to a test image in your /app/assets/images
heroku create mytest123 # <-- mytest1234 must be your unique app name
and now push the repo to Heroku:
git push origin master # origin points automatically to Heroku after you created this
This is the easiest way to host small projects for free. Sometimes the Dyno takes some time to startup, and you need to point the domain to the right proxy, but these issues can be dealt with later.
S3 comes into play when you deal with uploaded content / images. For this use case, you need S3 which is out of the scope of your question too.

Related

Can Heroku be made to use a persistent filesystem?

I've built an app where users can upload their avatars. I used the paperclip gem and everything works fine on my local machine. On Heroku everything works fine until server restart. Then every uploaded images disappear. Is it possible to keep them on the server?
Notice: I probably should use services such as Amazon S3 or Google Cloud. However each of those services require credit card or banking account information, even if you want to use a free mode. This is a small app just for my portfolio and I would rather avoid sending that information.
No, this isn't possible. Heroku's filesystem is ephemeral and there is no way to make it persistent. You will lose your uploads every time your dyno restarts.
You must use an off-site file storage service like Amazon S3 if you want to store files long-term.
(Technically you could store your images directly in your database, e.g. as a bytea in Postgres, but I strongly advise against that. It's not very efficient and then you have to worry about how to provide the saved files to the browser. Go with S3 or something similar.)

Heroku Hosting Rails

So I host with company X and have my domain on there. I deployed my app to heroku and pointed my domain at it. I can't wrap my head around if I am hosting my site on heroku now or if I am hosting it on company X's servers.
I would assume I'm hosting on herokus server because that is the most logical, but just keep having this brainfart.
Could someone please explain this to me?
Your application is on Heroku's server. All company X has done is perform the DNS magic necessary to map the friendly URL (www.yoursite.com) to your Heroku deployment.
Amazon
You should also be aware that Heroku doesn't actually "store" the app on its own servers - it uses Amazon's ec2 cloud to create instances of your app
So although you have your domain with company X, your app handled through heroku, it will actually be running in one of Amazon's data centers
Keep that in mind when you start to grow (you may find benefits of using Amazon directly)

wordpress edited stylesheet is reset and attached image is gone after a while

I followed this post to setup a wordpress site hosted on Heroku.
As an admin, I edited the stylesheet(style.css) and uploaded some images. It all works and the site is updated successfully. But after a while when I check the site again, our customized codes in the stylesheet and the images uploaded are gone.
Anyone can help me figure out why it happened and how should I fix it?
Find the same question and answer here:
"The problem is because Heroku doesn't allow you to have persistent storage on the Dynos. So initially when you upload the image it'll work but Heroku will sometimes restart your Dyno or move it to some other host (as they constantly shift applications to load balance their servers).
In order to make sure that your images stay online you should use a Wordpress Plugin that uploads to a persistent storage service such as Amazon S3. You could give this plugin a try: Amazon S3 for WordPress
The great thing about using Amazon S3 is that it's free for the first year if you use their Free Tier. You will have some limits but if it's a low traffic site, you shouldn't go beyond them easily."
Wordpress Heroku Featured Images not showing

Rails Heroku Paperclip Files disapperad

I'm developing a webapp with Rails, Paperclip and Heroku but since my last commit were I just added Google Analytics the most of the uploaded images disappeared! That's my link: http://wo42.herokuapp.com/ I don't know why that happened oO
Heroku never used to let you write to their file-system although they have recently introduced something calld the ephemeral file-system - this article explains it. Best option is to use S3.
The actual issue here is that when you push to Heroku your application is re-deployed, and that won't be to the same machine that you were on before (it could be anywhere at any time).
Therefore, if you were uploading images to your local dynos filesystem, only that dyno had access to those files. When you deployed, that dyno would have been destroyed and a new one created.
This is why Heroku recommend that you use a persistent backing service such as S3 to store your uploaded and persisted files. This sort of service is available to all dynos and persists across deploys.
https://devcenter.heroku.com/articles/s3

Publishing a Ruby on Rails website using Amazon S3

I've completed my website using a Ruby on Rails framework, which uses a simple database.
I have set up an Amazon S3 account and would like to upload it to this, however I've been told that I would need more than just this to get the website working.
I am COMPLETELY new to uploading RoR websites, so would anyone be willing to talk me through what needs doing/ why?
Amazon S3 is simply for storing static assets, images, css etc. You can run entirely static sites on it ie html but not 'applications'.
You may have misheard - you could use Amazon EC2 which provide you with a virtual server to host your application and run your application.
If you are entirely new to this process then I suggest you investigate the likes of Heroku (heroku.com) EngineYard, BrightBox, Rackspace etc With the first you probably would be able to use their free offering and deployment is simply by Git - there's no system administration involved.

Resources