Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dlangille opened this issue Dec 23, 2023 · 2 comments
Open

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

dlangille opened this issue Dec 23, 2023 · 2 comments

Comments

@dlangille
Copy link
Contributor

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
Copy link
Contributor Author

That seems to have worked, despite an issue raised here: mkjail/mkjail#47

@dlangille
Copy link
Contributor Author

dlangille commented Dec 24, 2023

So far, the steps are:

  • sudo mkjail create -j freshports2 -v 14.0-RELEASE
  • Clone the ports tree into the new freshports jails: sudo git clone https://git.FreeBSD.org/ports.git /jails/freshports2/usr/ports
  • cd /usr/local/libexec/freshports/Jail
  • Copy scripts into the newly created jail:
[16:36 dev-ingress01 dan /usr/local/libexec/freshports/Jail] % sudo ./copy-scripts-into-jail.sh /jails/freshports2/                    
This entry is required in scripts/config.sh:
FRESHPORTS_JAIL_BASE_DIR="/jails/freshports2/"
This entry is required in /usr/local/etc/freshports/config.pm
$FreshPorts::Config::JailBaseDir = ${JAILBASE}

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

  • copy over vars.sh
[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.

  • Check the time, minutes not close to a multiple of 3, so we can stop:
[16:56 dev-ingress01 dan ~/modules] % date
Sun Dec 24 16:56:14 UTC 2023
[16:56 dev-ingress01 dan ~/modules] % sudo service freshports stop
Stopping freshports.
Waiting for PIDS: 7005.
[16:56 dev-ingress01 dan ~/modules] % sudo service jail stop
Stopping jails: freshports.
[16:56 dev-ingress01 dan ~/modules] % sudo zfs rename data02/freshports/jailed/dev-ingress01/jails/freshports data02/freshports/jailed/dev-ingress01/jails/freshports.old 
[16:56 dev-ingress01 dan ~/modules] % sudo zfs rename data02/freshports/jailed/dev-ingress01/jails/freshports2 data02/freshports/jailed/dev-ingress01/jails/freshports
[16:57 dev-ingress01 dan ~/modules] % sudo service jail start                                                                                                         
Starting jails: freshports.

[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

@dlangille dlangille changed the title Update the jails on dev/test/stage-ingress01 How to update a the jail in a FreshPorts ingress node Dec 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant