FreshPorts / freshports

The website part of FreshPorts
http://www.freshports.org/
BSD 2-Clause "Simplified" License
70 stars 24 forks source link

How to update a the jail in a FreshPorts ingress node #521

Open dlangille opened 10 months ago

dlangille commented 10 months ago

Witness:

[19:32 r730-01 dvl ~/src/scripts] % file /jails/*-ingress01/jails/freshports/bin/sh
/jails/dev-ingress01/jails/freshports/bin/sh:   ELF 64-bit LSB pie executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 13.2, FreeBSD-style, stripped
/jails/stage-ingress01/jails/freshports/bin/sh: ELF 64-bit LSB pie executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 13.2, FreeBSD-style, stripped
/jails/test-ingress01/jails/freshports/bin/sh:  ELF 64-bit LSB pie executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 13.2, FreeBSD-style, stripped

Instead of upgrading those jails, it might be easier to just redeploy them.

Do I already have a script for that?

Jails contain mkjail

I found this in command history: sudo mkjail create -j freshports2 -v 13.2-RELEASE

dlangille commented 10 months ago

That seems to have worked, despite an issue raised here: https://github.com/mkjail/mkjail/issues/47

dlangille commented 10 months ago

So far, the steps are:

Except, that is not the required value, since we are going to swap jails.

[16:40 dev-ingress01 dan /usr/local/libexec/freshports/Jail] % diff -ruN /jails/freshports/vars.sh /jails/freshports2/vars.sh.sample 
[16:40 dev-ingress01 dan /usr/local/libexec/freshports/Jail] % sudo cp -ip /jails/freshports/vars.sh /jails/freshports2/

No diff, so just a straight copy.

[16:58 dev-ingress01 dan ~/modules] % zfs list NAME USED AVAIL REFER MOUNTPOINT data02 923G 798G 96K none data02/freshports 488G 798G 88K none data02/freshports/jailed 422G 798G 96K none data02/freshports/jailed/dev-ingress01 140G 798G 96K none data02/freshports/jailed/dev-ingress01/jails 138G 798G 112K /jails data02/freshports/jailed/dev-ingress01/jails/freshports 2.58G 798G 2.58G /jails/freshports data02/freshports/jailed/dev-ingress01/jails/freshports.old 136G 798G 135G /jails/freshports.old data02/freshports/jailed/dev-ingress01/mkjail 1.32G 798G 445M /var/db/mkjail data02/freshports/jailed/dev-ingress01/mkjail/14.0-RELEASE 904M 798G 904M /var/db/mkjail/14.0-RELEASE [16:59 dev-ingress01 dan ~/modules] %


Now the new jail is in place.

[16:59 dev-ingress01 dan ~/modules] % file /jails/*/bin/sh /jails/freshports.old/bin/sh: ELF 64-bit LSB pie executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 13.2, FreeBSD-style, stripped /jails/freshports/bin/sh: ELF 64-bit LSB pie executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 14.0 (1400097), FreeBSD-style, stripped


Then start the services back up:

[19:25 test-ingress01 dan /usr/local/libexec/freshports/Jail] % sudo service jail start Starting jails: freshports. [19:26 test-ingress01 dan /usr/local/libexec/freshports/Jail] % sudo service freshports start Starting freshports.



Ahh, I just remembered https://github.com/FreshPorts/host-init