The pg_amqp extension was still built from source for the db service.
It was taking some time for compilation, and happened to break after
release time on unexpected upstream changes.
This patch makes deploying mirror to use the prebuilt image
`metabrainz/musicbrainz-docker-db:<tag>` for the service
db by default instead of building pg_amqp from the source.
This image has to be built and pushed by the repository maintainers,
using the newly added script, before each release. It is always trying
to pull the latest upstream Docker image for security updates.
For backward compatibility, the image tag isn’t set in the compose
files directly, it is set in a Dockerfile instead. It makes it
incidentally easier to customize the image for particular needs.
It will be revisited when merging into musicbrainz-server repository.
The last service to still be fully built from source was musicbrainz.
It was taking some time (as Perl modules were installed sequentially,
and now even Perl itself is compiled from source), and happened to break
after release time on unexpected upstream changes.
This patch makes deploying mirror to use the prebuilt image
`metabrainz/musicbrainz-docker-musicbrainz:<tag>` for the service
musicbrainz by default instead of building it from the source.
This image has to be built and pushed by the repository maintainers,
using the newly added script, before each release. It is always trying
to pull the latest upstream Docker image for security updates.
For backward compatibility, the image tag isn’t set in the compose
files directly, it is set in a Dockerfile instead. It makes it
incidentally easier to customize the image for particular needs.
It will be revisited when merging into musicbrainz-server repository.
Use Carton to install the Perl module dependencies with versions set in
musicbrainz-server/cpanfile.snapshot as in musicbrainz-* Docker images.
Reference: https://metacpan.org/dist/Carton/view/lib/Carton/Doc/FAQ.pod
Setting the environment variable `PERL_CARTON_CPANFILE`
allows running `carton exec` from any current working directory.
Reference: https://github.com/perl-carton/carton/blob/v0.9.63/Changes
A few Perl module dependencies are still installed using cpanm but these
should be moved to the cpanfile in the musicbrainz-server repository.
Our (MetaBrainz) base image is based on Phusion base image which in turn
is based on Ubuntu Jammy that comes with Perl 5.34.0 (using apt). To
upgrade Perl with the same base image, we have to install from source.
Same commit as 125ec5b894f8614995a0d05f8c4cc03d22cbaab for normal setup.
Our (MetaBrainz) base image is based on Phusion base image which in turn
is based on Ubuntu Jammy that comes with Perl 5.34.0 (using apt). To
upgrade Perl with the same base image, we have to install from source.
This patch is for development setup only. The same series of patches
will be applied to mirrors when deploying Perl 5.38.2 in production.
In deployment setup only, Perl modules have to be rebuilt as follows:
```bash
docker-compose build musicbrainz
docker-compose stop musicbrainz
sudo rm -fr ../musicbrainz-server/perl_modules
docker-compose up -d musicbrainz
```
Or fix building db service with pg_amqp and new base image
The official Docker images for Postgres updated their base image to more
recent versions of Debian, breaking the compilation of pg_amqp.
This patch sets image variant, to prevent further breakage,
and compilation flag, to address the three following errors:
2.857 /usr/bin/clang-16 -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Xclang -no-opaque-pointers -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Wno-deprecated-non-prototype -O2 -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -flto=thin -emit-llvm -c -o src/pg_amqp.bc src/pg_amqp.c
2.989 src/pg_amqp.c:99:10: warning: 5 enumeration values not handled in switch: 'XACT_EVENT_PARALLEL_COMMIT', 'XACT_EVENT_PARALLEL_ABORT', 'XACT_EVENT_PRE_COMMIT'... [-Wswitch]
2.989 switch(event) {
2.989 ^~~~~
2.989 src/pg_amqp.c:140:21: error: parameter 'broker_id' was not declared, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
2.989 local_amqp_get_a_bs(broker_id) {
2.989 ^
2.989 src/pg_amqp.c:152:19: error: parameter 'broker_id' was not declared, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
2.989 local_amqp_get_bs(broker_id) {
2.989 ^
2.990 src/pg_amqp.c:239:23: error: parameter 'broker_id' was not declared, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
2.991 local_amqp_disconnect(broker_id) {
2.991 ^
2.994 1 warning and 3 errors generated.
2.997 make: *** [/usr/lib/postgresql/12/lib/pgxs/src/makefiles/../../src/Makefile.global:1076: src/pg_amqp.bc] Error 1