Going live with Ecrire

Starting Ecrire on your development machine is a very simple process. Every time I look at the process of installing Ecrire, I try to simplify it to make it easier for non-ruby developers to get started in a foreign environment.

Ecrire comes with its own HTTP server that you can run in development. By default Rails (the foundation on which Ecrire is built) will install something called WebRick that will host your application. No need to install Apache, Nginx or any other http server. WebRick comes out of the box. What it lacks in concurrency and speed, it gains in ease of use. When you start a new project, you want to start working on the stuff that matters as fast as possible. You don't want to be stuck in some configuration hell.

Even if you're a PHP developer and aren't too sure about this whole Ruby business, you can install Ecrire in a few minutes and play with your new blog on your machine.

If you like it like I do, you'll eventually want to run it in production on your custom domain and test it even more. The genuine feeling from people outside the Ruby community might be to think that even though running Ecrire on a development machine is easy, going into production is probably a complicated business.


I have no idea if the JS or PHP community has something like Heroku, but that is a godsent to anyone wishing to go into production with the least amount of work possible. There are two things required to go into production:

  1. A (free) account on Heroku;
  2. The Heroku toolbelt that includes Git, Foreman and a Heroku client


I could go step by step here and explain how to get started with Heroku but it wouldn't do justice to the extremely detailed section on Heroku. This will guide you step by step whether you are a Windows, Linux or OS X user.

In that guide, you will also see it shows some basic information on how to create your application. That section is maybe a little bit vague so I'm going to take it over and show you how to publish your application on Heroku.

Going live for the first time

For those of you that have never worked with Git and Heroku, it may be a little bit hard to understand what happens when you push and what is a remote branch. A remote is a location where you want to push your code. It can be Github, Heroku, Bitbucket, your own remote server, anything.

When you push code to a remote branch, what you do is you update the remote with the changes you have locally.

In a very, very limited way, this is what happens. So now, let me create a new blog and publish it for the first time to Heroku. First, I'll create a new theme, create a new application on Heroku and commit all our files locally.

$ ecrire new my.blog.com && cd my.blog.com $ heroku create $ git add . $ git commit -m "First commit. Publishing to Heroku"

The second line does a lot and it may help you understand if I explain what it does. First, it sends a request to Heroku (with your credentials) to tell it to create a new application for you. Once Heroku returned the application address in form of a Git URL, Heroku will initialize your current repository with Git and will create a new remote named heroku.

From that point, your application is ready to go live.

You can see for yourself if Heroku added its remote to your git repository by showing all remotes.

$ git remote -v heroku https://git.heroku.com/stark-fog-398.git (fetch) heroku https://git.heroku.com/stark-fog-398.git (push)

So now, what you want to do, is to take your theme, and upload it to Heroku via git push. This will automatically configure everything on Heroku and launch your application in a production mode.

$ git push heroku master

Master is the main branch. If you try to push a different branch to Heroku, it will ignore it and won't update your application on the server.

Once you push to Heroku, you will see it packaging your application, downloading gemfiles, compiling assets and then, at the end, you'll see a URL where your application is deployed.

Copy & paste that URL in your browser. Your blog is alive!

But you can't write post yet, you don't have any user in the production environment. And that's why Heroku is so great. It provides a shell command for you to access your application's console. This console is configured by Ruby On Rails and it let's you access your database in a Ruby manner.

This is how you are going to use create your first user on your blog.

$ heroku run ecrire console > user = User.new > user.email = 'your@email.com' > user.password = 'your_password' > user.save! > exit

When Ecrire saves your user, it will encrypt your password so it's protected even if your database is breached.

Now, you should be able to log in to your blog and start writing new posts. You see, it's not hard to get started with Ecrire, give it a try.

Start publishing with Ecrire

$ gem install ecrire
$ ecrire new your.blog.com && cd your.blog.com
$ bundle exec ecrire server
Get a more step-by-step guide