Mercurial > code > home > repos > infra
annotate packages.py @ 323:7f6244802f97
nodejs wasn't being called (?)
author | drewp@bigasterisk.com |
---|---|
date | Tue, 10 Dec 2024 15:00:15 -0800 |
parents | 06f6daf66686 |
children |
rev | line source |
---|---|
271 | 1 from io import StringIO |
289
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
2 |
12 | 3 from pyinfra import host |
186 | 4 from pyinfra.operations import apt, files, server, systemd |
205 | 5 |
114
7e280bf26dba
package lists big update, pulling from /var/log/apt on a few hosts
drewp@bigasterisk.com
parents:
108
diff
changeset
|
6 import package_lists |
12 | 7 |
8 | |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
9 def kitty(): |
314 | 10 apt.packages(packages=['kitty'], present=False, force=True) |
312 | 11 vers = '0.36.2' # see https://github.com/kovidgoyal/kitty/releases |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
12 home = '/home/drewp' |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
13 local = f"{home}/.local/kitty" |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
14 dl = f'/tmp/kitty-{vers}-x86_64.txz' |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
15 files.download(src=f"https://github.com/kovidgoyal/kitty/releases/download/v{vers}/kitty-{vers}-x86_64.txz", dest=dl) |
288 | 16 files.directory(path=local) |
17 server.shell(commands=[ | |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
18 f"mkdir -p {local}", # https://github.com/Fizzadar/pyinfra/issues/777 |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
19 f"aunpack --extract-to={local} {dl}", |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
20 ]) |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
21 files.link(target="{local}/bin/kitty", path="{home}/bin/kitty") |
314 | 22 files.link(target="{local}/bin/kitten", path="{home}/bin/kitten") |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
23 |
12 | 24 |
174
b6b11048d0fb
collect nodejs pkg install stuff together
drewp@bigasterisk.com
parents:
169
diff
changeset
|
25 def nodejs(): |
b6b11048d0fb
collect nodejs pkg install stuff together
drewp@bigasterisk.com
parents:
169
diff
changeset
|
26 apt.packages(packages=['libnode72'], present=False, force=True) |
b6b11048d0fb
collect nodejs pkg install stuff together
drewp@bigasterisk.com
parents:
169
diff
changeset
|
27 apt.packages(packages=['nodejs'], latest=True) |
288 | 28 server.shell(commands=[ |
169 | 29 "rm -f /usr/local/bin/pnp{m,x}", |
30 "corepack enable", | |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
31 # https://github.com/pnpm/pnpm/releases |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
32 # but also https://pnpm.io/installation#compatibility |
306 | 33 "corepack prepare 'pnpm@9.8' --activate", |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
34 ]) |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
35 |
283 | 36 |
273
f7178138b736
pkgs and special podman future version
drewp@bigasterisk.com
parents:
271
diff
changeset
|
37 def podman(): |
f7178138b736
pkgs and special podman future version
drewp@bigasterisk.com
parents:
271
diff
changeset
|
38 # frigate build wants to mount a single file from the host, which needs podman 4.5.1 |
f7178138b736
pkgs and special podman future version
drewp@bigasterisk.com
parents:
271
diff
changeset
|
39 # https://github.com/containers/podman/issues/12123#issuecomment-1620439593 |
288 | 40 server.shell(commands='apt --fix-broken install') |
286 | 41 apt.deb(src="http://ftp.osuosl.org/pub/ubuntu/pool/main/g/gpgme1.0/libgpgme11t64_1.18.0-4.1ubuntu4_amd64.deb") |
288 | 42 server.shell(commands='apt --fix-broken install') |
286 | 43 apt.deb(src="http://ftp.osuosl.org/pub/ubuntu/pool/universe/c/conmon/conmon_2.1.10+ds1-1build2_amd64.deb") |
44 apt.deb(src="http://ftp.osuosl.org/pub/ubuntu/pool/universe/libp/libpod/podman_4.9.3+ds1-1build2_amd64.deb") | |
45 apt.packages(packages=['libsubid4', 'buildah', 'podman-docker'], latest=True) | |
283 | 46 |
205 | 47 |
203 | 48 def pdm(): |
206 | 49 # https://github.com/pdm-project/pdm/blob/main/CHANGELOG.md |
321 | 50 server.shell(commands=["pip install --break-system-packages 'pdm==2.21.0'"]) |
69 | 51 |
205 | 52 |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
53 def proper_locate(): |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
54 apt.packages(packages='mlocate', present=False) |
289
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
55 if 'pi' not in host.groups and host.name not in ['prime', 'pipe']: |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
56 apt.packages(packages='plocate') |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
57 |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
58 |
131 | 59 def proper_man(): |
289
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
60 if 'small' in host.groups or 'pi' in host.groups: |
131 | 61 apt.packages(packages=['mandb'], present=False) |
12 | 62 |
205 | 63 |
196
c409ea5a1d5c
don't tie up 80/443 with an unwanted nginx instance
drewp@bigasterisk.com
parents:
192
diff
changeset
|
64 def no_unwanted_services(): |
c409ea5a1d5c
don't tie up 80/443 with an unwanted nginx instance
drewp@bigasterisk.com
parents:
192
diff
changeset
|
65 systemd.service(service='nginx', enabled=False, running=False) |
c409ea5a1d5c
don't tie up 80/443 with an unwanted nginx instance
drewp@bigasterisk.com
parents:
192
diff
changeset
|
66 |
c409ea5a1d5c
don't tie up 80/443 with an unwanted nginx instance
drewp@bigasterisk.com
parents:
192
diff
changeset
|
67 |
289
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
68 apt.packages(packages=package_lists.setup, latest=True) |
131 | 69 |
271 | 70 |
71 def roblox(): | |
289
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
72 server.shell(commands='flatpak install -y org.freedesktop.Platform/x86_64/23.08') |
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
73 server.shell(commands='flatpak install -y flathub org.vinegarhq.Vinegar') # (roblox runner) |
277
ce823a167641
insert run_while_allowed runner around roblox launcher (although roblox is currently unavailable)
drewp@bigasterisk.com
parents:
276
diff
changeset
|
74 files.put( |
ce823a167641
insert run_while_allowed runner around roblox launcher (although roblox is currently unavailable)
drewp@bigasterisk.com
parents:
276
diff
changeset
|
75 src=StringIO( |
ce823a167641
insert run_while_allowed runner around roblox launcher (although roblox is currently unavailable)
drewp@bigasterisk.com
parents:
276
diff
changeset
|
76 #"#!/bin/sh\nexec flatpak run org.vinegarhq.Vinegar player run 'roblox-player:1'\n" |
ce823a167641
insert run_while_allowed runner around roblox launcher (although roblox is currently unavailable)
drewp@bigasterisk.com
parents:
276
diff
changeset
|
77 "#!/bin/sh\n exec /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=vinegar org.vinegarhq.Vinegar player run -app\n" |
ce823a167641
insert run_while_allowed runner around roblox launcher (although roblox is currently unavailable)
drewp@bigasterisk.com
parents:
276
diff
changeset
|
78 ), |
ce823a167641
insert run_while_allowed runner around roblox launcher (although roblox is currently unavailable)
drewp@bigasterisk.com
parents:
276
diff
changeset
|
79 dest='/usr/local/bin/roblox.real', |
ce823a167641
insert run_while_allowed runner around roblox launcher (although roblox is currently unavailable)
drewp@bigasterisk.com
parents:
276
diff
changeset
|
80 mode='755') |
ce823a167641
insert run_while_allowed runner around roblox launcher (although roblox is currently unavailable)
drewp@bigasterisk.com
parents:
276
diff
changeset
|
81 |
ce823a167641
insert run_while_allowed runner around roblox launcher (although roblox is currently unavailable)
drewp@bigasterisk.com
parents:
276
diff
changeset
|
82 for desktopFile in [ |
ce823a167641
insert run_while_allowed runner around roblox launcher (although roblox is currently unavailable)
drewp@bigasterisk.com
parents:
276
diff
changeset
|
83 '/var/lib/flatpak/exports/share/applications/org.vinegarhq.Vinegar.app.desktop', |
ce823a167641
insert run_while_allowed runner around roblox launcher (although roblox is currently unavailable)
drewp@bigasterisk.com
parents:
276
diff
changeset
|
84 '/var/lib/flatpak/app/org.vinegarhq.Vinegar/current/active/export/share/applications/org.vinegarhq.Vinegar.player.desktop', |
ce823a167641
insert run_while_allowed runner around roblox launcher (although roblox is currently unavailable)
drewp@bigasterisk.com
parents:
276
diff
changeset
|
85 ]: |
ce823a167641
insert run_while_allowed runner around roblox launcher (although roblox is currently unavailable)
drewp@bigasterisk.com
parents:
276
diff
changeset
|
86 files.line(path=desktopFile, line="^Exec", replace='Exec=/usr/local/bin/roblox') |
ce823a167641
insert run_while_allowed runner around roblox launcher (although roblox is currently unavailable)
drewp@bigasterisk.com
parents:
276
diff
changeset
|
87 files.link(target='/usr/local/bin/run_while_allowed', path='/usr/local/bin/roblox', force=True) |
271 | 88 |
89 | |
286 | 90 def kube_node(): |
292 | 91 |
92 # avoid having to this workaround: | |
93 # https://longhorn.io/kb/troubleshooting-volume-with-multipath/ | |
94 apt.packages(packages=['multipath-tools'], force=True, present=False) | |
95 | |
286 | 96 apt.packages(packages=[ |
97 # https://longhorn.io/docs/1.6.1/deploy/install/#installation-requirements | |
98 'open-iscsi', | |
99 'nfs-common', | |
292 | 100 'cryptsetup', |
286 | 101 ]) |
102 | |
103 | |
114
7e280bf26dba
package lists big update, pulling from /var/log/apt on a few hosts
drewp@bigasterisk.com
parents:
108
diff
changeset
|
104 proper_locate() |
131 | 105 proper_man() |
323 | 106 nodejs() |
131 | 107 |
289
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
108 apt.packages(packages=package_lists.general, latest=True) |
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
109 apt.packages(packages=package_lists.debug, latest=True) |
114
7e280bf26dba
package lists big update, pulling from /var/log/apt on a few hosts
drewp@bigasterisk.com
parents:
108
diff
changeset
|
110 |
7e280bf26dba
package lists big update, pulling from /var/log/apt on a few hosts
drewp@bigasterisk.com
parents:
108
diff
changeset
|
111 if host.name == "pipe": |
289
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
112 apt.packages(packages=package_lists.for_pipe, latest=True) |
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
113 |
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
114 if host.name != 'pipe': |
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
115 apt.packages(packages=['reptyr']) |
37
fbd0849dfdbd
redo networking to be much simpler. Uses systemd-networkd
drewp@bigasterisk.com
parents:
34
diff
changeset
|
116 |
131 | 117 if host.name == "prime": |
289
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
118 apt.packages(packages=package_lists.for_prime, latest=True) |
131 | 119 |
37
fbd0849dfdbd
redo networking to be much simpler. Uses systemd-networkd
drewp@bigasterisk.com
parents:
34
diff
changeset
|
120 if host.name == 'plus': |
289
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
121 apt.packages(packages=package_lists.laptop, latest=True) |
114
7e280bf26dba
package lists big update, pulling from /var/log/apt on a few hosts
drewp@bigasterisk.com
parents:
108
diff
changeset
|
122 |
289
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
123 if host.data.get('gpu'): |
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
124 apt.packages(packages=package_lists.k8s_node_with_nvidia_gpu(host.name)) |
254 | 125 |
289
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
126 if host.data.get('k8s_admin'): |
283 | 127 podman() |
273
f7178138b736
pkgs and special podman future version
drewp@bigasterisk.com
parents:
271
diff
changeset
|
128 |
286 | 129 is_kube_node = host.name in ['dash', 'slash', 'ditto', 'ws-printer', 'li-drums'] |
130 if is_kube_node: | |
131 kube_node() | |
292 | 132 |
268
34ab4aec7d4b
notes and changes for getting nvidia gpu k3d support going, which was very hard
drewp@bigasterisk.com
parents:
261
diff
changeset
|
133 if host.name == 'ditto': |
289
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
134 apt.packages(packages=package_lists.for_ditto, latest=True) |
131 | 135 |
289
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
136 if 'pi' not in host.groups: |
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
137 kitty() |
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
138 apt.packages(packages=package_lists.non_pi, latest=True) |
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
139 |
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
140 if 'pi' in host.groups: |
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
141 apt.packages(packages=package_lists.pi_setup) |
196
c409ea5a1d5c
don't tie up 80/443 with an unwanted nginx instance
drewp@bigasterisk.com
parents:
192
diff
changeset
|
142 |
298 | 143 desktop_env = host.name in ['dash', 'slash', 'plus', 'dot', 'squib', 'pillow', 'tofu'] |
240 | 144 if desktop_env: |
289
65e28d2e0cd8
move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
drewp@bigasterisk.com
parents:
288
diff
changeset
|
145 apt.packages(packages=package_lists.xorg + package_lists.desktop, latest=True) |
293 | 146 # broken, per https://vinegarhq.org/ |
147 # roblox() | |
261 | 148 if desktop_env or host.name in ['bang', 'ditto']: |
240 | 149 pdm() |
150 | |
205 | 151 no_unwanted_services() |
276 | 152 |
153 # todo: ./mrv2-v1.0.8-Linux-amd64.deb |