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

[teleport-update] Move teleport binaries to new path {deb,rpm} #49110

Merged
merged 19 commits into from
Dec 16, 2024

Conversation

vapopov
Copy link
Contributor

@vapopov vapopov commented Nov 16, 2024

@vapopov vapopov added the no-changelog Indicates that a PR does not require a changelog entry label Nov 16, 2024
examples/systemd/post-install Outdated Show resolved Hide resolved
examples/systemd/post-install Outdated Show resolved Hide resolved
examples/systemd/post-install Outdated Show resolved Hide resolved
examples/systemd/post-install Outdated Show resolved Hide resolved
@vapopov
Copy link
Contributor Author

vapopov commented Nov 20, 2024

dev tag build: https://github.com/gravitational/teleport.e/actions/runs/11926871694
publish tag: https://github.com/gravitational/teleport.e/actions/runs/11935981875

publish might be failing by removal script since command not yet implemented, checking this one

@vapopov vapopov marked this pull request as ready for review November 20, 2024 15:02
@github-actions github-actions bot requested review from avatus and camscale November 20, 2024 15:03
@vapopov
Copy link
Contributor Author

vapopov commented Nov 20, 2024

Example of upgrade deb package from teleport_17.0.1_arm64.deb to current build

Install teleport_17.0.1_arm64.deb

root@92f7b4e17c5b:/go/teleport# dpkg -i teleport_17.0.1_arm64.deb
(Reading database ... 59626 files and directories currently installed.)
Preparing to unpack teleport_17.0.1_arm64.deb ...
Unpacking teleport (17.0.1) ...
Setting up teleport (17.0.1) ...

root@92f7b4e17c5b:/go/teleport# ls -la /usr/local/bin/
drwxr-xr-x 1 root root      4096 Nov 20 15:13 .
drwxr-xr-x 1 root root      4096 Nov 19 19:59 ..
-rwxr-xr-x 1 root root    395672 Nov 16 08:11 fdpass-teleport
-rwxr-xr-x 1 root root  84934916 Nov 16 08:11 tbot
-rwxr-xr-x 1 root root 104273432 Nov 16 08:11 tctl
-rwxr-xr-x 1 root root 341960152 Nov 16 08:11 teleport
-rwxr-xr-x 1 root root  51904664 Nov 19 19:22 teleport-update
-rwxr-xr-x 1 root root 118778368 Nov 16 08:11 tsh

Upgrade to teleport_18.0.0-dev.vapopov.10_arm64.deb

root@92f7b4e17c5b:/go/teleport# dpkg -i teleport_18.0.0-dev.vapopov.10_arm64.deb
(Reading database ... 59620 files and directories currently installed.)
Preparing to unpack teleport_18.0.0-dev.vapopov.10_arm64.deb ...
Unpacking teleport (18.0.0-dev.vapopov.10) over (17.0.1) ...
dpkg: warning: unable to delete old directory '/usr/local/bin': Directory not empty
Setting up teleport (18.0.0-dev.vapopov.10) ...
Teleport system symlinks creation...
2024-11-20T15:25:17Z INFO [UPDATER]   Successfully linked system package installation. agent/updater.go:652

root@92f7b4e17c5b:/go/teleport# ls -la /usr/local/bin/
drwxr-xr-x 1 root root 4096 Nov 20 15:25 .
drwxr-xr-x 1 root root 4096 Nov 20 15:25 ..
lrwxrwxrwx 1 root root   46 Nov 20 15:25 fdpass-teleport -> /usr/local/teleport-system/bin/fdpass-teleport
lrwxrwxrwx 1 root root   35 Nov 20 15:25 tbot -> /usr/local/teleport-system/bin/tbot
lrwxrwxrwx 1 root root   35 Nov 20 15:25 tctl -> /usr/local/teleport-system/bin/tctl
lrwxrwxrwx 1 root root   39 Nov 20 15:25 teleport -> /usr/local/teleport-system/bin/teleport
lrwxrwxrwx 1 root root   46 Nov 20 15:25 teleport-update -> /usr/local/teleport-system/bin/teleport-update
lrwxrwxrwx 1 root root   34 Nov 20 15:25 tsh -> /usr/local/teleport-system/bin/tsh

root@92f7b4e17c5b:/go/teleport# ls -la /lib/systemd/system/teleport.service
-rw-r--r-- 1 root root 435 Nov 20 15:25 /lib/systemd/system/teleport.service

root@92f7b4e17c5b:/go/teleport# tree /usr/local/teleport-system/
/usr/local/teleport-system/
|-- bin
|   |-- fdpass-teleport
|   |-- tbot
|   |-- tctl
|   |-- teleport
|   |-- teleport-update
|   `-- tsh
`-- lib
    `-- systemd
        `-- system
            `-- teleport.service

5 directories, 7 files

root@92f7b4e17c5b:/go/teleport# teleport-update version
Teleport v18.0.0-dev.vapopov.10 git:v18.0.0-dev.vapopov.10-0-gfdfa3ea go1.23.3

root@92f7b4e17c5b:/go/teleport# dpkg-deb -c teleport_18.0.0-dev.vapopov.10_arm64.deb
drwxr-xr-x 0/0               0 2024-11-20 05:09 ./
drwxr-xr-x 0/0               0 2024-11-20 05:09 ./usr/
drwxr-xr-x 0/0               0 2024-11-20 05:09 ./usr/local/
drwxr-xr-x 0/0               0 2024-11-20 05:09 ./usr/local/teleport-system/
drwxr-xr-x 0/0               0 2024-11-20 05:09 ./usr/local/teleport-system/bin/
-rwxr-xr-x 0/0          395672 2024-11-20 05:04 ./usr/local/teleport-system/bin/fdpass-teleport
-rwxr-xr-x 0/0        85000452 2024-11-20 05:04 ./usr/local/teleport-system/bin/tbot
-rwxr-xr-x 0/0       104340792 2024-11-20 05:04 ./usr/local/teleport-system/bin/tctl
-rwxr-xr-x 0/0       331480504 2024-11-20 05:04 ./usr/local/teleport-system/bin/teleport
-rwxr-xr-x 0/0        51904664 2024-11-20 05:04 ./usr/local/teleport-system/bin/teleport-update
-rwxr-xr-x 0/0       118779168 2024-11-20 05:04 ./usr/local/teleport-system/bin/tsh
drwxr-xr-x 0/0               0 2024-11-20 05:09 ./usr/local/teleport-system/lib/
drwxr-xr-x 0/0               0 2024-11-20 05:09 ./usr/local/teleport-system/lib/systemd/
drwxr-xr-x 0/0               0 2024-11-20 05:09 ./usr/local/teleport-system/lib/systemd/system/
-rw-r--r-- 0/0             435 2024-11-20 05:04 ./usr/local/teleport-system/lib/systemd/system/teleport.service
drwxr-xr-x 0/0               0 2024-11-20 05:09 ./usr/share/
drwxr-xr-x 0/0               0 2024-11-20 05:09 ./usr/share/doc/
drwxr-xr-x 0/0               0 2024-11-20 05:09 ./usr/share/doc/teleport/
-rw-r--r-- 0/0             142 2024-11-20 05:09 ./usr/share/doc/teleport/changelog.gz
drwxr-xr-x 0/0               0 2024-11-20 05:09 ./var/
drwxr-xr-x 0/0               0 2024-11-20 05:09 ./var/lib/
drwxr-xr-x 0/0               0 2024-11-20 05:09 ./var/lib/teleport/
drwxr-xr-x 0/0               0 2024-11-20 05:09 ./var/lib/teleport/versions/

@vapopov
Copy link
Contributor Author

vapopov commented Nov 22, 2024

Latest tag build and publish:
https://github.com/gravitational/teleport.e/actions/runs/11979030454
https://github.com/gravitational/teleport.e/actions/runs/11980504594

I also added changes for AMI build script, to move binaries according new path and link-package command execution, since installation done from tar.gz package

@fheinecke @hugoShaka could you please review

@vapopov
Copy link
Contributor Author

vapopov commented Dec 5, 2024

Latest tag-build and tag-publish after changing path to /opt/teleport/system:

https://github.com/gravitational/teleport.e/actions/runs/12172791313
https://github.com/gravitational/teleport.e/actions/runs/12173387738

Installing previous version first 17.0.1:

root@6ddfa2f2f9e9:/go/teleport# dpkg -i teleport_17.0.1_arm64.deb
Selecting previously unselected package teleport.
(Reading database ... 51827 files and directories currently installed.)
Preparing to unpack teleport_17.0.1_arm64.deb ...
Unpacking teleport (17.0.1) ...
Setting up teleport (17.0.1) ...
root@6ddfa2f2f9e9:/go/teleport# ls -la /usr/local/bin/
total 635140
drwxr-xr-x 1 root root      4096 Dec  5 18:49 .
drwxr-xr-x 1 root root      4096 Nov  6 18:46 ..
-rwxr-xr-x 1 root root    395672 Nov 16 08:11 fdpass-teleport
-rwxr-xr-x 1 root root  84934916 Nov 16 08:11 tbot
-rwxr-xr-x 1 root root 104273432 Nov 16 08:11 tctl
-rwxr-xr-x 1 root root 341960152 Nov 16 08:11 teleport
-rwxr-xr-x 1 root root 118778368 Nov 16 08:11 tsh

Upgrade to teleport_18.0.0-dev.vapopov.16_arm64.deb

root@6ddfa2f2f9e9:/go/teleport# dpkg -i teleport_18.0.0-dev.vapopov.16_arm64.deb
(Reading database ... 51838 files and directories currently installed.)
Preparing to unpack teleport_18.0.0-dev.vapopov.16_arm64.deb ...
Unpacking teleport (18.0.0-dev.vapopov.16) over (17.0.1) ...
dpkg: warning: unable to delete old directory '/usr/local/bin': Directory not empty
dpkg: warning: unable to delete old directory '/usr/local': Directory not empty
Setting up teleport (18.0.0-dev.vapopov.16) ...
Teleport system symlinks creation...
2024-12-05T20:01:53Z INFO [UPDATER]   Systemd configuration synced. unit:teleport.service agent/process.go:259
2024-12-05T20:01:53Z INFO [UPDATER]   Successfully linked system package installation. agent/updater.go:791

root@6ddfa2f2f9e9:/go/teleport# ls -la /usr/local/bin/
drwxr-xr-x 1 root root 4096 Dec  5 20:01 .
drwxr-xr-x 1 root root 4096 Nov  6 18:46 ..
lrwxrwxrwx 1 root root   40 Dec  5 20:01 fdpass-teleport -> /opt/teleport/system/bin/fdpass-teleport
lrwxrwxrwx 1 root root   29 Dec  5 20:01 tbot -> /opt/teleport/system/bin/tbot
lrwxrwxrwx 1 root root   29 Dec  5 20:01 tctl -> /opt/teleport/system/bin/tctl
lrwxrwxrwx 1 root root   33 Dec  5 20:01 teleport -> /opt/teleport/system/bin/teleport
lrwxrwxrwx 1 root root   40 Dec  5 20:01 teleport-update -> /opt/teleport/system/bin/teleport-update
lrwxrwxrwx 1 root root   28 Dec  5 20:01 tsh -> /opt/teleport/system/bin/tsh

root@6ddfa2f2f9e9:/go/teleport# ls -la /lib/systemd/system/teleport.service
-rw-r--r-- 1 root root 435 Dec  5 20:01 /lib/systemd/system/teleport.service

root@6ddfa2f2f9e9:/go/teleport# tree /opt/teleport/system/
/opt/teleport/system/
|-- bin
|   |-- fdpass-teleport
|   |-- tbot
|   |-- tctl
|   |-- teleport
|   |-- teleport-update
|   `-- tsh
`-- lib
    `-- systemd
        `-- system
            `-- teleport.service

5 directories, 7 files

root@6ddfa2f2f9e9:/go/teleport# teleport-update version
Teleport v18.0.0-dev.vapopov.16 git:v18.0.0-dev.vapopov.16-0-g86eae8a go1.23.4

Package structure:

root@6ddfa2f2f9e9:/go/teleport# dpkg-deb -c teleport_18.0.0-dev.vapopov.16_arm64.deb
drwxr-xr-x 0/0               0 2024-12-05 04:10 ./
drwxr-xr-x 0/0               0 2024-12-05 04:10 ./opt/
drwxr-xr-x 0/0               0 2024-12-05 04:10 ./opt/teleport/
drwxr-xr-x 0/0               0 2024-12-05 04:10 ./opt/teleport/system/
drwxr-xr-x 0/0               0 2024-12-05 04:10 ./opt/teleport/system/bin/
-rwxr-xr-x 0/0          395672 2024-12-05 04:04 ./opt/teleport/system/bin/fdpass-teleport
-rwxr-xr-x 0/0        85459204 2024-12-05 04:04 ./opt/teleport/system/bin/tbot
-rwxr-xr-x 0/0       104877336 2024-12-05 04:04 ./opt/teleport/system/bin/tctl
-rwxr-xr-x 0/0       331659256 2024-12-05 04:04 ./opt/teleport/system/bin/teleport
-rwxr-xr-x 0/0        52232344 2024-12-05 04:04 ./opt/teleport/system/bin/teleport-update
-rwxr-xr-x 0/0       119314496 2024-12-05 04:04 ./opt/teleport/system/bin/tsh
drwxr-xr-x 0/0               0 2024-12-05 04:10 ./opt/teleport/system/lib/
drwxr-xr-x 0/0               0 2024-12-05 04:10 ./opt/teleport/system/lib/systemd/
drwxr-xr-x 0/0               0 2024-12-05 04:10 ./opt/teleport/system/lib/systemd/system/
-rw-r--r-- 0/0             435 2024-12-05 04:04 ./opt/teleport/system/lib/systemd/system/teleport.service
drwxr-xr-x 0/0               0 2024-12-05 04:10 ./var/
drwxr-xr-x 0/0               0 2024-12-05 04:10 ./var/lib/
drwxr-xr-x 0/0               0 2024-12-05 04:10 ./var/lib/teleport/
drwxr-xr-x 0/0               0 2024-12-05 04:10 ./var/lib/teleport/versions/
drwxr-xr-x 0/0               0 2024-12-05 04:10 ./usr/
drwxr-xr-x 0/0               0 2024-12-05 04:10 ./usr/share/
drwxr-xr-x 0/0               0 2024-12-05 04:10 ./usr/share/doc/
drwxr-xr-x 0/0               0 2024-12-05 04:10 ./usr/share/doc/teleport/
-rw-r--r-- 0/0             145 2024-12-05 04:10 ./usr/share/doc/teleport/changelog.gz

@vapopov
Copy link
Contributor Author

vapopov commented Dec 9, 2024

@hugoShaka @fheinecke @avatus @camscale could you please review whenever you have time

Copy link
Contributor

@hugoShaka hugoShaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but I'd rather have someone familiar with out deb/rpm packages to review this as well.
I can stamp if @fheinecke or @camscale are comfortable with the changeset.

@avatus
Copy link
Contributor

avatus commented Dec 9, 2024

LGTM but I'd rather have someone familiar with out deb/rpm packages to review this as well.

+1

@camscale
Copy link
Contributor

The reason for changing /usr/local/teleport-system to /opt/teleport/system is not clear - it was done without explanation, but the referenced RFD still mentions /usr/local/teleport-system. I think I can guess, and even guess at why there is a system subdirectory in /opt/teleport, but I'd rather not guess and would prefer to read an explanation.

I do not see any testing that this will work for RPMs - the test runs shown are only the .deb packages.

Otherwise this all looks good to me.

@sclevine
Copy link
Member

sclevine commented Dec 12, 2024

Hey @camscale, this comment explains the selection of paths used by both teleport-update and the package:
#49364 (comment)

For the /usr/local/teleport-system to /opt/teleport/system change specifically:

While it's somewhat common for packages to create /usr/local/, such as /usr/local/ssl for some installations of OpenSSL, it is technically not FHS-compliant. FHS is clear that /usr/local should not have non-FHS defined subdirectories.

(It's also less common / compliant for OS packages to install into /usr/local.)

Let me know if you have questions / feedback. Definitely want to get this right 🙂

@camscale
Copy link
Contributor

@sclevine

Let me know if you have questions / feedback

That all makes sense. I had assumed that /usr/local/teleport-system -> /opt/teleport/system was because is not typical to create application directories in /usr/local (that is what /opt is for). I assumed the system subdir was to ensure it would not conflict with a local installation of teleport - e.g. if I build and install teleport myself, I would probably put it in /opt/teleport/bin. I got that one wrong :)

@vapopov
Copy link
Contributor Author

vapopov commented Dec 16, 2024

@camscale rpm installation example

[root@7af89957437b /]# rpm -i /dw/teleport-18.0.0-dev.vapopov.19-1.arm64.rpm
warning: /dw/teleport-18.0.0-dev.vapopov.19-1.arm64.rpm: Header V4 RSA/SHA512 Signature, key ID 2f67ad73: NOKEY
Teleport system symlinks creation...
2024-12-16T20:18:17Z INFO [UPDATER]   Validating binary name:fdpass-teleport agent/validate.go:68
2024-12-16T20:18:17Z INFO [UPDATER]   Binary does not support version command name:fdpass-teleport agent/validate.go:79
2024-12-16T20:18:17Z INFO [UPDATER]   Validating binary name:tbot agent/validate.go:68
2024-12-16T20:18:17Z INFO [UPDATER]   [stdout] Teleport v18.0.0-dev.vapopov.19 git:v18.0.0-dev.vapopov.19-0-g1122d7d go1.23.4 agent/logger.go:69
2024-12-16T20:18:17Z INFO [UPDATER]   Validating binary name:tctl agent/validate.go:68
2024-12-16T20:18:17Z INFO [UPDATER]   [stdout] Teleport v18.0.0-dev.vapopov.19 git:v18.0.0-dev.vapopov.19-0-g1122d7d go1.23.4 agent/logger.go:69
2024-12-16T20:18:17Z INFO [UPDATER]   Validating binary name:teleport agent/validate.go:68
2024-12-16T20:18:17Z INFO [UPDATER]   [stdout] Teleport v18.0.0-dev.vapopov.19 git:v18.0.0-dev.vapopov.19-0-g1122d7d go1.23.4 agent/logger.go:69
2024-12-16T20:18:17Z INFO [UPDATER]   Validating binary name:teleport-update agent/validate.go:68
2024-12-16T20:18:17Z INFO [UPDATER]   [stdout] Teleport v18.0.0-dev.vapopov.19 git:v18.0.0-dev.vapopov.19-0-g1122d7d go1.23.4 agent/logger.go:69
2024-12-16T20:18:17Z INFO [UPDATER]   Validating binary name:tsh agent/validate.go:68
2024-12-16T20:18:17Z INFO [UPDATER]   [stdout] Teleport v18.0.0-dev.vapopov.19 git:v18.0.0-dev.vapopov.19-0-g1122d7d go1.23.4 agent/logger.go:69
2024-12-16T20:18:17Z ERRO [UPDATER]   This system does not support systemd, which is required by the updater. agent/process.go:319
2024-12-16T20:18:17Z WARN [UPDATER]   Systemd is not installed. Skipping sync. agent/updater.go:797
2024-12-16T20:18:17Z INFO [UPDATER]   Successfully linked system package installation. agent/updater.go:801
[root@7af89957437b /]# ls -la /opt/teleport/system/bin/
total 683072
drwxr-xr-x 2 root root      4096 Dec 16 20:18 .
drwxr-xr-x 4 root root      4096 Dec 16 20:18 ..
-rwxr-xr-x 1 root root    395672 Dec 16 18:27 fdpass-teleport
-rwxr-xr-x 1 root root  85786884 Dec 16 18:27 tbot
-rwxr-xr-x 1 root root 106600280 Dec 16 18:27 tctl
-rwxr-xr-x 1 root root 334658992 Dec 16 18:27 teleport
-rwxr-xr-x 1 root root  52494488 Dec 16 18:27 teleport-update
-rwxr-xr-x 1 root root 119491680 Dec 16 18:27 tsh


[root@7af89957437b /]# ls -la /usr/local/bin/
total 12
drwxr-xr-x 1 root root 4096 Dec 16 20:18 .
drwxr-xr-x 1 root root 4096 Sep 15  2021 ..
lrwxrwxrwx 1 root root   40 Dec 16 20:18 fdpass-teleport -> /opt/teleport/system/bin/fdpass-teleport
lrwxrwxrwx 1 root root   29 Dec 16 20:18 tbot -> /opt/teleport/system/bin/tbot
lrwxrwxrwx 1 root root   29 Dec 16 20:18 tctl -> /opt/teleport/system/bin/tctl
lrwxrwxrwx 1 root root   33 Dec 16 20:18 teleport -> /opt/teleport/system/bin/teleport
lrwxrwxrwx 1 root root   40 Dec 16 20:18 teleport-update -> /opt/teleport/system/bin/teleport-update
lrwxrwxrwx 1 root root   28 Dec 16 20:18 tsh -> /opt/teleport/system/bin/tsh

[root@7af89957437b /]# rpm -ql /dw/teleport-18.0.0-dev.vapopov.19-1.arm64.rpm
warning: /dw/teleport-18.0.0-dev.vapopov.19-1.arm64.rpm: Header V4 RSA/SHA512 Signature, key ID 2f67ad73: NOKEY
/opt/teleport/system/bin/fdpass-teleport
/opt/teleport/system/bin/tbot
/opt/teleport/system/bin/tctl
/opt/teleport/system/bin/teleport
/opt/teleport/system/bin/teleport-update
/opt/teleport/system/bin/tsh
/opt/teleport/system/lib/systemd/system/teleport.service
/var/lib/teleport
/var/lib/teleport/versions

@public-teleport-github-review-bot public-teleport-github-review-bot bot removed the request for review from fheinecke December 16, 2024 20:26
@vapopov vapopov added this pull request to the merge queue Dec 16, 2024
Merged via the queue into master with commit 278dfc8 Dec 16, 2024
41 checks passed
@vapopov vapopov deleted the vapopov/build-teleport-update-for-dist-packages branch December 16, 2024 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Indicates that a PR does not require a changelog entry size/sm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants