Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q7MQG-0006hz-P8 for pljava-dev@arkaria.postgresql.org; Thu, 08 Jun 2023 20:39:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q7MQF-0006p4-Dy for pljava-dev@arkaria.postgresql.org; Thu, 08 Jun 2023 20:39:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q7MQF-0006oE-5u for pljava-dev@lists.postgresql.org; Thu, 08 Jun 2023 20:39:55 +0000 Received: from mail-yw1-x112d.google.com ([2607:f8b0:4864:20::112d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1q7MQ7-0015Rt-By for pljava-dev@lists.postgresql.org; Thu, 08 Jun 2023 20:39:54 +0000 Received: by mail-yw1-x112d.google.com with SMTP id 00721157ae682-569fc874498so10045557b3.1 for ; Thu, 08 Jun 2023 13:39:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=coyotesong.com; s=google; t=1686256785; x=1688848785; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=KBDRm3CkbHCt5KikVcasTn2l1Os4XfgUu4thieRzCzY=; b=EMJ+o+kV7TZeUJfHgSeU+76d0K37RVZUCMJ7oVNCFw7xdqdMWjk8kCuA8hlaCPSwg3 od/fR1rL7HpZNtNXZZMWnZ34IwvOZ1QqcKz6WtEnN28MtdYcZDWDfNGqdUBRhQ+4XtIt FYPupsB7cftCPukjD0NwSVUfIwBClFaNr9z6s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686256785; x=1688848785; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=KBDRm3CkbHCt5KikVcasTn2l1Os4XfgUu4thieRzCzY=; b=X2YBBvOhY0HHo7hESzB41c/ND3jZeQUfRltn6DxM+OXgngYCbbJXbUZhzz1MtYLhhV Zr8IrT98Oax31+opYohGLszhv1gtaYF0XFyuh4kXb/io1g+qAO1WfigxsPDYN9w6wmmM D5g2ODJh4fJNVsMYQbHAzGQsLiPvMVeXcaY/0RmvmYY/nohUlmlkKKNzFQ0dxwwM4Qdv ZxFVROv2vZLCfXnR/IVY8ad8RBtXfpkOtUTjA/grZSEWghOz+dznUlBTOv1BUt4fD+Up T2e8x8JkbCpu95jTJTxTZVCPkQtn6dmYvJYVnEqzVmJ0HCYlWgztyaKsme/6vnQOwNGk hGIg== X-Gm-Message-State: AC+VfDxKOC1V4U9D7vLjeGztGNuhVq345ukZmG+i7JMYqTm1tYZqkSRM 9CgEML7VNsQJNfsf6oQM+wv82oO/JX1I0zWP3e0cjAGrnQBd7X1bkEk= X-Google-Smtp-Source: ACHHUZ4+O5NCKFC8WmsMvX7aX/3+N5mUlSz5aMjFMjglWlALW9YyASTSMaXPoD5U1vtakStq3cbSdhvH7PycTCbuQZ0= X-Received: by 2002:a0d:d6c9:0:b0:565:c21d:8ec6 with SMTP id y192-20020a0dd6c9000000b00565c21d8ec6mr787334ywd.6.1686256785478; Thu, 08 Jun 2023 13:39:45 -0700 (PDT) MIME-Version: 1.0 From: Bear Giles Date: Thu, 8 Jun 2023 14:39:34 -0600 Message-ID: Subject: Announcing docker hub repos with auto-updating pgxnclient and pl/java pre-installed To: pljava-dev@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000b2e73105fda44041" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000b2e73105fda44041 Content-Type: text/plain; charset="UTF-8" I won't finish with the CI/CD and 'readme' until tomorrow but I wanted to announce my new docker hub repos with auto-updating pgxnclient and pl/java preinstalled. I felt that giving you a bit of advance notice would make it more likely I'll get feedback before I move onto a new task and have totally forgotten why I was doing things that way. :-) General Motivation The motivation is the constant requests for help setting up a server ready for use with pgxnclient, or pl/java in particular. Both PGXN and PL/Java have a list of available docker images but those images are often very out-of-date if they still exist at all. Creating docker hub repos that are kept up-to-date via CI/CD (github actions) won't solve everyone's problems... but it will solve a lot of problems. This is especially true when I add an example of how to use these repos, Docker, and TestContainers in order to greatly simplify testing the *applications* that use these extensions. (The docker images have pg-tap installed so you can easily run tests within the docker container.) The images are built using the official postgres releases on docker hub and are intended as suitable drop-in replacements suitable for testing before your code reaches your production database. There's some related work at github.com/pgxn/pgxnclient but it looks like it's oriented around the development of pgxn clients. Personal Motivation I want do resume working on some side-projects involving pl/java. I found an easier version of these repos very useful since it made it trivial to create fresh instances as I developed my code. An application that's *using* an extension can use the appropriate docker image. I'll be providing a TestContainer example that shows how the latest version of the required jar(s). That's java-specific but easily extended to other environments. Someone who's *developing* an extension can use the *pgxnclient* image and then use a similar approach to load both their extension and anything it requires. My github repo and CI/CD This work is currently in the 'github-actions' branch of beargiles/postgresql-pljava-docker. The auto-update is handled via .github/workflows/main.yml. It will periodically wake up (currently every Monday), get a list of tags for the official postgres image, get a list of tags on my repos, and compare them. Note: it only considers the base versions, e.g., '15.3', and only for major releases of 12+. If there are any new tags the github action will build, tag, and push the appropriate versions. There's always an update of the major version, e.g., postgres-pljava:14.12 -> postgres-pljava:14. There is also an update of 'latest' if appropriate. Note: this *could* cause incorrect aliases if more than one minor version is being added. I can't use a simple sort since the 'tags' are strings and 15.9 will appear to be more recent than 15.10. At this point I could convert the tags to numbers and reliably sort those but I think it will be enough to keep a short update cycle. Testing I'm using ansible and have put in the boilerplate for running molecule tests on the newly built docker images. I haven't yet - but I'll probably add a basic smoke test soon. Nothing fancy - just verifying that the docker image can be successfully loaded. --000000000000b2e73105fda44041 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

I won't finish with the CI/CD and 'r= eadme' until tomorrow but I=20 wanted to announce my new docker hub repos with auto-updating pgxnclient and pl/java preinstalled. I felt that giving you a bit of advance=20 notice would make it more likely I'll get feedback before I move onto a= =20 new task and have totally forgotten why I was doing things that way. :-)


General Motivation

The motivation is the constant requests for help setting up a server=20 ready for use with pgxnclient, or pl/java in particular. Both PGXN and=20 PL/Java have a list of available docker images but those images are=20 often very out-of-date if they still exist at all.

Creating docker hub repos that are kept up-to-date via CI/CD (github=20 actions) won't solve everyone's problems... but it will solve a lot= of=20 problems. This is especially true when I add an example of how to use=20 these repos, Docker, and TestContainers in order to greatly simplify=20 testing the applications that use these extensions.

(The docker images have pg-tap installed so you can easily run tests wit= hin the docker container.)

The images are built using the official postgres releases on docker hub = and are intended as suitable drop-in replacements suitable for testing befo= re your code reaches your production database. There's some related wor= k at github.com/pgxn/pgxnclie= nt but it looks like it's oriented around the development of pgxn c= lients.


Personal Motivation

I want do resume working on some side-projects involving pl/java. I=20 found an easier version of these repos very useful since it made it=20 trivial to create fresh instances as I developed my code.

An application that's using an extension can use the=20 appropriate docker image. I'll be providing a TestContainer example tha= t shows how the latest version of the required jar(s). That's=20 java-specific but easily extended to other environments.

Someone who's developing an extension can use the pgxnclie= nt image and then use a similar approach to load both their extension a= nd anything it requires.


My github repo and CI/CD

This work is currently in the 'github-actions' branch of beargil= es/postgresql-pljava-docker.

The auto-update is handled via .github/workflows/main.yml. It will=20 periodically wake up (currently every Monday), get a list of tags for=20 the official postgres image, get a list of tags on my repos, and compare them. Note: it only considers the base versions, e.g., '15.3', and= only for major releases of 12+. If there are any new tags the github action=20 will build, tag, and push the appropriate versions.

There's always an update of the major version, e.g., postgres-pljava= :14.12 -> postgres-pljava:14.

There is also an update of 'latest' if appropriate.

Note: this could cause incorrect aliases if more than one=20 minor version is being added. I can't use a simple sort since the '= tags' are strings and 15.9 will appear to be more recent than 15.10. At this=20 point I could convert the tags to numbers and reliably sort those but I=20 think it will be enough to keep a short update cycle.


Testing

I'm using ansible and have put in the boilerplate for running=20 molecule tests on the newly built docker images. I haven't yet - but=20 I'll probably add a basic smoke test soon. Nothing fancy - just=20 verifying that the docker image can be successfully loaded.

--000000000000b2e73105fda44041--