Skip to main content

Posts

Showing posts with the label stage

PostgreSQL DB with pgAdmin4 access through SSH tunnel

Despite using console most of the time I have a preference to edit PostgreSQL databases through UI. Especially when it comes to remote side. Usually one can access this through  $ psql  command. However this tends to writing raw SQL queries and a lot of typing in overall. Here is a way to do it with UI. First one needs to make a tunnel.Command is fairly simple: ssh - fNg - L 5555 : localhost : 5432 { username } @ { host . com } One has a tunnel afterwards. This command opens a SSH connection in the background mapping your local port 5555 to your server’s port 5432 (Postgres’ default port). To understand one can observe the meaning of the flags via  $ man ssh  to see what each of these flags doing.  It can be accessed via localhost tools like pgAdmin4 at localhost and port 5555 DB config would look like so:

Automating everyday system routine with Fabric (Python)

Lets talk about your console work. I use it on everyday basis. I need to log on to  my deployment/stage/whatever, server and do some redundancy. E.g. download some logs, clean up some caches and/or redeploy something. Here is the occasion, when  Fabric  comes handy. You can eliminate all the redundancy and cover tons of operations you need to do every day, using console, shortcutting them to one of your simple commands, like:  fab deploy_production -H root@mydeployment.com  interested? Let's move on then. Notie this command is not a masterpiece, but must give you the understanding of usual workflow. 1. Installation and purposes Let's go ahead, installing Fabric and automating some simple operations. You can read  official docs  about alternative methods. But installation is fairly simple. And is the matter of typing: $pip install fabric Nothing more special is required. You will need fabric at system wide scale. I install...