Categories
Server

How To Renew Your Let’s Encrypt Certificate

Earlier I was trying to renew my Let’s Encrypt certificate and experienced some problem.

Basically, I’m just following the instructions from Let’s Encrypt Get Started page to use Certbot. And follow this steps from DigitalOcean.

What happened was when I ran the script below.

certbot-auto renew

I always get this result.

$ certbot-auto renew
...
/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
 InsecurePlatformWarning
You are using pip version 8.0.3, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

And I ran the script and see result below:

$ pip install --upgrade pip
...
Requirement already up-to-date: pip in /usr/local/lib/python2.7/dist-packages

Technically, my server packages were already up-to-date but still I’m not able to install it. And I stumbled with this solution from StackOverflow.

The command below still doesn’t work:

$ pip install requests[security]
...
Requirement already satisfied (use --upgrade to upgrade): requests[security] in /usr/lib/python2.7/dist-packages
 requests 2.2.1 does not provide the extra 'security'

And finally I found the right command to update it.

$ pip install requests[security] --upgrade
...
# Packages were downloaded and installed

After upgrading the necessary packages. I finally ran the script below and successfully renewed my certificate.

$ certbot-auto renew
...
..
Congratulations, all renewals succeeded. The following certs have been renewed:
 /etc/letsencrypt/live/yourdomain.com/fullchain.pem (success)

I hope I’ve been a help with you guys. If you have any questions just drop your comment below. Thanks!

Categories
Server Web Development

CodeIgniter Cron In Different Environment

Here are few ways on how to run CodeIgniter cron through your command line interface (CLI).

Default way

This way is to just run the cron regardless of the environment. But by default it will use “development”.

* * * * * php path/to/your/codeigniter/index.php controller method "parameters"

With Environment

The setup below helps you once you are working on different environment. If you are using version before 3, you need to use ENVIRONMENT as your server variable.

# Version 2.2 and below
* * * * * export ENVIRONMENT="testing"; php path/to/your/codeigniter/index.php controller method "parameters"
# Version 3+
* * * * * export CI_ENV="testing"; php path/to/your/codeigniter/index.php controller method "parameters"

I hope those simple snippets above will help you. Drop some comments if you have some or any suggestions. Thanks.