blog@nexoPrima

things in mind and a bunch of tech rants

1GovMail: “Satu Pandangan” suatu ketika dahulu. — August 7, 2016

1GovMail: “Satu Pandangan” suatu ketika dahulu.

Article ini ditulis dibulan Merdeka, beberapa tahun yang lampau kerana kekecewaan bersama semangat nasionalisma yang tinggi. Dan pada hari ni, di bulan keramat yang sama, telah sampai ke telinga ini, akan berlaku lagi sekali rombakan dan penghijrahan kali kedua?

Jiwa ini risau, dengan penuh harapan, supaya migrasi yang kali ini, jika benar, lebih tersusun atur langkahnya.

Ditahun 2016, 4 tahun sebelum paradigma yang ditunggu tunggu 2020, adakah kita masih memikirkan solusi emel lagi?

“Merdekakan lah teknologi supaya kita yang menguasai daripada dikuasai.”

 

229825425-Sumber-Terbuka-Satu-Pandangan

Scheduling task with systemd — April 13, 2016

Scheduling task with systemd

Love it or hate it, systemd is here to stay.  It seems more and more Linux distributions are putting systemd as their default init system. Although initially systemd was meant to replace the existing init system, but systemd dev decided to add features beyond a typical init system. One of it is task/job scheduler which traditionally handled from cron system.

While working on the online quiz system, I came to a need to run a script every 10 minutes. Of course I can easily add an entry to the cron but I thought this might be a good opportunity to try scheduling this task with systemd. So here’s how you can use systemd instead of cron system to run a job.

First, I created a service file (a file with .service extension). This is actually to define the script that I want to run. In my example the “Type” under [Service] directive is set to “simple” since the script I wanted to run was simply a shell script. The “ExecStart” option specifies the command to be executed. For other options, you may refer to the official documentation.

[Unit]
Description=Add the description of your service here

[Service]
Type=simple
ExecStart=/path/to/my/script

There is nothing special with the service file. It looks like a typical service file, only much simpler.

In systemd, there is a scheduling facility called timer. So next, I created a timer file (a file with .timer extension) with the following entries:

[Unit]
Description=Description for my timer directive

[Timer]
# Runs every 10 minutes
OnCalendar=*-*-* *:00,10,20,30,40,50:00
# Run even we site the time set
Persistent=true
Unit=<the service file I created above>

[Install]
WantedBy=multi-user.target

The “OnCalendar” option does look similar to cron but systemd support various other formats. The “Persistent” option means systemd will keep track when was the last time the event triggered and is useful in case the timer misses any run and systemd will ensure that my script will be executed at least once during the time the timer is inactive (for example during downtime). For other timer options you may refer to the documentation.

After having those 2 files, I just copied to /etc/systemd/system and execute the systemctl command to run the timer and enable it to persist after reboot

$ systemctl start my_timer_file
$ systemctl enable my_timer_file

Now I have systemd completely replaced crond for my simple need.

AWS VPC Infrastructure For Online Quiz System — April 9, 2016

AWS VPC Infrastructure For Online Quiz System

Recently, we were tasked to setup the infrastructure for an online quiz system on Amazon AWS. The brief for the assignment were:

  1. High availability
  2. Good performance
  3. Easy to scale

We decided to implement a Virtual Private Cloud (VPC), spanning across two availability zones denoted as A (10.0.0.0/24) and B (10.0.1.0/24). The general outline of the infrastructure design is illustrated below:AWS Infra JAPEN 2016

Interacting with the outside world was done by Elastic Load Balancer (ELB) which helped to load balance the traffic not only between the availability zones but also between various instances within a zone. ELB will ensure high availability (HA) simply registering EC2 instances to the list of managed instances by ELB. Just like HA, scaling horizontally is easily achieved by creating a new instance and adding it to the list of managed instances by ELB. Also worth noting that control of traffics and access was done via a security group.

PGSQL+PGPool+Stream Replication HA Cluster —
PgPool – LB and Pooler for PGSQL —
Small lambs trying to jump high… — April 8, 2016

Small lambs trying to jump high…

For more than 20 years we are moving as individuals. Building our own individual brand as techie nerd in the local IT scene. 2016 is the year, collectively moving as a company under one single roof – NexoPrima.

This blog will represent things that we have in mind, ranting tech, our philosophies and anything got to do with our movement as NexoPrima.