Getting an app live, and beyond
If you followed the articles, you have learned how to create a very simple rails application by now. So how to continue?
Getting an app live out into the internet may be considered the next thing. This is called deployment, and like with everything, there are choices involved. I’ll talk more about the choices and point you towards where you can learn more soon.
But you may feel that our app is not really quite there yet, and wonder how to actually get it to something useful. There are several steps involved: we should polish a little, then get ready to share it. And finally make a plan as to what we want the app to do.
Polishing
As we just generated the app, it still has some rough edges (imo), which boils down to three major choices.
Most people use rspec instead of the default unit-tests. It’s just a make the tests a little easier to read. You install like this. While you’re there, read about test driven development, it’s a big thing in rails.
Rails has been using coffeescript, which translates one to one to javascript, for years. Also standard rails has adopted sass as default, which is a cleaner way of writing css. But rails still uses erb, which is unnecessarily difficult to read and keep clean. I use haml instead, learn how to install it here.
Also you will probably want to use a css framework to help you to get a basic look and feel for your site. The most used framework is bootstrap (latest version is also in sass), learn to install it here.
Sharing code
Code is read many many more times written. Even you may not plan to now, somebody will read your code and wonder. It may even be you :-) Get into the habit of writing good code, with test, and comments if necessary.
Code is managed with tools called version control systems, and most of the coding word uses git nowadays. Learn about it, there are some nice tutorials.
When it comes to public sharing, it is mostly github, but some use bitbucket too. I’d suggest to get a github account and start pushing your code there regularly (daily!). Github also has a nice desktop app, if you don’t want to use the command line.
Plan that app
You should definitely have a project to work on. This will give your learning structure and direction, and show others that you are not just playing around. If you have your own idea good. Maybe check with someone if it is not too difficult.
If you don’t have your own idea, there are two things you can do: one is follow a course or online tutorial. The other is to use a well documented common app, i would suggest a blog.
A blog where a user can make posts, see his posts, and comment on anybody’s posts will be a good and not too complex start. The user is a simple model that you can scaffold. Posts and comment are a bit more complicated and involve learning about associations. Later you can add authentication or profile picture upload if you want.
Deployment
Let’s say you do want to get that app out there now. I’d suggest you go for the easiest option, as in real life this is usually someone else’s job. In fact it is it’s own profession, called devOps. But just so you’ve heard the names of the options i’ll run through it quickly.
Heroku is easily the best options for beginners. It has a free option also a cheap hobby one. It does get more expensive for companies, but for many that is ok, because to them (like us now), what matters is that you can focus on your app and don’t have to earn how to be a devOp. The way it works is that after some initialisation, it just get’s your code and makes it run.
From Amazon Web Services one can machines and many software services. Goolge and MS, have similar offerings, but they are by no means simple. It is a toolbox for the professional. Since heroku’s success, amazon has created a product similar in spirit, called Elastic Beanstalk. It also lets you deploy rails apps with relative ease, though not as easy as heroku. It’s benefit is that you don’t have to pay for the beanstalk service, “only” the underlying amazon services. Also it let’s you exercise much more control if you feel you need it. All in all i would call it an unnecessary compromise.
The cheapest way to have an app (not just a hobby one) on the internet is by renting a dedicated server. This is basically renting a machine or several, to run your software. This means your have to learn how to set up all your software, so it is not the easiest. In Europe i buy from hetzner where machines start from 50¢ a month and you can always get more or bigger.
Heroku and Beanstalk make scaling very easy, or in fact automatic. This means that when you have more users, more machines are used. While this sounds good in principle, the machines are so much more expensive than dedicated ones, that it is still cheaper to plan for the most users you need and just overbuy. As website traffic (your business) usually does not grow so fast, scaling happens by checking your traffic and buying new machines as needed.
Well, it is a bit the easy way. You can use dedicated servers and scale automatically using open source tools too. That way you get best of both, cheap machines, but automatic scaling (never overpay). The price is expertise, you have to lear the tools to do this. As i said, somebody else’s job.
And beyond
This concludes the series about the basics. You’ve learned a little about the web, it’s standards, how to create an app and possibly get it online.
This is the starting point for your own exploration.
Do a course on rails (html/css included).
Get a friend to join you and build an app.
Learn one thing, not everything.
Do regularly.
And if that does not work for you, go to a bootcamp.