October 17, 2018

Spirit Lead Me

LYRICS
This is my worship
This is my offering
In every moment
I withhold nothing
I’m learning to trust You
Even when I can’t see it
And even in suffering
I have to believe it

[Chorus]
If You say “it’s wrong”, then I’ll say “no”
If You say “release”, I’m letting go
If You’re in it with me, I’ll begin
And when You say to jump, I’m diving in
If You say “be still”, then I will wait
If You say to trust, I will obey
I don’t wanna follow my own ways
I’m done chasing feelings
Spirit lead me

[Verse 2]
It felt like a burden
But once I could grasp it
You took me further
Further than I was asking
And simply to see You
It’s worth it all
My life is an altar
Let Your fire fall
– Read More –

July 25, 2018

Easy Way to Keep Your Ubuntu/Debian Instances Updated

While updating our proxy servers, I had to create a new Ubuntu instance for testing. I also realized most of our instances were outdated. Having an outdated instance poses a security risk. New updates generally patch up any vulnerabilities discovered and new features are added to your instance which may prove beneficial.

I’ve always found it a hassle to update instances and automating the update isn’t necessarily good as sometimes it requires a manual restart. Most people update by using sudo apt-get update && sudo apt-get upgrade command to catch anything available for their system. These two commands may not actually catch everything or may leave behind outdated files that could lead to problems down the road. Ofcourse, you can always use apt-get autoremove and apt-get clean but what if I told you there is a single command that could do all this.

Say Hi to uCareSystem. With a single command, it does the following…

  • Update all available packages
  • Update your Ubuntu system
  • Download and install updates
  • Check for the list of old Linux Kernels and uninstall them
  • Clear the apt cache folder
  • Uninstall packages that are obsolete and no longer needed
  • Uninstall orphaned packages
  • Delete package settings (from software you have previously uninstalled)

Installation

1) Login to your server
2) Add the necessary repository

sudo add-apt-repository ppa:utappia/stable

3) Update apt

sudo apt-get update

4) Install the software

sudo apt-get install ucaresystem-core

Once complete, you are good to go!

Usage

Type in the following…

sudo ucaresystem-core

You will see something like this when its all done.

Hope this will help in keep your instances updated. Good luck!

April 23, 2018

Simple way to check if CRON is working!

Recently, we moved from hosting our app on Amazon EC2 instances to Elastic Beanstalk Service. For those who had a go at hosting their apps on Elastic Beanstalk, you would know the struggles with .ebextensions. There are far more documentation and examples available now than when it was first released into the market. One of the most challenging things to do in Beanstalk is running Cron. The recommended way of doing it is via the creation of worker environment that processes long-running workloads on demand or performs tasks on a schedule. It makes use of other Amazon services like SQS queuing.

This is okay for some people who have genuinely long-running processes but our PHP application was pretty straightforward. Most of the CRON jobs would be completed in seconds. For us, running a separate worker instance with all its resources was pointless and a waste of resources. So we need to come up with another way. The other way of running CRON is using something called “leader_only” declarations in the .ebextension file. By using that, you are asking Beanstalk to run the CRON Jobs only on the first instance. This avoids multiple instances running the same CRON jobs because that would really screw things up.

Anyway, we need to get the YAML right and there is a neat little utility online that lets you validate your files. It’s called YAMLlint.com. Check it out. To see if your CRON is running as it should, here is a neat little way to test it. Obviously, the whole point of using Beanstalk is to avoid having to manually edit code on single instance so it takes away the need to setup FTP or sFTP. I suggest you do set it up for your first instance so you can check if the CRON is running and if everything is deploying as it should. There is no harm done in double checking right 😉

1. Edit your CRONTAB or in Beanstalk’s case, add it to the .ebextension folder.

$ crontab -e

2. Add the following line inside your CRON which basically will append the current date to a log file every minute. The 6 fields of the crontab file are minute, hour, the day of the month, month, the day of the week, and the actual command.

* * * * * /bin/date >> /tmp/cron_output

3. Exit the editor and you should see an output something similar to this.

crontab: installing new crontab

4. Check if the CRON is running every minute as it should through running this command which grabs the output of the file being stored in /tmp directory.

tail -f /tmp/cron_output

You should see something similar to this as the output.

Mon Apr 23 00:01:01 PDT 2018
Mon Apr 23 00:02:01 PDT 2018
Mon Apr 23 00:03:01 PDT 2018
Mon Apr 23 00:04:01 PDT 2018
...

If you don’t see it regularly running every minute, then you know something is not right with the CRON service. If you don’t see the file at all, then you know the CRON is not running. This narrows down things down to what is working and what isn’t. Saves you some hours on figuring out whether its Elastic Beanstalk file playing around or your actual CRON commands or something else. Hope this helps 🙂

I will be writing the way we setup CRON in the future blog post. Watch the space!

Newer Posts
Older Posts