Skip to content
Showing user profile of selected author: -

PostgreSQL Project @ GSoC 2021

Wow! The PostgreSQL Project got all 7 proposals accepted into Google Summer of Code 2021!

This year Google changed the participation terms a bit, and cut the time for the students in half. This is supposed to help students who can’t work full-time from home, especially in light of the global pandemic situation. It also means smaller projects, which are easier to handle even for students new to the project.

The PostgreSQL project got a great number of initial applications (29), and we talked with many of the students about refining their proposals. 27 out of the 29 applications were finally submitted by the students. Some are duplicates, some are clearly just copied from somewhere, but many propose good ideas.

After talking with available mentors, and “recruiting” a few more, we settled on 7 final applications, and submitted them to Google.

As usual many of the proposals are not directly developing code for core PostgreSQL, but work on tools and applications from the PostgreSQL ecosystem. Expect some great output over the following months.
 

  • Twitter
  • Bookmark PostgreSQL Project @ GSoC 2021 at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg PostgreSQL Project @ GSoC 2021
  • Bloglines PostgreSQL Project @ GSoC 2021
  • Technorati PostgreSQL Project @ GSoC 2021
  • Fark this: PostgreSQL Project @ GSoC 2021
  • Bookmark PostgreSQL Project @ GSoC 2021 at YahooMyWeb
  • Bookmark PostgreSQL Project @ GSoC 2021 at Furl.net
  • Bookmark PostgreSQL Project @ GSoC 2021 at reddit.com
  • Bookmark PostgreSQL Project @ GSoC 2021 at blinklist.com
  • Bookmark PostgreSQL Project @ GSoC 2021 at Spurl.net
  • Bookmark PostgreSQL Project @ GSoC 2021 at Simpy.com
  • Bookmark PostgreSQL Project @ GSoC 2021 at blogmarks
  • Bookmark PostgreSQL Project @ GSoC 2021 with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Ansible and string comparisation for IDs

Was running in a stupid problem where Ansible (version 2.9.x) throws an error when a variable is defined. The Play:

- name: Check if id is defined
  fail:
    msg: "No id defined for {{ inventory_hostname }}!"
  when: id is not defined or id|length == 0

And the error:

TASK [Check if id is defined] *****************************************
fatal: [xxx.xxx.xxx.xxx]: FAILED! => {"msg": "The conditional check 'id is not defined or id|length == 0' failed. The error was: Unexpected templating type error occurred on ({% if id is not defined or id|length == 0 %} True {% else %} False {% endif %}): object of type 'int' has no len()\n\nThe error appears to be in '/path/to/playbook/configuration.yml': line 57, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n    - name: Check if id is defined\n      ^ here\n"}

Ok, it tries to compare an integer, fine. There are two ways to fix this problem:

1: Change the type to a string by updating the inventory:

From:

id=1

to:

id="1"

But this might have other consequences, as the other parts of the Playbook might depend on this being an integer.

2: Compare as string

when: id is not defined or id|string|length == 0

This casts the integer to a string, and then the length() function works.

  • Twitter
  • Bookmark Ansible and string comparisation for IDs at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Ansible and string comparisation for IDs
  • Bloglines Ansible and string comparisation for IDs
  • Technorati Ansible and string comparisation for IDs
  • Fark this: Ansible and string comparisation for IDs
  • Bookmark Ansible and string comparisation for IDs at YahooMyWeb
  • Bookmark Ansible and string comparisation for IDs at Furl.net
  • Bookmark Ansible and string comparisation for IDs at reddit.com
  • Bookmark Ansible and string comparisation for IDs at blinklist.com
  • Bookmark Ansible and string comparisation for IDs at Spurl.net
  • Bookmark Ansible and string comparisation for IDs at Simpy.com
  • Bookmark Ansible and string comparisation for IDs at blogmarks
  • Bookmark Ansible and string comparisation for IDs with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Ansible, "copy" module and "become"

For testing I did spin up a couple of new virtual (Ubuntu 20.04 LTS) instances, installed PostgreSQL, and wanted to copy over a .sql file to install in the database:

- name: copy files to PostgreSQL data directory
  copy:
    src: "files/{{ item }}"
    dest: "{{ item }}"
    mode: 0700
  become: yes
  become_user: postgres
  loop:
    - file1.sql
    - file2.sql

And ran into a meaningless error message:

TASK [copy files to PostgreSQL data directory] ***********
fatal: [xxx.xxx.xxx.xxx]: FAILED! => {"msg": "Failed to set permissions on the temporary files Ansible needs to create when becoming an unprivileged user (rc: 1, err: chown: changing ownership of '/var/tmp/ansible-tmp-1618521951.848439-176484068031965/': Operation not permitted\nchown: changing ownership of '/var/tmp/ansible-tmp-1618521951.848439-176484068031965/source': Operation not permitted\n}). For information on working around this, see https://docs.ansible.com/ansible/become.html#becoming-an-unprivileged-user"}

 

 

Continue reading "Ansible, "copy" module and "become""
  • Twitter
  • Bookmark Ansible, "copy" module and "become" at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Ansible, "copy" module and "become"
  • Bloglines Ansible, "copy" module and "become"
  • Technorati Ansible, "copy" module and "become"
  • Fark this: Ansible, "copy" module and "become"
  • Bookmark Ansible, "copy" module and "become" at YahooMyWeb
  • Bookmark Ansible, "copy" module and "become" at Furl.net
  • Bookmark Ansible, "copy" module and "become" at reddit.com
  • Bookmark Ansible, "copy" module and "become" at blinklist.com
  • Bookmark Ansible, "copy" module and "become" at Spurl.net
  • Bookmark Ansible, "copy" module and "become" at Simpy.com
  • Bookmark Ansible, "copy" module and "become" at blogmarks
  • Bookmark Ansible, "copy" module and "become" with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Make Ansible "postgresql_ping" fail if the database does not exist

Ansible has a very useful module "postgresql_ping" which checks connectivity to the database server. I'm using it in quite a few Playbooks as first step just to ensure that the database server is present - this fails early if there is a problem which otherwise just prevents the rest of the Playbook to work properly.

TASK [Check if database is available]
[WARNING]: PostgreSQL server is unavailable: could not connect to server: No such file or directory         Is the server running locally and accepting         connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
fatal: [127.0.0.1]: FAILED! => {"changed": false, "failed_when_result": true, "is_available": false, "server_version": {}}

 

However this module does not check if the database exists, just if the server is reachable. Example Playbook:

- name: Check if database is available
  postgresql_ping:
    db: "testdb"
  become: yes
  become_user: postgres

When I run the Playbook:

TASK [Check if database is available]
[WARNING]: PostgreSQL server is unavailable: FATAL:  database "testdb" does not exist
ok: [127.0.0.1]

 

As you can see, the database "testdb" does not exist. Which for the module is a reason to raise a warning, but not  a reason to fail.

One possible solution is to let this module do it's work, and add a "postgresql_db" call next, which ensures that the database is created. But not every Playbook is supposed to create and populate a database, and has all the required parameters (owner, encoding, template ect) available. Therefore it would be nice if "postgresql_ping" fails early if the database in question doesn't exist. That's possible, with two more lines of code:

- name: Check if database is available
  postgresql_ping:
    db: "testdb"
  become: yes
  become_user: postgres
  register: ping_database
  failed_when: ping_database.warnings is defined

And the Playbook run:

TASK [Check if database is available]
[WARNING]: PostgreSQL server is unavailable: FATAL:  database "testdb" does not exist
fatal: [127.0.0.1]: FAILED! => {"changed": false, "failed_when_result": true, "is_available": false, "server_version": {}}

Together with "any_errors_fatal: True" this ends the entire Playbook early enough before I have to debug the problem later on.

  • Twitter
  • Bookmark Make Ansible "postgresql_ping" fail if the database does not exist at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Make Ansible "postgresql_ping" fail if the database does not exist
  • Bloglines Make Ansible "postgresql_ping" fail if the database does not exist
  • Technorati Make Ansible "postgresql_ping" fail if the database does not exist
  • Fark this: Make Ansible "postgresql_ping" fail if the database does not exist
  • Bookmark Make Ansible "postgresql_ping" fail if the database does not exist at YahooMyWeb
  • Bookmark Make Ansible "postgresql_ping" fail if the database does not exist at Furl.net
  • Bookmark Make Ansible "postgresql_ping" fail if the database does not exist at reddit.com
  • Bookmark Make Ansible "postgresql_ping" fail if the database does not exist at blinklist.com
  • Bookmark Make Ansible "postgresql_ping" fail if the database does not exist at Spurl.net
  • Bookmark Make Ansible "postgresql_ping" fail if the database does not exist at Simpy.com
  • Bookmark Make Ansible "postgresql_ping" fail if the database does not exist at blogmarks
  • Bookmark Make Ansible "postgresql_ping" fail if the database does not exist with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Blog website crawlers and bots in Apache2

Found a couple more bots crawling my website, and from the look at online resources it seems I catched a few of the bad guys. Crawlers which ignore the robots.txt standard, and just crawl a website for content.

Decided to do something against it, and added a filter in Apache2.

The way I have my webserver setup is that I have templates for every website (they all have different configs), and deploy them using Ansible. Parts of the website configuration which are the same, or at least similar, are handled by includes.

 

Continue reading "Blog website crawlers and bots in Apache2"
  • Twitter
  • Bookmark Blog website crawlers and bots in Apache2 at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Blog website crawlers and bots in Apache2
  • Bloglines Blog website crawlers and bots in Apache2
  • Technorati Blog website crawlers and bots in Apache2
  • Fark this: Blog website crawlers and bots in Apache2
  • Bookmark Blog website crawlers and bots in Apache2 at YahooMyWeb
  • Bookmark Blog website crawlers and bots in Apache2 at Furl.net
  • Bookmark Blog website crawlers and bots in Apache2 at reddit.com
  • Bookmark Blog website crawlers and bots in Apache2 at blinklist.com
  • Bookmark Blog website crawlers and bots in Apache2 at Spurl.net
  • Bookmark Blog website crawlers and bots in Apache2 at Simpy.com
  • Bookmark Blog website crawlers and bots in Apache2 at blogmarks
  • Bookmark Blog website crawlers and bots in Apache2 with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Create child pages in Redmine

Once or twice a year I have to setup a new Redmine project, which we use to organize conferences for PostgreSQL Europe.

Every single time I'm trying to figure out how the child pages for the meeting notes work.

Steps required:

  • Create a page "MeetingMinutes", doesn't need to have any content, but it must exist
  • Create the first child page with meeting minutes, as parent page select "MeetingMinutes"
  • On the main wiki page insert a link with: "{{child_pages(MeetingMinutes)}}"

Every time I forget step 1), because this page is only required as parent page, and serves no further purpose. And then I'm wondering why I can't create child pages.

  • Twitter
  • Bookmark Create child pages in Redmine at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Create child pages in Redmine
  • Bloglines Create child pages in Redmine
  • Technorati Create child pages in Redmine
  • Fark this: Create child pages in Redmine
  • Bookmark Create child pages in Redmine at YahooMyWeb
  • Bookmark Create child pages in Redmine at Furl.net
  • Bookmark Create child pages in Redmine at reddit.com
  • Bookmark Create child pages in Redmine at blinklist.com
  • Bookmark Create child pages in Redmine at Spurl.net
  • Bookmark Create child pages in Redmine at Simpy.com
  • Bookmark Create child pages in Redmine at blogmarks
  • Bookmark Create child pages in Redmine with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Connect a Mac to a SMB server - as Guest

One of the things I do in our network is public drives. Every Linux system has a public "incoming" which is mapped to the primary user of the device (if there is one, like for a laptop). And this incoming shared drive can be accessed without password.

This makes it really convenient to copy files around from one laptop/user to another, or from mobile devices to laptops and vice versa, or use the printer/scanner to send the scan job directly to the laptop of the user's device. All in all, the users like this, and use it a lot. There is also minimal protection built-in, it will only work in our home network, access is blocked when the laptop is connected to a different network. But the folders are mostly empty anyway. For sharing files over the Internet we also have a Syncthing instance running, but that's a different story, and not as easy to use.

One thing which I was annoyed about is that by default a Mac will try to connect as a registered user. There is an option "Connect as Guest", but it's not pre-selected. Therefore every time I wanted to share something between Linux and Mac, I had to start "Finder", to to "Go" and then "Connect to Server", then click on the server from the list of last entries, and then also click on "Guest". The built-in help is also not useful, as it only talks about "click on Guest".

But it turns out that one can "pre-select" the Guest user. For this, the username is "Guest", and there is no password. This goes between the protocol and the hostname. Example:

smb://192.168.0.20/incoming

becomes:

smb://Guest:@192.168.0.20/incoming

There has to be a ":" between the username and the (non-existent) password, and the credentials are separated from the hostname by a "@". Using this connect string will auto-connect as anonymous user to the remote share. One click and a couple seconds saved!

Continue reading "Connect a Mac to a SMB server - as Guest"
  • Twitter
  • Bookmark Connect a Mac to a SMB server - as Guest at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Connect a Mac to a SMB server - as Guest
  • Bloglines Connect a Mac to a SMB server - as Guest
  • Technorati Connect a Mac to a SMB server - as Guest
  • Fark this: Connect a Mac to a SMB server - as Guest
  • Bookmark Connect a Mac to a SMB server - as Guest at YahooMyWeb
  • Bookmark Connect a Mac to a SMB server - as Guest at Furl.net
  • Bookmark Connect a Mac to a SMB server - as Guest at reddit.com
  • Bookmark Connect a Mac to a SMB server - as Guest at blinklist.com
  • Bookmark Connect a Mac to a SMB server - as Guest at Spurl.net
  • Bookmark Connect a Mac to a SMB server - as Guest at Simpy.com
  • Bookmark Connect a Mac to a SMB server - as Guest at blogmarks
  • Bookmark Connect a Mac to a SMB server - as Guest with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

openHAB: stop a ChromeCast

There are a number of ChromeCasts in our setup. I'm adding (physical) switches to turn displays on and off, and primarily control the volume. When I turn the display off, I also want the ChromeCast to stop doing whatever it is doing right now (stop streaming), and go back to the default application (for video CC).

The openHAB ChromeCast binding has a separate channel for that:

Switch    chromecast_chromecast_dfb5af5187ce1135b276239130aef282_stop     { channel="chromecast:chromecast:dfb5af5187ce1135b276239130aef282:stop" }

However since the channel is named "stop", it has to be "enabled" with "ON". Doesn't make sense? It is as it is:

chromecast_chromecast_dfb5af5187ce1135b276239130aef282_stop.sendCommand(ON)

And the result:

2021-01-18 17:13:20.305 [ome.event.ItemCommandEvent] - Item 'chromecast_chromecast_dfb5af5187ce1135b276239130aef282_stop' received command ON
2021-01-18 17:13:20.321 [nt.ItemStatePredictedEvent] - chromecast_chromecast_dfb5af5187ce1135b276239130aef282_stop predicted to become ON
2021-01-18 17:13:20.443 [vent.ItemStateChangedEvent] - chromecast_chromecast_dfb5af5187ce1135b276239130aef282_appName changed from <...> to UNDEF
2021-01-18 17:13:20.451 [vent.ItemStateChangedEvent] - chromecast_chromecast_dfb5af5187ce1135b276239130aef282_appId changed from <...> to UNDEF
2021-01-18 17:13:20.455 [vent.ItemStateChangedEvent] - chromecast_chromecast_dfb5af5187ce1135b276239130aef282_statustext changed from Casting: <...> to UNDEF
2021-01-18 17:13:20.457 [vent.ItemStateChangedEvent] - chromecast_chromecast_dfb5af5187ce1135b276239130aef282_idling changed from OFF to ON
2021-01-18 17:13:23.888 [vent.ItemStateChangedEvent] - chromecast_chromecast_dfb5af5187ce1135b276239130aef282_appName changed from UNDEF to Backdrop
2021-01-18 17:13:23.893 [vent.ItemStateChangedEvent] - chromecast_chromecast_dfb5af5187ce1135b276239130aef282_appId changed from UNDEF to E8C28D3C

 

  • Twitter
  • Bookmark openHAB: stop a ChromeCast at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg openHAB: stop a ChromeCast
  • Bloglines openHAB: stop a ChromeCast
  • Technorati openHAB: stop a ChromeCast
  • Fark this: openHAB: stop a ChromeCast
  • Bookmark openHAB: stop a ChromeCast at YahooMyWeb
  • Bookmark openHAB: stop a ChromeCast at Furl.net
  • Bookmark openHAB: stop a ChromeCast at reddit.com
  • Bookmark openHAB: stop a ChromeCast at blinklist.com
  • Bookmark openHAB: stop a ChromeCast at Spurl.net
  • Bookmark openHAB: stop a ChromeCast at Simpy.com
  • Bookmark openHAB: stop a ChromeCast at blogmarks
  • Bookmark openHAB: stop a ChromeCast with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

openHAB: timestamp from last Item update

If openHAB has a Persistence service configured, the time of the last Item update (and a couple other times) is available in Rules. This makes it quite handy to check if a certain item hasn't been updated in a long time. As example I have the Tankerkoenig Binding installed, and this data is persisted in InfluxDB. This way I can see historic gas prices in Grafana.

When the Telegram Bot answers the "/tanken" question, it appends the timestamp of the last gas prices update.

 

Continue reading "openHAB: timestamp from last Item update"
  • Twitter
  • Bookmark openHAB: timestamp from last Item update at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg openHAB: timestamp from last Item update
  • Bloglines openHAB: timestamp from last Item update
  • Technorati openHAB: timestamp from last Item update
  • Fark this: openHAB: timestamp from last Item update
  • Bookmark openHAB: timestamp from last Item update at YahooMyWeb
  • Bookmark openHAB: timestamp from last Item update at Furl.net
  • Bookmark openHAB: timestamp from last Item update at reddit.com
  • Bookmark openHAB: timestamp from last Item update at blinklist.com
  • Bookmark openHAB: timestamp from last Item update at Spurl.net
  • Bookmark openHAB: timestamp from last Item update at Simpy.com
  • Bookmark openHAB: timestamp from last Item update at blogmarks
  • Bookmark openHAB: timestamp from last Item update with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Online indicator for remote controllable power plugs in openHAB

Recently I installed a number of new power sockets (like this one). The Hue bridge can not only add each switch to a light group, but also reports each plug as a Thing in openHAB. There I thought it will be a nice touch if openHAB actually reports when it sees a device plugged in. The power socket has a LED which turns on when the plug is on. The Hue bridge reports OFFLINE and ONLINE. That's useful.

The plan is to turn the LED light - and the power plug - on and off for a few second.

 

Continue reading "Online indicator for remote controllable power plugs in openHAB"
  • Twitter
  • Bookmark Online indicator for remote controllable power plugs in openHAB at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Online indicator for remote controllable power plugs in openHAB
  • Bloglines Online indicator for remote controllable power plugs in openHAB
  • Technorati Online indicator for remote controllable power plugs in openHAB
  • Fark this: Online indicator for remote controllable power plugs in openHAB
  • Bookmark Online indicator for remote controllable power plugs in openHAB at YahooMyWeb
  • Bookmark Online indicator for remote controllable power plugs in openHAB at Furl.net
  • Bookmark Online indicator for remote controllable power plugs in openHAB at reddit.com
  • Bookmark Online indicator for remote controllable power plugs in openHAB at blinklist.com
  • Bookmark Online indicator for remote controllable power plugs in openHAB at Spurl.net
  • Bookmark Online indicator for remote controllable power plugs in openHAB at Simpy.com
  • Bookmark Online indicator for remote controllable power plugs in openHAB at blogmarks
  • Bookmark Online indicator for remote controllable power plugs in openHAB with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca