Alexander Beletsky's development blog

My profession is engineering

Run Several Processes in Docker Container

What I like the most about Docker project is new opportunity to deploy and distribute software. Many times I’ve been to situation when I wanted to play with some software and get exited about, but after I read installation manual my excitement totally gone. Non trivial applications, requires quite a lot dependencies: runtimes, libraries, databases.

With docker, the installation instruction got reduced to something like:

$ docker pull vendor/package
$ docker run vendor/package

Simply like that, forget about missing Java Runtime on your server. It suits perfectly for TCP/HTTP applications.

Likeastore is Becoming a Company

It’s been a while since my last update on Likeastore progress. It doesn’t mean the application development is stopped, otherwise – we did a final breakthrough and today is my first day in EastLabs business accelerator. Yes, side project we’ve started to have fun on hackathon is becoming a company today.

I always wanted to build a product that could became the foundation for company. I did a few unsuccessful attempts before. There was few reason of failures: either I tried to attack very big problem or I didn’t have enough motivation to make the stuff done.

I Quit My Job

Since 6 Dec 2013, I’m officially unemployed. I quit my job in E-conomic there I spent almost 3.5 years of happy life. Leaving the company was a really tough decision, but it had to be made.

A lot of things happed during that time. No doubts, E-conomic and Ciklum did the most significant impact of my professional career so far. The reason for that is simple: the people surrounds you are most important aspect in your job. From the very first days, till last ones – I worked with high qualified professionals there.

Seismo - Analytics For Your Startup

Sometimes ago I wrote the post, where was thinking about importance of logging of application state to clearly see what’s going on inside and react accordingly. Logging is vital for any reliable system.

If logging is a must from development point of view, analytics is a must from business point of view. You would like to see, how many users signs-in and signs-up during the day, what actions they do inside the app, what issues they use all the time, what issues they never touch.

Following “Invent Own Bicycle” principle, I’ve created small project to attack the problem – Seismo.

Simple Authentication for Angular.js App

So, you are building pure client side application that works against REST API. The client and server are completely decoupled and typically deployed separately of each other.

API’s have one or another way of authenticating it’s users. It could be some simple flows, like basic authorization or more complex ones as OAuth/OAuth2. But at the very end you have token that placed either as cookie value or HTTP request header parameter. API is then responsible to check the token for validity and if it’s not valid respond with 401.

Using Angular.js with Require.js

I got used to idea of AMD quite long time ago. That time Require.js was best (and probably only one) good implementation that supports it. It worked great for me while I was involved into Backbone.js development. So, once I jumped in to Angular.js my first wish was reuse the same experience as previously.

There was a few difficulties with that.

Catch Errors in Express.js Application

This is a small follow up for my previous post, using the same technique not for authorization, but rather for error handling.

Let’s go back, to the problem. I want to handle all errors in my application. Instead of res.send() or res.json(), I want to have a middleware that handles everything by itself. It can be flexible, so I can put any kind of logic there, like logging etc.

It’s very easy to archive with patch the middleware method.

Securing Express.js HTTP Endpoints

Once you implement HTTP API using Express.js, the security became the concern. There are a lot of different options and strategies, implementing security for API’s. One of the latest I prefer is described here.

Doesn’t matter what the actual strategy is, you have to apply it somehow in your application. In general, HTTP API security goes down to authorization. Having a piece of information in HTTP request (either field in header or value in cookie), by checking one you can say, is this HTTP request authorized or not.

Playing with Dokku on Vagrant

As I said previously, it’s very easy to turn Linux machine into Heroku-like server. But, before setting up paying account on Amazon or Digital Ocean, it’s nice to just play it locally. Will do that, running a Dokku on virtual machine. Will setup development environment and do first local deployment, just to see some real features.

It does not require complex environment to run Dokku locally. All you need is git and Vagrant.