Month: May 2022

How to generate SSH Keys and avoid “Invalid privatekey” error

I’ve long been a user of DBeaver which works so well across different OSes, so recently I wanted to set up the cloud version called cloudbeaver.

In the course of doing that, I had to generate SSH keys to be able to access remote databases via SSH.

Generate an SSH keypair

The standard way of generating SSH keys is to run this command.

> ssh-keygen -t rsa

This by default creates id_rsa and id_rsa.pub under <home directory>/.ssh folder (both in Windows and Linux)

Continue reading

increase Postgres statement_timeout

Sometimes it is required to increase the statement_timeout for Postgres.

The correct way to do this would be to create a .psqlrc in the home directory and add the setting inside there.

$> cat .psqrc
set statement_timeout to 10000;

This is given in milliseconds so the above is for 10 seconds.

This can be verified from within psql command

psql> show statement_timeout;
 statement_timeout
-------------------
 10s
(1 row)

Reference: https://stackoverflow.com/a/24093305/33581

PM2 logrotate

One of the things I forgot when I wrote the PM2 post is that PM2 creates logs. And these logs get very big, very fast!!

The pm2-logrotate takes care of this.

To install pm2-logrotate

$> pm2 install pm2-logrotate

The defaults work perfectly fine. It will retain logs for 30 days and rotate the log every day, each with a max-size of 10 MB.

To change any of these settings –

$> pm2 set pm2-logrotate:max_size 1K (1KB)
$> pm2 set pm2-logrotate:compress true (compress logs when rotated)
$> pm2 set pm2-logrotate:rotateInterval '*/1 * * * *' (force rotate every minute)

Installing nvm and node on Linux

I’m using PM2 for managing all the server processes. So, installing node and nvm (node version manager) is now one of the first things I do during an application server setup.

node and nvm, just like ruby and rvm (ruby version manager) are always installed under the non-root user account.

Continue reading

Copyright © 2024 the möbius trip

Theme by Anders NorenUp ↑