Skip to content

Commit eb0a841

Browse files
Merge branch 'main' into fix-read-only
2 parents 4944427 + 2a589aa commit eb0a841

8 files changed

Lines changed: 105 additions & 29 deletions

File tree

.github/workflows/publish-image.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@ jobs:
4848
4949
# Workaround: https://github.com/docker/build-push-action/issues/461
5050
- name: Setup Docker buildx
51-
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
51+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd
5252

5353
# Login against all registries
5454
# https://github.com/docker/login-action
5555
- name: Log into registry ${{ env.REGISTRY }}
56-
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9
56+
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2
5757
with:
5858
registry: ${{ env.REGISTRY }}
5959
username: ${{ github.repository_owner }}
6060
password: ${{ secrets.GITHUB_TOKEN }}
6161

6262
- name: Login to DockerHub
63-
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9
63+
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2
6464
with:
6565
username: ${{ secrets.DOCKERHUB_USERNAME }}
6666
password: ${{ secrets.DOCKERHUB_TOKEN }}
@@ -69,7 +69,7 @@ jobs:
6969
# https://github.com/docker/metadata-action
7070
- name: Extract Docker metadata
7171
id: meta
72-
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051
72+
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf
7373
with:
7474
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
7575

@@ -92,7 +92,7 @@ jobs:
9292
# https://github.com/docker/build-push-action
9393
- name: Build and push Docker image
9494
id: build-and-push
95-
uses: docker/build-push-action@v6
95+
uses: docker/build-push-action@v7
9696
with:
9797
context: .
9898
push: ${{ github.event_name != 'pull_request' }}

.github/workflows/test-pr-image-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ jobs:
2323
uses: actions/checkout@v6
2424

2525
- name: Setup Docker buildx
26-
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
26+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd
2727

2828
- name: Build Docker image
2929
id: build
30-
uses: docker/build-push-action@v6
30+
uses: docker/build-push-action@v7
3131
with:
3232
push: false
3333
context: .

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.22.3
1+
2.22.3

arm/ripper/identify.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ def check_mount(job: Job) -> bool:
4848
job.mountpoint = mountpoint
4949
else:
5050
logging.info(f"Trying to mount disc at {job.devpath}...")
51-
# --all: Automount devpath to mountpoint specified in fstab
52-
# -o X-mount.mkdir: create directory for the mountpoint, if necessary
53-
arm_subprocess(["mount", "--all", "-o", "X-mount.mkdir", job.devpath])
51+
arm_subprocess(["mount", "--source", job.devpath])
5452
if mountpoint := find_mount(job.devpath):
5553
logging.info(f"Successfully mounted disc to {mountpoint}")
5654
job.mountpoint = mountpoint
@@ -199,7 +197,7 @@ def identify_dvd(job):
199197
# rip out any SKU's at the end of the line
200198
dvd_title = re.sub(r"SKU\b", "", dvd_title)
201199
logging.debug(f"dvd_title SKU$: {dvd_title}")
202-
200+
203201
# Do we really need metaselector if we have got from ARM online db?
204202
try:
205203
dvd_info_xml = metadata_selector(job, dvd_title, year)

arm/ui/json_api.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import subprocess
77
import re
88
import html
9+
from collections import deque
910
from pathlib import Path
1011
import datetime
1112
import psutil
@@ -247,18 +248,18 @@ def calc_process_time(starttime, cur_iter, max_iter):
247248
return f"{str(test).split('.', maxsplit=1)[0]} - @{finish_time.strftime('%H:%M:%S')}"
248249

249250

250-
def read_log_line(log_file):
251+
def read_log_line(log_file: os.PathLike):
251252
"""
252-
Try to catch if the logfile gets delete before the job is finished\n
253-
:param log_file:
254-
:return:
253+
:param log_file: path to log file
254+
:return: the last 20 lines of the file at ``log_file``
255255
"""
256256
try:
257-
line = subprocess.check_output(['tail', '-n', '20', log_file]).splitlines()
258-
except subprocess.CalledProcessError:
257+
with open(log_file, encoding="utf8", errors="ignore") as read_log_file:
258+
lines = deque(read_log_file, maxlen=20)
259+
except OSError:
259260
app.logger.debug(f"Error while reading {log_file}, unable to calculate ETA")
260-
line = ["", ""]
261-
return line
261+
lines = ["", ""]
262+
return lines
262263

263264

264265
def read_all_log_lines(log_file):

arm_wiki/Config-apprise.yaml.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,14 @@ If you would like a services added to ARM that is not yet listed here, please op
9494
9595
## Service Specific Configurations
9696
97-
- **Gotify**
98-
- The Gotify settings expect a server address in one of the following formats:
99-
```
100-
https://[GOTIFY-IP-ADDRESS]
101-
http://[GOTIFY-IP-ADDRESS]
102-
```
103-
- Use **https** if your Gotify server is configured with SSL/TLS (**secure connection**).
104-
- Use **http** if your Gotify server is **not** configured with SSL/TLS (**insecure connection**).
105-
97+
### **Gotify**
98+
99+
The Gotify settings expect a server address in one of the following formats:
100+
101+
```
102+
gotifys://[GOTIFY-ADDRESS]
103+
gotify://[GOTIFY-ADDRESS]
104+
```
105+
106+
- Use **gotifys** if your Gotify server is configured with SSL/TLS (**secure connection**).
107+
- Use **gotify** if your Gotify server is **not** configured with SSL/TLS (**insecure connection**).

arm_wiki/Podman-prebuilt-image.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
Everything described in [the docker instructions](docker) is relevant, but this page is dedicated to podman quirks.
2+
# Podman
3+
Your first instinct when using Podman should be to run containers as rootless.
4+
A typical container designed to work with rootless podman would run as root or a user inside the container, and inherit any non-root permissions of the host user running the pod. In the BEST-case scenario, the user inside the container would also be rootless, with means the host user is rootless and the container is rootless.
5+
**Unfortunately this is not how ARM works, since it has been designed with Docker in mind, which runs as insecure root by default**, but efforts have been made to not run the scripts as root inside the container.
6+
### podman root mode
7+
This is how you should think of ARM from a security standpoint with podman. The classic Podman matrix where the bottom-right side is the most secure, and the upper left side is the least. **This doesn't really matter if youre just running this locally without network access**, but it gives you an idea of the expectations of permissions needed in the container image.
8+
9+
| | Rootful Host (insecure) | Rootless Host (more secure)|
10+
| ------------------------------- | ----------------------------- | -------------------------- |
11+
| Root in Container (insecure) | ARM during container setup | ✖️ |
12+
| Rootless Container (more secure)| ARM when running as `arm` user | ✖️ |
13+
14+
- ARM expects the host to have a user called `arm` on the host machine (the name does not matter! as long as you pass in the correct PID and GID, which is typically 1000 for the first user on the system)
15+
- It expects the the mounted volumes like `media`, `logs`, `music`, `config` to be owned by this `arm` user.
16+
- It expects the Container to be run as root (which ensures that the mapping of all GIDs and PIDs on the host machine map 1:1 with the container)
17+
- It expects the `arm` user on the host to belong to the groups `cdrom,video` and `arm`.
18+
- It expects there to be a corresponding directory for each ´/dev/sr*´ in the ´/mnt/dev/sr*´ on the host, owned by the `arm` user
19+
20+
**These requirements are basically what the `setup-docker.sh` script does (except creating directories for volumes you need)**
21+
22+
### Minimum podman
23+
```
24+
# This assumes your cdrom is sr0
25+
sudo podman run \
26+
-p "8080:8080" \
27+
-e ARM_UID="1000" \
28+
-e ARM_GID="1000" \
29+
-v /home/arm/content:/home/arm:Z \
30+
-v /home/arm/.config:/etc/arm/config:Z \
31+
--device /dev/sr0 \
32+
--restart always \
33+
--name arm \
34+
--cpuset-cpus='5,6' \
35+
docker.io/automaticrippingmachine/automatic-ripping-machine:latest
36+
37+
38+
```
39+
40+
This assumes a file structure like so:
41+
```
42+
- /home/
43+
- arm/
44+
- .config/
45+
- content/
46+
- music/
47+
- media/
48+
- logs/
49+
```
50+
This aligns with podman's tendency to prefer to keep config inside the calling user's directories, rather than polluting and chaning ownership in the hosts `/etc` directory.
51+
52+
[Other ARM documentation](docker) recommends that you need to run the `lsscsi -g` and grab the corresponding sg* device for your sr* device and pass that in as well, but I have had no trouble running with only ´sr0´ device passed in. Your mileage may vary.
53+
54+
55+
### Gotchas
56+
#### cdrom permissions
57+
If you're using Podman, chances are you're also using Fedora.
58+
- Fedora maps the GID of `cdrom` to 11, while the container image (based on ubuntu) maps it to 24. This discrepancy should be taken care of in [newer images of ARM](https://github.com/automatic-ripping-machine/arm-dependencies/pull/512), but if you have permission issues, you can go into the the running image like so:
59+
60+
```
61+
podman exec -it arm bash
62+
```
63+
then run
64+
```
65+
ls -al /dev/sr0
66+
```
67+
This assumes your cdrom is `sr0` and your running container is named `arm`
68+
69+
If the group ownership has an 11 in it like so:
70+
`brw-rw----. 1 root 11 11, 0 Feb 7 13:12 /dev/sr0`
71+
it means the group was not mapped correctly.
72+
Your best bet is to use the most recent ARM image, or create a new group on the host mapped to GID 24 and change the ownership of /dev/sr0 to this new user group.
73+
#### log permissions
74+
For some reason the log files like `empty.log` and `arm.log` have sometimes been created with the root user rather than the `arm` user. If this happens you can fix this on the host machine by `chown arm:arm empty.log` and it should stop giving you errors.

arm_wiki/_Sidebar.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- **Docker**
77
- [Pull prebuilt image](docker)
88
- [Build from Dockerfile](Building-ARM-docker-image-from-source)
9+
- [Podman prebuilt image](Podman-prebuilt-image)
910

1011
- **Manual Install**
1112
- See Alternate Installations

0 commit comments

Comments
 (0)