Tuesday, January 8, 2019

ERROR: The Compose file './docker-compose.yml' is invalid because Unsupported config option for services 'healthcheck'

While building and starting the container with command

docker-compose up -d

You get following error

ERROR: The Compose file './docker-compose.yml' is invalid because:
Unsupported config option for services.db: 'healthcheck'
Unsupported config option for services.redis: 'healthcheck'


Solution :
Check your docker-compose version.

docker-compose --version 

Your docker-compose has lower version than 1.9.0. Upgrade docker compose using pip install and check docker version in /usr/local/bin/docker-compose.

/usr/local/bin/docker-compose --version

After upgrading if you are getting same issue again, check your docker compose version again using

docker-compose --version
/usr/local/bin/docker-compose --version

If both are different, use upgraded docker-compose with absolute path like

/usr/local/bin/docker-compose up -d

Nginx ssl error : Failed SSL: error:0D0680A8

If you are getting this error while restarting / reloading nginx after making changes in ssl configuration, following solution may work for you.

Error :
[emerg] 26062#26062: PEM_read_bio_X509_AUX(".com.key") failed (SSL: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:Type=X509_CINF error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error:Field=cert_info, Type=X509 error:0906700D:PEM routines:PEM_ASN1_read_bio:ASN1 lib)


Solution :
1. Make sure you have generated correct private key file for your domain.
2. Make sure you have generated correct digital certificate file (crt) for your domain.
3. Make sure you have added private key file for attribute ssl_certificate_key and digital certificate file for attribute ssl_certificate in your nginx configuration file.

 ssl_certificate_key /etc/nginx/ssl/domain.com.key;
 ssl_certificate /etc/nginx/ssl/domain/960668e6d2dd456e.crt;

 

Monday, December 10, 2018

Find Request Execution Time of Each Request in Apache

Apache access log provides many useful parameters which are very helpful while debugging. Requester IP, request url, user agent, request response code, request response size, request creation time etc but if you want to know the execution time of each request, there is nothing wrong with this requirement.

To achieve this, you need to make modifications in LogFormat attribute of apache configuration file.

You can find this parameter in apache configuration file of RPM based distributions like CentOS as well as Debian based distributions like Ubuntu. 

You need to add %T or %D parameters in the LogFormat of apache configuration file. Search following line
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
and change into
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\" **%T/%D**" combined
We have just added %T and %D in value of the attribute.  

%T shows the response time in Seconds and %D shows the response time in microseconds. %D is very useful for short time response or to find exact value of response.
Suppose any request takes 7 seconds to finish, you can find its microseconds value in access log something like 7458962 or 7896547.

You can find apache configuration file in /etc/apache2/apache2.conf or /etc/httpd/conf/httpd.conf. Similarly you can find access log file in /var/log/apache2/access.log or /var/log/httpd/access_log