IB 2.0 — how we are scaling our company

Like probably many other companies, we’ve already hit 2 walls so far when scaling IntelligentBee: one at 8 people, one at 15 and we’re currently facing another wall hitting: the one at 30 people.

After struggling for more than half a year with this, we thought it’s time to do something about it.

We don’t pretend we know exactly what would be the outcome of this, but we sure know what we want to achieve: sustainable scaling. Or, if we must have a clearer objective, let’s say we want to hit 100 people. I know it doesn’t sound very much like a business objective, but it kinda makes sense as we’re a services company . Therefore our main output depends very much on people’s knowledge, expertise and skillset.

Initial data

We’re IntelligentBee, an online development services company, 6 years old. We do mainly web applications and recently we decided we want to tackle mobile apps.

I’m Costi, Founder and CEO. I have a technical background backed up by some business studies and experience. A geek turned on the dark side of management like some people like to call it :)

The quest: scaling

Statistically, our scaling was around 40% growth rate per year since we started. This might sound awesome  and it actually is: things were crazy all these years. We’ve gathered lots of achievements and learning under our belt . Looking ahead I can’t see how we’re going to scale this company further using the same approach, tools and structure.

So, the quest is mainly about : how we’re scaling our company. I’m sure there would be lots of bumps along the way and therefore lots of learning involved. I’m thinking about writing down all about it and create what’s called a growth log for IntelligentBee.

That being said, I do now know what my next posts would be about specifically, but they will sure be about one of the three main topics: something we’ve learned, something we screwed up or something we got right.

IB 2.0

We called all this process IB 2.0. IB stands for IntelligentBee. 2.0 stands for a completely new “version” of ourselves as a company as we understand that if you have a black-box and you don’t change the Input but in the same time you’re expecting (somehow) the Output to change, you’re either a fool (or a sorcerer). We’re neither (eh, maybe we actually don’t want to be the first… remains to see if we are or not) so we decided to change the Input. 

The Input

What do I mean by the Input ?

For us, the Input is how we’re doing things in our company. There are specific ways of doing things suitable for each growth stage you’re in. For us, the way we’re currently doing things starts to lose it’s effectiveness and certainly it’s not a recipe for success having our plans in mind. It’s simple: how we’re doing things now got us to roughly 30 people, if we’re continuing like that — we’re going to stay at 30. If we need to grow to 100, we need to “change gears” :)

So, stay tuned if you would like to see how we’re getting there, what we’re going to learn and what we’re going to break. We hope to get there in a couple of years, but hey — you never know! What we do know is 2 things: 1. we’re gonna get there and 2. it’s going to be quite a ride!


Node.js Guide: A List of Top Node.js Frameworks, Tools, and IDEs

Node.js Guide: A List of Top Node.js Frameworks, Tools, and IDEs

Created by Ryan Dahl in 2009, Node.js is an open-source platform built using the Google Chrome JavaScript runtime. It enables software and app developers to build fast and scalable web applications using just a few lines of code.

The official website of Node.js described it as:

“Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world.”

The world of custom software development constantly evolves with new trends, techniques, and languages. But, with the Node.js library of modules, app development is significantly simplified. It provides quick and efficient solutions for back-end development and it integrates well with front-end platforms.

Web and network server applications written using Node.js are becoming more and more prevalent. Independent app and software developers, web design agencies, IT companies, and businesses both small and large utilize Node.js for various projects and applications.

We’ve collated a comprehensive guide on the top frameworks, tools, and IDEs for Node.js to further streamline your workflow.

 

Frameworks for Node.js

Node.js frameworks are increasingly gaining prominence in web programming and application development. Their main objective is to get you up and running as fast as possible by providing functionality that is not available in Node.js out of the box. These features come in many flavors and most frameworks will try to envelop all you need to deliver your project.

Here are the latest framework innovations that expand the features and functionality of Node.js.

 

1. ActionHero

ActionHero is a Node.js API server and framework that offers custom packages for companies of all sizes with high-end customer support.

At it’s core it allows you to write a RESTful API that you can consume either via HTTP, WebSockets or plain TCP Socket connections. You can also do this by using a front-end ActionHero Client that’s based on Primus that the framework provides.

You can use it to easily provide a real-time information to your users and even allow them to talk to each other using chat rooms that are natively supported by this framework.

This framework also provides scalability out of the box, as such, it relies on Redis in order to communicate with other nodes in the network.

Top companies such as Riot Games, Samsung, Task Rabbit, and Madglory utilize the ActionHero framework.

ActionHero

 

2. Derby.js

Derby is a full stack MVC framework used for modern web applications. A differentiating feature of Derby is that it allows you to sync JSON and text data between browsers, servers and databases for real-time collaboration.

If you have a heavy front-end then, then this framework is for you, as it supports server side rendering.

Additional features include offline usage, conflict resolution and template bindings to simplify writing multi-user applications.

Derby JS

 

3. Express

Distributed under the MIT license, Express is one of the most fundamental Node.js frameworks. It offers a flexible structure for processing requests. It integrates well with several community developed modules that cater to most project requirements.

This minimalistic framework is very lightweight, as such, it’s focused on performance above all. It also allows you to easily scaffold a project using a generator so that you can jump right into writing code.

Its features include simplified multiple routing, template engines, middlewares, and more.

MySpace, Geekli.st, Klout, Segment.io, and Yummly all use Express.

Express JS

 

4. Hapi

Hapi is capable of building full websites and enterprise level functions. Walmart developers encountered extensibility and maintainability issues from the Express framework as their application grew in size. They needed another framework that can accommodate the  the Black Friday influx of customers. Thus, Walmark developers created Hapi.

However, developers commonly use this rich framework for building services that pull data from the back-end and serve it efficiently, all while keeping well maintained code base.

Features include input and response validation, server-side caching, sessions, cookie-parsing, logging and others. Hapi also developed dozens of API development plugins for documentation, authentication, and other functions. Big brands such as Macy’s and Disney use Hapi.

Hapi JS

 

5. Keystone

Keystone is another full stack, open-source framework based on Express, with a few other libraries. It can be used to create database-driven websites, applications, and APIs in Node.js. It’s stack includes the Express framework and MongoDB as a database.

It’s main selling point is that it provides an auto-generated Admin UI to manage your database driven website. With Keystone, you get the best features of Express and Mongoose combined, resulting in a robust CMS framework.

Keystone JS

 

6. Koa.js

Dubbed as the “next generation web framework for Node.js”, Koa.js followed in the footsteps of Express. It provides a lightweight Node.js framework for building efficient web APIs and applications.

Koa.js utilizes generated-based control flows to eliminate callbacks and minimize errors. Unlike most frameworks, Koa is more modular and relies less on middleware. However, plugin packages are also available for routing, compression, caching and more.

Koa JS

 

7. Meteor

Meteor is a full stack framework for web and mobile applications. It boasts of a subscription-based cloud deployment service called Galaxy, which enables developers to easily deploy their applications in the cloud.

Global companies using Meteor include Mazda, Ikea, Qualcomm, and PGA Tour.

Meteor JS

 

8. Sails

Sails is an MVC framework ideal for customized, data-driven web APIs for businesses and enterprises. It’s known for its capability to simplify processes for real-time chat applications, dashboards, and multiplayer games.

This framework comes bundled with an ORM that boasts support for any database. It also provides an easy way to generate RESTful APIs.

Sails JS

 

9. Total.js

Total.js is a full stack MVC framework written in pure JavaScript. It has everything other frameworks have and more. What sets it out from the crowd is it’s native support for processing media like images and video streaming.

It’s also compatible with client-side frameworks such as Angular.js, Polymer, Backbone.js, Bootstrap, jQuery, D3, as well as other frameworks mentioned above.

Total JS

 

10. Restify

Restify is a Node.js module designed to create APIs by the book, allowing you to create an application that strictly conforms to all the rules of developing a correct REST web service. It focuses on debugging and profiling so that you can isolate systems and optimize your server performance.

Restify JS

 

Tools for Node.js

Node.js tools are used by web developers and software programmers for a wide variety of applications and workflows. These tools make it easier for developers working with Node.js.

Whether you’re an amateur or an expert developer, these Node.js tools will be useful for you.

 

1. Babel

Babel is a JavaScript transpiler commonly used as a tool for front-end development. It allows you to use all ES6 features while compiling ES5 for production. As a result, code readability is improved.

Babel supports the latest version of JavaScript so that you can use the newest syntax without waiting for browser support. It can also be integrated with other JavaScript tools.

Babel JS

 

2. Broccoli

Broccoli is a Node.js build tool running on an ES6 module that boasts of blazing rebuild and compile speeds, chainable plugins, and a flexible ecosystem. Broccoli dubbed itself as “the asset pipeline for ambitious applications.”

Broccoli JS

 

3. Electrode.io

Electrode.io is another tool built by developers of WalmartLab. It’s a universal platform for building both React.js and Node.js applications using the most standardized structures, advanced technology, and best practices.

With Electrode.io, greater focus is placed on consistency and universality instead of configuration and customization. This ensures reusability and performance.

Electrode JS

 

4. Log.io

It can be difficult to monitor hundreds of files spread across various computers. Log.io is a real-time log monitoring tool to help you monitor your deployments and troubleshoot quickly. It exposes a stateless TCP API where you can write your logs to. You monitor your log messages in a single browser session, so you can address issues and bugs immediately.

Log JS

 

 

5. Migrat

Migrat is a simple, yet pluggable, data migration tool that uses plain text. Designed for a variety of stacks and processes, Migrat runs migrations once globally or per server.

Migrat is not tied to any database engine, and can be found on GitHub and NPM.

Migrat JS

 

6. PM2

As an advanced production process manager for Node.js, PM2 monitors all launched processes to determine whether they’re running properly.

According to Full Stack Developer, Mariusz Dybciak, “You don’t need to worry about restarting applications after they’ve crashed, PM2 does it for you.” The finance software company, Intuit, and the online payment gateway, PayPal, use PM2.

PM2 JS

 

7. Webpack

JavaScript module bundling has been around for several years now, and helps developers and programmers save countless hours of manual labor.

Webpack is a JavaScript module bundler that simplifies deployments by creating bundles, and asynchronously loaded to reduce the loading time. With Webpack, bundling and serving assets are easy, quick, and painless.

Webpack JS

 

Integrated Development Environment (IDEs) for Node.js

An Integrated Development Environment (IDE) is a collection of tools used for a myriad of Node.js web applications. Most IDEs are used as a source code editor, automation tool builder, and a debugger. It lets web and app developers edit and debug their codes accurately and quickly.

We’ve picked out 15 modern and advanced IDEs for Node.js.

 

1. Aptana Studio

If you like Eclipse, then you should check out Aptana Studio. It’s an Eclipse-based IDE that was trimmed down to focus on web application technologies and popular frameworks.

With Aptana Studio, you can develop and test applications in a single environment, as it supports the latest browser languages such as HTML5, CSS3, JavaScript, Ruby, Rails, PHP, and Python.

Aptana Studio

 

2. Atom

Atom is a modern, open-source text editor built with HTML, JavaScript, CSS, and Node.js integration. Its features include cross-platform editing on OS X, Windows, or Linux, a built-in package manager where you can search, install, and create new packages, and smart autocompletion to help you write codes faster.

The best thing about Atom is that it’s fully hackable and customizable. Even the core packages can be changed.

Atom

 

3. Brackets

Created by Adobe Systems, Brackets is a lightweight but powerful text editor with advanced features that include inline editing, live code previewing, preprocessor support, code folding, and command line integration.

It utilizes visual tools and preprocessor support that make it easy for both front-end developers and web designers to work from the browser.

Brackets

 

4. Cloud 9

With Cloud 9, web and API development becomes much easier. It combines a powerful online editor with a full Ubuntu workspace in the Cloud so you can write, run, and debug your code.

Its key features include a built-in terminal, language and code completion tools, debugger, split view, and more. These functionalities can also be extended using a quite simple extension manager.

Name brands such as Soundcloud, Atlassian, Heroku, Mailchimp, and Mozilla work with Cloud 9.

Cloud 9

 

5. Codenvy

Codenvy also provides cloud workspaces for web designers and app developers to write, run, and debug on premise or in the cloud.

Developers can easily collaborate on a single project by using a shared URL. The team can work with their local IDE or the beautifully designed Eclipse Che cloud IDE.

Codenvy

 

6. CodeLite

An open-source IDE that fully supports Node.js, CodeLite specializes in programming languages such as C, C++, PHP, and JavaScript. Some features include Node.js debugger, intelligent code completion, lightweight memory footprint, and compilers.

CodeLite

 

7. Eclipse

Known for its Java Integrated Development Environment (IDE), Eclipse is one of the most popular cloud-based IDEs for web developers. It’s capable of combining language support and other features into any default package. Because it has a very active community, you can find open source plugins and developer tools in the Eclipse Marketplace.

Eclipse is highly-customizable and extendable, with features such as built-in debugger, error checking, source code generation, code refactoring, help window as toy type, and more.

Eclipse

 

8. Intellij IDEA

Maximize your productivity with Intellij IDEA by Jetbrains, a robust IDE compatible with various technologies such as Node.js, Angular.js, JavaScript, HTML5, and more. Intellij IDEA offers intelligent code completion, code analysis, and refactoring tools.

Another advantage of Intellij IDEA is its productivity-boosting features for Java EE, Spring, GWT, Grails, Play, and other frameworks.

IntelliJ IDEA

 

9. Koding

Koding is yet another open-source, cloud-based IDE that offers a smart interface that enables dev teams and managers to streamline their workflows. What’s great about it is its data analytics features for CTOs to locate bottlenecks and loopholes in the process to optimize efficiency and productivity.

Other features of Koding include syntax highlighting, keyboard shortcuts, collapsible panes, cloud workspace, auto indenting, code folding, and code preview using a built-in browser. Koding is ideal for large teams of hundreds or thousands of developers.

Koding

 

10. Komodo IDE

Komodo IDE is a cross-platform, polyglot IDE that provides a complete set of tools, integrations, and frameworks for a hassle-free web and application development. It supports over 100 programming languages such as Python, PHP, Go, Perl, Tcl, Ruby, NodeJS, HTML, CSS, JavaScript, and more.

Additional features of Komodo IDE include syntax and highlighting, code intelligence, debugging, markdown viewer, and DOM viewer. Komodo also offers multi-cursor support so that you can edit at the same time.

Komodo IDE

 

11. NetBeans

NetBeans is a free, modern IDE that supports multi-language programming for desktop, web, and mobile applications. Because it’s an open-source IDE, NetBeans allows developers to work on both the web and the desktop by building their own plugin to meet specific needs and functions.

NetBeans IDE

 

12. Sublime Text

As an innovative text editor for code, markup, and prose, Sublime Text provides a state-of-the-art user interface that allows developers to easily jump to characters, symbols, lines, or words using keyboard shortcuts.

You can also use other advanced features such as split editing, project switching, and multiple selection to rename variables and manipulate your files quickly.

Sublime Text

 

13. WebMatrix

Created by Microsoft, WebMatrix is a simple and lightweight IDE for Windows. It is ideally used for ASP.NET WebPages development and even PHP, HTML, and CSS. WebMatrix includes features such as code completion and built-in templates.

In October 28, 2016, Microsoft announced the discontinuation of formal support for WebMatrix starting November 1, 2017. Community support will continue in its forums.

WebMatrix

 

14. WebStorm IDE

Jetbrains popularized another powerful IDE for modern JavaScript development. WebStorm IDE offers intelligent code completion, rapid error detection, navigation and refactoring for JavaScript, TypeScript, stylesheet languages, and other popular frameworks. The newest version of WebStorm can be integrated with Jest, and supports Vue.js and standard JS.

Developer teams of popular brands such as Yahoo!, Reuters, Soundcloud, Intuit, Wix, Expedia, and BMW use this robust IDE.

WebStorm IDE

 

15. Visual Studio Code

Microsoft created Visual Studio Code to replace WebMatrix. Visual Studio Code is a free, open-source editor that runs on OS X, Windows, and Linux that supports operations such as debugging, embedded Git control, task running, and version control.

Other features include syntax and highlighting, IntelliSense code completion, and code refactoring. It supports more than 30 programming languages.

Additional tools and extensions are also provided for Node.js, TypeScript, JavaScript, ASP.NET 5, and more.

Visual Studio Code

 

Final Words

Node.js is becoming increasingly popular for web and app developers worldwide. Frameworks, tools, and IDEs are useful for both beginners and professional users alike. It makes writing and testing codes a lot easier and faster


blog_image

How to set up a Node.js development environment

Context:

Here at IntelligentBee we wanted to establish a few ground rules that all of our developers should follow when developing an app in Node.js. In that way all of us would be familiar with a particular set of tools, something that would make us deliver better software, fast. Here is how we set up a Node.js development environment for a particular project:

  • Installing NPM and Node.js
    To get things started you need to install npm, and Node.js. You can easily do that by downloading them from here.

 

  • Create a project folder, and navigate to it using your favorite terminal. Then create a package.json file in that folder, a file that will save all the libraries you use. Using the terminal, run the command $ npm init . Write a few details about your project, and that’s it.

 

  • The web framework
    This should be project based, but we recommend Express.js as it the most mature and widely used framework for Node.js. From the Terminal, navigate to the folder where you will build your project, and run $ npm install express --save

 

  • The testing framework
    To deliver robust code, you need to write tests. Node.js has a lot of testing frameworks available, but Mocha.js is by far the most used and proven test framework out there. To install, run $ npm install --save-dev mocha .Here we also need to mention the assertion library that can make life even easier. We recommend Chai.js, as it exposes all interfaces of asset, should and expect. Just run $ npm install --save-dev chai  in your terminal to install.

 

  • The IDE
    We’ve chosen Visual Studio Code over the more widely preferred Sublime Text, as it has a native support for Node.js debugging. Also, it is pretty easy for newer, less experienced developers to adopt it. You can get this free piece of software from here.

 

  • The linter
    We decided to go with ESLint, as it is the most popular linter for Javascript and has a plugin for linting Node.js code. It is recommended that you install ESLint in the project folder that you work in, but you could also install it globally. To install it for your project, run $ npm install eslint --save-dev  in your terminal. To make it aware of Node.js and Mocha you need to install these Eslint plugins as well:
    - Eslint-node: $ npm install --save-dev eslint-plugin-node
    - Eslint-mocha: $ npm install --save-dev eslint-plugin-mocha

 

  • The coding standards:
    The Airbnb coding standard is one of the most popular out there, for JavaScript and Node.js. That would help you write clean code, that will be easier to understand later on, or by other people. In your terminal, run $ ./node_modules/.bin/eslint --init  and choose Airbnb as your coding standard. After you do that, you need to open the newly .eslintrc.json  file that was created, and add "mocha" and "node" in the file. Basically that file needs to look like this, if you saved the file using JSON format:
{
	"extends": "airbnb-base",
	"plugins": {
		"import",
		"mocha",
		"node"
	}
}
  • Install the ESLint plugin in VS Code
    Go into the VS Code app, and navigate to its Extensions page. Search after "eslint", and install the first result from the list. Restart VS Code.

Now you should be all set up and start coding. Enjoy!


How is your Monday?

We all know the Monday jokes. And I bet we all complained at least once about the fact that the weekend is over and a new work week is about to start.  Well, I’ll admit, it happened to me more than once. And every time I asked myself what is it that I don’t really like. Is it the fact I have to get up early? Is it the fact I don’t like working? I don’t think I ever felt sorry that Monday comes during vacation time. Or could that mean that I don’t like my job, the company and the team I work with?

The Monday Blues

Maybe you heard about the ‘Monday Blues’ defined by Alexander Kjerulf, an expert on happiness at work:

“the negative emotions that many people get at the beginning of the workweek if they're not happy at work”

I gave this definition a thought.

I started by making a list with what’s important for me in order to be happy at work. It looks like this:

  • Having ownership, ‘my job is mine’. Researches talk now about a new kind of ownership, the psychological ownership. This makes an employee feel that the company he works for is his/hers.
  • Having autonomy, being able to take decisions.
  • Being able to express ideas, concerns, opinions that contradict what others say.
  • Mistakes should be permitted; and haven’t I done like a million of them. Making mistakes is a sign that you had the courage to try something. They are a way of learning and experiencing new things.
  • Flexibility regarding my working schedule and the way I organize my tasks, activity.
  • The team I’m part of. I need to say that my colleagues offered me so much support, professionally and personally. I have all the reasons to be grateful and happy to work and spend time with them.

Do I have all these above at my current job? I’m lucky enough to respond with a firm yes, I do. Then what could be the problem when I’m not happy to hear the alarm clock especially in the first morning after Sunday? I’m still looking for this answer :).

My Mondays are great

Until I find it, I’ll keep in mind what someone told me once: 

“Monday is the perfect day to correct the last week’s mistakes”

This is a great perspective and opportunity to bring a smile on our faces when we feel a little bit down on a Monday morning or on any other working day.

Happy Monday everybody!


How to Save a File in Vim After Forgetting to Use Sudo

Many of you probably experienced this. You edit a file in Linux with Vim or Nano or whatever else text editor you might be using and when you try to save, you realise you forgot to launch the editor with sudo privileges, and file can't be written. Exiting without saving and editing again with sudo privileges is not always an option, especially if you lose a lot of work.

Solutions

There are some workarounds. You can open a new terminal and grant the right permissions on the file with:

sudo chmod 666 <filename>

Now you can go back to your editor and saving will be possible. Don't forget to change back the right permissions for your file.

Also, you could save in a new file and then copy the newly created file over the old one.

But these are workarounds. Vim editor actually offers a solution.

In normal(command line) mode of Vim you can issue:

:w !sudo tee %

And that works like magic. For the geeks, here is how the "magic" works:

  • :w - writes the contents of the buffer
  • !sudo - pipes it to the stdin of sudo
  • tee % - sudo executes tee that writes to "%" file
  • % - Vim expands "%" to current file name

So Vim actually makes magic happen.


Let me bring you into my world

You’d wonder what can keep somebody working in an office, at a desk, and talk with different people from all over the world every day, some of them angry and anxious, others frustrated or just annoyed because of the color of a button.

The answer is that it’s just amazing how wonderful the feeling can be of assisting someone and managing to resolve different issues - some of them simple, some complicated that can involve numerous tests, or sometimes backend assistance; sometimes it’s just about asking the right questions, other times complex troubleshooting might be required.

As a help desk analyst job, you’ll have to connect with customers, understand their experience with your application, and assist them in knowing the product inside-out, but most importantly offer them the assurance that the product they’re using will bring them to success in their own business.

It takes a certain mix of skills, personal characteristics and values to really make it in a support career. Providing outsourcing support services for international companies allowed me to connect with people from all over the world and from different cultures, people with different restrictions and needs depending on their country or region. What I can tell you is that I do remember every conversation with these people, no matter the nation or language barriers. I spoke with amazing people that were looking for “better”, for quality, for improvement and I verily appreciate and respect each and every one of them.

Besides the customers that you’re working with every day through different communication channels, there is the team you’re part of.

My background is in IT and Education Sciences. I’ve combined my knowledge from these two areas and it seems that they go well together, as they’ve helped me over the last 4 years since I started my career as a technical support analyst.

Somehow, I have passion for the role I took, but the most importantly I find joy in my day-to-day tasks and this is also because I work with wonderful folks and I am here referring to my colleagues.

I started with Intelligent Bee almost a year ago, I still remember the first day when I came in for the interview - being a shy person, sometimes I feel uncomfortable in new situations or with strangers, but the people I’ve met here gave me confidence and comfort. They make me feel as part of the team and have done so even when I was still in the interview process. My ideas and needs were listened to and still are - no matter if it is the CEO or my manager, the HR, the colleagues from dev or support, I’ve always been encouraged to stand up for my ideas and have been helped to achieve my goals.

Well, all of these things bring me to work every day. And you should see our office, it makes you feel like you’re right at home.


Emulate a Redis Failover with Docker

Reading the Redis documentation can be a bit confusing without the hands-on experience. You could in theory create multiple processes of the Redis Server on your machine and configure each of them in part, but what if you could do it in a few commands? Not only that but emulate the network they’re connected to as well.

I’ve been looking into this and there’s a few examples out there on Web, the best one I could find was this one: https://github.com/AliyunContainerService/redis-cluster

So, starting from that example, I’ve tried to do the next best thing, which is to create a single docker-compose.yml file for all of it. Removing the need to build each image, just to do a docker-compose up and scale as needed.

Here’s what I got:

master:
  image: redis
slave:
  image: redis
  command: redis-server --slaveof master 6379
  links:
    - master
sentinel:
  image: redis
  command: >
    bash -c "echo 'port 26379' > sentinel.conf &&
    echo 'dir /tmp' >> sentinel.conf &&
    echo 'sentinel monitor master master 6379 2' >> sentinel.conf &&
    echo 'sentinel down-after-milliseconds master 5000' >> sentinel.conf &&
    echo 'sentinel parallel-syncs master 1' >> sentinel.conf &&
    echo 'sentinel failover-timeout master 5000' >> sentinel.conf &&
    cat sentinel.conf &&
    redis-server sentinel.conf --sentinel"
  links:
    - master
    - slave

Basically, after saving this into a docker-compose.yml file and running docker-compose up in that folder you’ll get this:

You can now scale as needed. For example, by running:

docker-compose scale slave=2 sentinel=3

You’ll end up with:

To initiale a failover, you’ll need to take the master out of the picture, you can do that with:

docker-compose pause master

You can now observe the communication between the sentinels and slaves. After the down-after-milliseconds and failover timeout passes, one of the slaves will be selected for promotion.

After the sentinels agree on the selection, the slave will become the new master.

You can now unpause the old master by doing this:

docker-compose unpause master

The old master will now become a slave of the new master and perform a sync.

That’s about it. As an exercise you could try setting up a cluster starting from this and observe failovers there.


should your online business use API?

Why Should Your Online Business Offer API

There are several ways to extend a business model but API is a hot topic right now as the online world is expanding very fast. If you’re a developer or at least interacted with APIs before, you probably know why public APIs are so important, but there’s a big chance you didn’t hear or care about them before and now you’re wondering why everyone talks about them.

What is an API

In computer programming, an application programming interface (API) is a set of subroutine definitions, protocols, and tools for building application software. In general terms, it's a set of clearly defined methods of communication between various software components. (Wikipedia)

There is a simple way of saying this: an API is like a contract between two computer software agreeing to share information in a more or less standardised way.

Now it’s pretty clear what are we talking about, but why are them so important? How can APIs help us? In the following rows I will try to argument some good reasons.

Getting Started with Building APIs in Symfony2

Grow your business

You can grow your online business by integrating with additional tools or apps and engaging with others. This can be done using public APIs.

Let’s take Uber and Google Maps: everytime you search directions in Google Maps (from home to work, i.e.) you can automatically request an Uber, see your driver on the map or even contact him, all without having to leave Maps app thanks to Uber’s API.

Or if you have an online store, you might wanna offer public APIs so other apps can request price offers and display your products on their platforms.

Get ready for scaling

It’s all sweet and fun to start a new business and you probably want to do it faster and cost effective. Usually this means a monolithic application.

Success means scaling and this can be done by breaking the app into microservices. This will enable multiple options for you.

Let’s say you have a microservice that is being used very often and affects your server. That microservice can be moved on a new server with dedicated resources only for it and it will be accessible for the rest of the app via an API.

Or there is the case when you want to rewrite a single microservice (some languages are more efficient than others). This is the beauty of standardised API - you only have to make sure you accept the same API call as before and return the answer in the same format, so other dependent services won’t be affected.

Time saving

UX/UI is very important and we strongly advise you to continue to invest in that area, but there are cases when having to explore an UI for some actions is time consuming for some (more technical) users.

Let’s take SendGrid and their Marketing Campaigns app. You can create a new campaign by going through the UI process or you can simply make a call to their API. Second option is usually faster (but for more technical people or at least you need to develop an integration first) and the flow will always be the same, while UI can suffer some modifications over the time.

Mobile app

At some point you will probably want to add a dedicated mobile app to your business. Having APIs makes it possible. You are free to develop a new design or a new template without any changes on the API side.

Providing APIs must be a concern for every company, whether they focus on internal operations, partner integrations or public access. Join the revolution! Add API support to your product! Get a free quote now.


Better is possible and real

We all wish, hope and want for good things to happen as often as possible in our life. Even from the beginning, we are all trying to be good kids, then, as teenagers to get good grades, as young people to graduate a good college, as adults to have a good job, to build a good family and live a good life. Good is enough, is normal...is perfect. But let me ask you something: isn’t it interesting the fact that we are so used with the presence of good things in our life and we take them for granted because they are ordinary, but when something extraordinary, unexpected happens, we are so amazed and exalted and overwhelmed and we start wondering: how is this possible? How can be something good, better? What is this better thing that just happened? Why didn’t this happen before? When will it happen again? And so on. We have definitely heard that better is real and we have seen it in others life, but we have never experienced it in our lives.

Well, this is where I stand up and say: BETTER is real! Something extraordinary, unexpected, something better really happened to me and I want to share my experience with you.

I’ve always dreamed about a good job. I’ve tried to study as much as I could to gain all the necessary information I needed to be sure that I will get the job. It wasn’t easy… but time flew fast and I have graduated the college. Frankly being, due to educational system and society, I wasn’t 100% sure that I will get the job I’ve dreamed about. Anyway, I hoped and I have started looking for the desired job. The reality was cruel, but, in the end, the job offer was signed. Yeeeeey! I felt so good! I have a good job! Now I am satisfied! Once I got the job, I did my best to be a good employee and to fit in this new and nice environment. But after a while, I have realized that this job was just a good job and nothing more. The company I’ve worked for and the teammates I’ve been working with were good, the view from my desk’s window was good, everything was just good. I’ve started feeling that good was no longer enough. Therefore, when the window of opportunity was opened, I quickly flew like a shy but courageous bee outside of the good zone. Once I've escaped from the good zone, I’ve heard rumors about the land of the better.

Have you ever felt the need of better? Have you ever realised that good is no longer good enough and you want something better, you need something better even if it is sometimes impossible to get it? Well, I felt the same. Also, let me tell you that the impossible is achievable. How? With support from people who are ready to believe in you and help you to grow professionally and gain priceless experience within their team. This is how it happened to me. I have found a better job and a better company for me, for my needs (yes, I’m aware of the fact that good and better are subjective beliefs, we have different perceptions about what they mean).  I have met here the most amazing team I’ve ever had the chance to work with (if you don’t believe me, just come and find out for yourself). From the CEO to the newest colleague, everyone is BETTER. I am telling you, they've welcomed me with such love and kindness. A better job is defined, among other things, by a better team you work with.

And did I tell you about the view from my desk’s window? You and I will probably never find a better view than the one I enjoy everyday. From an unbeliever in better, I am now a strong believer and I will remain the same. Why? Because I have now a better job and I work with better people for a better company. I thought it is impossible, but now I have it and I love it and I know, feel and believe that it will last a very long time from now on.

I’m now part of a “beehive" filled with highly intelligent, strong, hardworking, funny and talented “bees” which are ready to provide the best “honey” in order to uniquely identify the company from the rest of the world through the highest quality of friendship, projects and delivered products.

Better is possible and real!


Setup Docker Machine for Symfony Development

If you need a development environment for Symfony, hosted by Docker, you can use the fazy/apache-symfony docker image to start with, then extend it to your need.

In your Symfony project's folder add the Dockerfile and docker-compose.yml files.

In the first one, we added mysql and composer, then we used the docker-compose.yml file to mount a local volume to the docker container with file sync.

This way you can code on your machine and test in the docker environment.

The Dockerfile:

FROM fazy/apache-symfony
ADD . /app

RUN    apt-get update \
    && apt-get -yq install \
        mysql-server \
        php5-mysql \
    && rm -rf /var/lib/apt/lists/*

RUN curl -s https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer
ENV COMPOSER_ALLOW_SUPERUSER 1
RUN service mysql start

The docker-compose.yml file:

version: "2"
services:
    site:
        build: .
        ports:
            - "8080:80"
        expose:
            - "80"
        volumes:
          - .:/app

To build the Docker container use:

docker-compose up --build

To start it when it's down just remove the --build parameter:

docker-compose up

Once is running, you can view it's ID by running:

docker ps

Now grab the first 3 characters from the id and use them in the next command to be able to log in the running container:

docker exec -t -i ID bash

Finally, to access the Symfony project in your browser, go to http://localhost:8080/app_dev.php and have fun!