OSGi and micro-services

Old but not retired

What if grandpa OSGI had not not said its last word but could bring its experience to new paradigms such as micro-services ?

In the past few years, we have seen more and more web apps containing an embedded server which is more flexible than an application server or a servlet container. This trend has been promoted by Node.js. replacing the old heavy infrastructure.

Nevertheless, the old heavy infrastructure might not be over yet. Embedded web servers are an easier way to distributed and deploy an app. But when it comes to maintaining and updating a project in production this is a completely new story. How can you update a service in production without interruption ? How can you distribute the system when it is time to scale ?

This is where OSGi combined with small and flexible services can nail it. Developing a nice piece of software with a beautiful interface is one thing. Deploying and maintaining it is the great challenge today.

Deployment, the real challenge

Docker and the concept of container farms are still today a great answer to deployment and scaling. PHP and Node.js would have been buried a long time ago. However, managing a farm is not always that easy. You need a solution that lets you manage bare metal or virtual machines as well as their containers. With OSGi you can remove one layer in the infrastructure by installing the environment directly on the bare metal, without containers.

More flexibility to software architecture

Not so long ago, the classic software architecture was to separate at least the persistence layer, the business layer and the presentation layer. Even if this multi tier architecture is not deprecated, micro-services have challenged its sovereignty. Today the trend is to create a small service or component that is self-sufficient by containing all the layers.

This provide quite a few advantages, it is not necessary to recompile and redeploy an entire layer. More over, it simplifies the work of a team. The need for the developers to merge all the branches of on layer is reduced. A developer can be responsible for one service or a small group for a few services. They still need to talk to each other to expose the services and the data model but the risk to step on each other’s feet is easier to handle.

As soon as a service is ready for production it can be deployed in your favourite OSGi implementation. If an incident happens as you push you new code in production, you know right away who the culprit is. OSGi will give you the flexibility to put your finger only on what to be taken care of.

Illustration of System administration

The guide to becoming a system administrator

This guide will show the basics to becoming a system administrator, you will discover the key fields and some of the techniques.

But first, we need to know what a system administrator is. This is the person who is in charge of the infrastructure, hardware and software of the information technology department in an organisation. The administrator will make sure that everything is well configured and works as expected. Sometimes, thousands of people are dependant of the work of the system administration. In that case, it would be handled by many experts.

The challenges

The first challenge is to provide enough resources to every project, without spending too much. The administrator needs to be flexible enough to allocate the right resources at the right moment to the right users.

Another task is to make sure that the system is working as often as possible. The administrator will monitor the system with specialized tools that will send an alert in case something does not respond as expected.

A system cannot stay as it is, it has to evolve for security reason or because the users want new features. The person in charge has to constantly update the software and add or replace the physical components. All of this has to be done without preventing the access to the system. A bug or a bad manipulation can freeze the servers completely. This could cost a lot of money or even a permanent loss of data.

Read more
PrestaShop on Debian 9 with nginx and Let’s Encrypt

PrestaShop on Debian 9 with nginx and Let’s Encrypt

PrestaShop is one of the most famous online shop platform. It is quick and simple to set up an online shop that looks nice and works.

But first, we want to install it manually, the old fashion way 🙂

Little update to access the latest versions of our favourites libraries. And if you need or feel confident, you can upgrade as well to install these latest versions.

apt-get update
apt-get upgrade

This is the list of software that we need :

apt install -y unzip nginx php7.0-fpm php7.0-cli php7.0-gd php7.0-mcrypt php7.0-mysql php-fpm php-common php7.0-mbstring php7.0-xmlrpc php7.0-soap php7.0-xml php7.0-intl php7.0-cli php7.0-ldap php7.0-zip php7.0-curl mysql-server mysql-client

Let’s enable them in case they are not. This will start them if for some reason the server is rebooted.

systemctl enable mariadb
systemctl enable nginx

Configuration of MariaDB

Just answer yes to those questions to have a secure installation of MariaDB.

mysql_secure_installation

Now we can create the database, the user and grant him the rights.

mysql -u root -pPASSWORD
CREATE DATABASE presta CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'presta'@'localhost' identified by 'myGreatAndSecurePassword';
GRANT ALL PRIVILEGES ON presta.* TO 'presta'@'localhost';
Read more
Invoice ninja on Debian 9 with nginx and Let’s Encrypt

Invoice ninja on Debian 9 with nginx and Let’s Encrypt

apt-get update
apt-get upgrade
apt-get -y certbot install unzip nginx mysql-server php7.0-fpm php7.0-cli php7.0-common php7.0-curl php7.0-gd php7.0-mysql php7.0-xml php7.0-mcrypt php7.0-mbstring
systemctl enable mariadb
systemctl enable nginx

Configuration of MariaDB

mysql_secure_installation
mysql -u root -pPASSWORD
CREATE DATABASE invoice_ninja CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'ninja_user1'@'localhost' identified by 'myGreatAndSecurePassword';
GRANT ALL PRIVILEGES ON invoice_ninja.* TO 'ninja_user1'@'localhost';
Read more
Install WordPress on Debian9 with nginx and Let’s Encrypt

Install WordPress on Debian9 with nginx and Let’s Encrypt

This step by step guide will show you how to install your own WordPress manually on Debian 9 (Stretch) with nginx and Let’s Encrypt. It assumes that you have your own virtual private server (VPS) or virtual machine with Debian9 installed on it and you can access it through SSH.

If you don’t have a VPS, get a one here.

Install the packages

First, we need to install the required packages. To do so, type the following commands :

apt-get update
apt-get upgrade
apt-get --assume-yes install nginx mariadb-server php7.0-cli php7.0-fpm php7.0-mysql php7.0-gd php7.0-xml php7.0-intl php7.0-curl php7.0-zip php7.0-mbstring 
systemctl enable mariadb
systemctl enable nginx

Get WordPress

Get the last version of WordPress available on their website :

wget https://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
mv wordpress /var/www/wp1

Create user

It’s a good practice to create a user dedicated to WordPress for security reason.

adduser --system --no-create-home --disabled-login --group userwp1
chown -R userwp1:www-data /var/www/wp1
chmod -R o-rwx /var/www/wp1
Read more