Autoscan replaces the default Plex and Emby behaviour for picking up file changes on the file system. Autoscan integrates with Sonarr, Radarr, Readarr, Lidarr and Google Drive to fetch changes in near real-time without relying on the file system.
Wait, what happened to Plex Autoscan? Well, Autoscan is a rewrite of the original Plex Autoscan written in the Go language. In addition, this rewrite introduces a more modular approach and should be easy to extend in the future.
- A-Train, Autoscan's Google Drive integration, only supports Shared Drives and requires Service Account authentication.
- A-Train does not support RClone Crypt remotes.
- Autoscan does not rely on manual trash deletion when connected to Plex. Therefore, you should re-enable the
Empty trash automatically after every scansetting in Plex.
Autoscan also improves upon Plex Autoscan by adding the following features:
- Autoscan supports Plex music libraries.
- Autoscan adds additional support for Emby and Jellyfin.
- Autoscan can send scans to multiple Plex, Emby and Jellyfin servers.
Autoscan offers pre-compiled binaries for both Linux and MacOS for each official release. In addition, we also offer a Docker image!
Alternatively, you can build the Autoscan binary yourself. To build the autoscan CLI on your system, make sure:
- Your machine runs Linux, macOS or WSL2
- You have Go installed at the version required by go.mod or later
- Clone this repository and cd into it from the terminal
- Run
go build -o autoscan ./cmd/autoscanfrom the terminal
You should now have a binary with the name autoscan in the root directory of the project.
To start autoscan, simply run ./autoscan. If you want autoscan to be globally available, move it to /bin or /usr/local/bin.
If you need to debug certain Autoscan behaviour, either add the -v flag for debug mode or the -vv flag for trace mode to get even more details about internal behaviour.
Autoscan is split into three distinct modules:
- Triggers
- Processor
- Targets
Triggers, targets and the processor all live in different contexts. Some are used in Docker containers, others run on host OS, it can be a big mess!
That's where rewrite rules come into play. They allow you to translate paths between a trigger's / target's perspective and the processor's perspective.
Before you begin, make sure you understand how regular expressions work!
Make sure you know how capture groups work, as these are used for the to field.
Triggers can receive paths from any source: A remote server, a Docker container and the local file system. The rewrite field can be defined for each individual trigger. This field can contain multiple rewriting rules. Therefore, each rule should have a - to indicate the next rule on the list. The from should be a regexp pattern describing the path from the trigger's perspective. The to should then convert this path into a path which is local to Autoscan.
Targets work the other way around. They have to convert the path local to Autoscan to a path understood by the target, which can be a Docker container, remote server, etc. The from should be a regexp pattern describing the path from Autoscan's perspective. The to should then convert this path into a path which is local to the target.
For directory-prefix rewrites, include the separator: from: ^/media/ with
to: /mapped/ rewrites children of /media while preserving /media2.
All triggers and targets use regular-expression rewrite rules, so from: ^/media
also matches /media2.
It is important that all three modules can have access to a file. When a trigger receives a scan, then the file should be available from both the processor and all targets.
- Sonarr running in a Docker container (same example works for Lidarr, Radarr and Readarr)
- Autoscan running on the host OS (not in a container)
- Plex running in a Docker container
The following config only defines rewrite paths, this should not be used directly!
triggers:
sonarr:
- rewrite:
# /tv contains folders with tv shows
# This path is used within the Sonarr Docker container
- from: /tv/
# /mnt/unionfs/Media/TV links to the same folder, though from the host OS
# This folder is accessed by Autoscan
to: /mnt/unionfs/Media/TV/
targets:
plex:
- rewrite:
# Same folder as above, accessible by Autoscan.
# Note how we strip the "TV" part,
# as we want both Movies and TV.
- from: /mnt/unionfs/Media/
# This path is used within the Plex Docker container
to: /data/Let's take a look at the journey of the path /tv/Westworld/Season 1/s01e01.mkv coming from Sonarr.
- Sonarr's path is translated to a path local to Autoscan.
/mnt/unionfs/Media/TV/Westworld/Season 1/s01e01.mkv - The path is accessed by Autoscan to check whether it exists and adds it to the datastore.
- Autoscan's path is translated to a path local to Plex.
/data/TV/Season 1/s01e01.mkv
This should be all that's needed to get you going. Good luck!
Triggers are the 'input' of Autoscan. They translate incoming data into a common data format called the Scan.
Trigger paths and rewritten scan paths must be absolute and contain no NUL bytes. Paths do not need to exist on Autoscan's local filesystem. Supported webhook events with missing or invalid paths return HTTP 400 before submitting any scans from that batch. Empty events create no queued work. Sonarr and Radarr acknowledge unsupported event types with HTTP 200; Lidarr and Readarr retain their HTTP 400 response for unsupported types. Test events still return HTTP 200.
Existing configurations that produce valid absolute paths keep the same rewrite and batching behavior. Relative paths and empty rewrite results are rejected.
Autoscan currently supports the following triggers:
-
A-Train: The official Google Drive trigger for Autoscan.
A-Train is available separately. -
Inotify: Listens for changes on the file system.
This should not be used on top of RClone mounts.
Bugs may still exist. -
Manual: When you want to scan a path manually.
-
The -arrs: Lidarr, Sonarr, Radarr and Readarr.
Webhook support for Lidarr, Sonarr, Radarr and Readarr.
All triggers support:
-
Trigger-wide priority: higher priorities are processed sooner.
Defaults to 0. -
RegExp-based rewriting rules: translate a path given by the trigger to a path on the local file system.
If the paths are identical between the trigger and the local file system, then therewritefield should be ignored.
Autoscan can monitor Google Drive through A-Train. A-Train is a stand-alone tool created by the Autoscan developers and is officially part of the Autoscan project.
The A-Train trigger configuration is not required, as Autoscan automatically listens for A-Train requests. However, to configure global and drive-specific rewrite rules, you could add A-Train to your config:
triggers:
a-train:
priority: 5
rewrite: # Global rewrites
- from: ^/Media/
to: /mnt/unionfs/Media/
# Drives only need to be given when Drive-specific rewrites are used
drives:
- id: 0A1xxxxxxxxxUk9PVA # The ID of Shared Drive #1
rewrite: # Drive-specific rewrite (has priority over global rewrite)
- from: ^/TV/
to: /mnt/unionfs/TV/
- id: 0A2xxxxxxxxxUk9PVA # The ID of Shared Drive #2
rewrite: # Drive-specific rewrite (has priority over global rewrite)
- from: ^/Movies/
to: /mnt/unionfs/Movies/Note: You can visit /triggers/manual within a browser to manually submit requests
Autoscan also supports a manual webhook for custom scripts or for software which is not supported by Autoscan directly. The manual endpoint is available at /triggers/manual.
The manual endpoint accepts one or multiple directory paths as input and should be given one or multiple dir query parameters. Just like the other webhooks, the manual webhook is protected with basic authentication if the auth option is set in the config file of the user.
URL template: POST /triggers/manual?dir=$path1&dir=$path2
The following curl command sends a request to Autoscan to scan the directories /test/one and /test/two:
curl --request POST \
--url 'http://localhost:3030/triggers/manual?dir=%2Ftest%2Fone&dir=%2Ftest%2Ftwo' \
--header 'Authorization: Basic aGVsbG8gdGhlcmU6Z2VuZXJhbCBrZW5vYmk='If one wants to configure a HTTPTrigger with multiple distinct configurations, then these configurations MUST provide a field called Name which uniquely identifies the trigger.
The name field is then used to create the route: /triggers/:name.
The following -arrs are currently provided by Autoscan:
- Lidarr
- Radarr
- Readarr
- Sonarr
To add your webhook to Sonarr, Radarr, Readarr or Lidarr, do:
- Open the
settingspage in Sonarr/Radarr/Readarr/Lidarr - Select the tab
connect - Click on the big plus sign
- Select
webhook - Use
Autoscanas name (or whatever you prefer) - Select
On ImportandOn Upgrade - Set the URL to Autoscan's URL and add
/triggers/:namewhere name is the name set in the trigger's config. - Optional: set username and password.
Autoscan also supports the following events in the latest versions of Radarr and Sonarr:
RenameOn Movie DeleteandOn Series DeleteOn Movie File DeleteandOn Episode File Delete
We are not 100% sure whether these three events cover all the possible file system interactions. So for now, please do keep using Bernard or the Inotify trigger to fetch all scans.
A snippet of the config.yml file showcasing what is possible.
You can mix and match exactly the way you like:
# Optionally, protect your webhooks with authentication
authentication:
username: hello there
password: general kenobi
# port for Autoscan webhooks to listen on
port: 3030
triggers:
# The manual trigger is always enabled, the config only adjusts its priority and the rewrite rules.
manual:
priority: 5
rewrite:
- from: ^/Media/
to: /mnt/unionfs/Media/
a-train:
priority: 5
rewrite: # Global rewrites
- from: ^/Media/
to: /mnt/unionfs/Media/
# Drives only need to be given when Drive-specific rewrites are used
drives:
- id: 0A1xxxxxxxxxUk9PVA # The ID of Shared Drive #1
rewrite: # Drive-specific rewrite (has priority over global rewrite)
- from: ^/TV/
to: /mnt/unionfs/TV/
inotify:
- priority: 0
# filter with regular expressions
include:
- ^/mnt/unionfs/Media/
exclude:
- '\.(srt|pdf)$'
# rewrite inotify path to unified filesystem
rewrite:
- from: ^/mnt/local/Media/
to: /mnt/unionfs/Media/
# local filesystem paths to monitor
paths:
- path: /mnt/local/Media
lidarr:
- name: lidarr # /triggers/lidarr
priority: 1
radarr:
- name: radarr # /triggers/radarr
priority: 2
- name: radarr4k # /triggers/radarr4k
priority: 5
readarr:
- name: readarr # /triggers/readarr
priority: 1
sonarr:
- name: sonarr-docker # /triggers/sonarr-docker
priority: 2
# Rewrite the path from within the container
# to your local filesystem.
rewrite:
- from: /tv/
to: /mnt/unionfs/Media/TV/Triggers pass the Scans they receive to the processor. The processor then saves the Scans to its datastore.
The processor uses SQLite as its datastore, feel free to hack around!
Each target has its own persistent queue and worker. Events for the same folder
are combined into one queued scan per target, retaining the highest priority.
The worker waits until the most recent event is older than minimum-age, which
defaults to 10 minutes, before requesting a folder scan.
An offline or stalled target retains its backlog while other targets continue. Successful targets are not rescanned when another target retries. Pending work survives Autoscan restarts. Existing shared-queue entries are assigned to each configured target when upgrading.
Delivery is at least once: an abrupt stop after a server accepts a request but before Autoscan records completion can cause that request to be retried.
Target HTTP requests time out after 30 seconds. Unavailable targets retry after
15 seconds, or longer when the response specifies Retry-After. A permanent
configuration or authentication error stops only that target's worker and retains
its queued work for recovery after fixing the configuration and restarting.
An event received during delivery remains queued for that target and starts a new minimum-age wait. Events received before delivery still combine into a single folder scan, including multiple episodes in the same season.
Back up the database before upgrading to independent target queues. The upgrade
moves pending shared-queue entries into the new target queues automatically. Older
versions cannot read these queues. For a rollback, restore the pre-upgrade database
and configuration, or drain all target queues, including dormant queues, before
returning to an older binary.
An older version's strict configuration parser also rejects the new optional
name and response-limit target settings.
To prevent the processor from calling targets when a remote mount is offline, you can define a list of so called anchor files.
These anchor files do not have any special properties and often have no content.
However, they can be used to check whether a file exists on the file system.
If the file does not exist and you have not made any changes to the file, then it is certain that the remote mount must be offline or the software is having problems.
When an anchor file is unavailable, the processor will halt its operations until the file is back online. Autoscan logs an outage when the set of missing anchor files changes, and logs recovery when all anchor files return. Retry checks continue without repeating the same error. Anchor paths must still refer to files, not directories.
We suggest you to use different anchor file names if you merge multiple remote mounts together with a tool such as UnionFS or MergerFS. Each remote mount MUST have its own anchor file and its own name for that anchor file. In addition, make sure to define the 'merged' path to the file and not the remote mount path. This helps check whether the union-software is working correctly as well.
Autoscan does not check whether scan requests received by triggers exist on the file system. Therefore, to make sure a file exists before it reaches the targets, you should set a minimum age. The minimum age delays the scan from being send to the targets after it has been added to the queue by a trigger. The default minimum age is set at 10 minutes to prevent common synchronisation issues.
The processor allows you to set the minimum age of a Scan. In addition, you can also define a list of anchor files.
A snippet of the config.yml file:
# override the minimum age to 30 minutes:
minimum-age: 30m
# override each target's delay between processed scans:
# defaults to 5 seconds
scan-delay: 15s
# override the interval scan stats are displayed:
# defaults to 1 hour / 0s to disable
scan-stats: 1m
# set multiple anchor files
anchors:
- /mnt/unionfs/drive1.anchor
- /mnt/unionfs/drive2.anchorThe minimum-age, scan-delay and scan-stats fields should be given a string in the following format:
1sif the min-age should be set at 1 second.5mif the min-age should be set at 5 minutes.1m30sif the min-age should be set at 1 minute and 30 seconds.1hif the min-age should be set at 1 hour.
Please do not forget the s, m or h suffix, otherwise the time unit defaults to nanoseconds.
Scan stats print the following counters at the configured interval:
received: input events successfully saved, before folder coalescingprocessed: successful target deliveriesretried: retryable target failures, including availability checksskipped: deliveries outside a target's librariesrejected: deliveries deliberately refused, such as library-root scansremaining: queued deliveries for currently configured targets
Processed, skipped, rejected, and remaining counts refer to target deliveries. A folder waiting for two targets counts as two remaining deliveries. Skipped and rejected scans are removed from the affected queue and do not count as processed deliveries. The cumulative counters reset when Autoscan restarts; remaining deliveries are read from the persistent database.
Incoming HTTP requests have a 5-second header deadline and a 30-second deadline
for reading the request. Use --http-timeout 60s or AUTOSCAN_HTTP_TIMEOUT=60s to
change the read deadline. The header deadline is the smaller of this value and 5
seconds. Setting the value to 0 disables these request deadlines. Idle keep-alive
connections close after 2 minutes. Responses have no deadline, so a webhook that
waits for the database, for example during a Bernard full sync, still receives
its result.
Autoscan binds all configured listeners before reporting startup complete.
/health returns an empty response with status 503 during startup and status 200
once initialized. An offline media server does not prevent readiness because
Autoscan can still receive and persist events. When NOTIFY_SOCKET is present,
Autoscan sends systemd readiness and scan-stat status notifications.
File logs retain the existing text format and rotation defaults. Select JSON
file logs with --log-format json or AUTOSCAN_LOG_FORMAT=json; console logs
remain readable text. --log-level or AUTOSCAN_LOG_LEVEL accepts an explicit
level, such as info, debug, trace, or warn, and overrides the existing
-v/-vv verbosity settings.
Bernard logs a warning if a Drive sync is still running after 30 minutes. It continues waiting for that sync and preserves the existing prevention of overlapping syncs. The warning does not cancel or recover the job.
While collecting Scans is fun and all, they need to have a final destination. Targets are these final destinations and are given Scans from the processor, one batch at a time.
Autoscan currently supports the following targets:
- Plex
- Emby
- Jellyfin
- Autoscan
All targets accept an optional name for their persistent queue. Names must be
unique within a target type. Without a name, queue identity depends on the target
type, URL, and rewrite rules; rotating a token or password preserves its queue.
Choose a name when initially configuring a target if its URL or rewrite rules may
later change. Adding or changing a name creates a different queue identity.
Existing configurations with identical unnamed targets remain accepted. Their
separate queues use the targets' order within that group, so give them distinct
names when initially configuring them if they need identities independent of
their order.
Removing a target leaves its existing queue dormant. Re-adding the same identity
resumes that backlog. Dormant queues receive no new events while their targets are
absent and are not counted as remaining; each startup logs a warning with the
number of scans every dormant queue holds, and scan statistics report the total as
dormant.
When an unnamed target's URL or rewrite rules change, its identity changes too.
On the next start Autoscan moves the old queue to the new identity when the change
is unambiguous: within one target type, exactly one identity that was configured
on the previous run is now missing and holds work, and exactly one configured
identity is new and holds no work. Reverting the change moves the backlog back.
This also applies when a name is first added. A target removed in an earlier run
is never treated as renamed, so its queue waits for that target to be re-added.
If several targets of one type change at once, their queues stay dormant and are
reported at startup; change them one restart at a time, or name them, to keep
their backlogs. The first start after upgrading has no record of previously
configured targets, so do not change target URLs or rewrite rules in the same
restart as the upgrade.
Newly configured targets receive new events; outstanding deliveries remain with
the target identities that originally received them.
Plex, Emby, and Jellyfin reject scans of an entire library root, including a root with a trailing slash. Submit a movie, show, or season folder instead. A folder that is the root of one library but lies inside another, such as a nested library, is delivered to the containing library instead. Rejection logs name the library and requested path; they affect only that target's delivery.
Library lists are refreshed whenever a target becomes available, at startup and after any delivery failure. A scan outside every known library triggers a refresh before it is skipped, unless the list was fetched within the last minute, so libraries added on the server are found without a restart. If a refresh fails, the target is treated as unavailable and the scan is retried rather than skipped. An empty library list never replaces one that was already retrieved. Skipped scans are summarized at info level at most once an hour. Other targets still receive their own queued deliveries.
Plex, Emby, and Jellyfin limit decoded API responses to 10 MiB by default.
Oversized responses retain queued work and retry with an error describing the
limit. If a server legitimately returns larger responses, set response-limit
in that target's configuration to a larger byte count, or to 0 to disable the
limit. The setting is optional and does not change the target's queue identity.
This default can affect servers with very large library metadata responses.
targets:
jellyfin:
- url: https://jellyfin.domain.tld
token: XXXX
response-limit: 20971520 # 20 MiB; 0 disables the byte limitAutoscan replaces Plex's default behaviour of updating the Plex library automatically.
Therefore, it is advised to turn off Plex's Update my library automatically feature.
You can setup one or multiple Plex targets in the config:
targets:
plex:
- name: main-plex # Optional stable identity for the target's queue
url: https://plex.domain.tld # URL of your Plex server
token: XXXX # Plex API Token
rewrite:
- from: /mnt/unionfs/Media/ # local file system
to: /data/ # path accessible by the Plex docker container (if applicable)There are a couple of things to take note of in the config:
- URL. The URL can link to the docker container directly, the localhost or a reverse proxy sitting in front of Plex.
- Token. We need a Plex API Token to make requests on your behalf. This article should help you out.
- Rewrite. If Plex is not running on the host OS, but in a Docker container (or Autoscan is running in a Docker container), then you need to rewrite paths accordingly. Check out our rewriting section for more info.
While Emby provides much better behaviour out of the box than Plex, it still might be useful to use Autoscan for even better performance.
You can setup one or multiple Emby targets in the config:
targets:
emby:
- url: https://emby.domain.tld # URL of your Emby server
token: XXXX # Emby API Token
rewrite:
- from: /mnt/unionfs/Media/ # local file system
to: /data/ # path accessible by the Emby docker container (if applicable)- URL. The URL can link to the docker container directly, the localhost or a reverse proxy sitting in front of Emby.
- Token. We need an Emby API Token to make requests on your behalf. This article should help you out.
It's a bit out of date, but I'm sure you will manage! - Rewrite. If Emby is not running on the host OS, but in a Docker container (or Autoscan is running in a Docker container), then you need to rewrite paths accordingly. Check out our rewriting section for more info.
While Jellyfin provides much better behaviour out of the box than Plex, it still might be useful to use Autoscan for even better performance.
You can setup one or multiple Jellyfin targets in the config:
targets:
jellyfin:
- url: https://jellyfin.domain.tld # URL of your Jellyfin server
token: XXXX # Jellyfin API Token
rewrite:
- from: /mnt/unionfs/Media/ # local file system
to: /data/ # path accessible by the Jellyfin docker container (if applicable)- URL. The URL can link to the docker container directly, the localhost or a reverse proxy sitting in front of Jellyfin.
- Token. Create a Jellyfin API key under Dashboard > Advanced > API Keys and use it as the token. Autoscan uses Jellyfin's current API authorization method, so no Jellyfin configuration changes or legacy authorization settings are needed.
- Rewrite. If Jellyfin is not running on the host OS, but in a Docker container (or Autoscan is running in a Docker container), then you need to rewrite paths accordingly. Check out our rewriting section for more info.
You can also send scan requests to other instances of autoscan!
targets:
autoscan:
- url: https://autoscan.domain.tld # URL of Autoscan
username: XXXX # Username for remote autoscan instance
password: XXXX # Password for remote autoscan instance
rewrite:
- from: /mnt/unionfs/Media/ # local file system
to: /mnt/nfs/Media/ # path accessible by the remote autoscan instance (if applicable)With the examples given in the triggers, processor and targets sections, here is what your full config file could look like:
# <- processor ->
# override the minimum age to 30 minutes:
minimum-age: 30m
# set multiple anchor files
anchors:
- /mnt/unionfs/drive1.anchor
- /mnt/unionfs/drive2.anchor
# <- triggers ->
# Protect your webhooks with authentication
authentication:
username: hello there
password: general kenobi
# port for Autoscan webhooks to listen on
port: 3030
triggers:
lidarr:
- name: lidarr # /triggers/lidarr
priority: 1
radarr:
- name: radarr # /triggers/radarr
priority: 2
- name: radarr4k # /triggers/radarr4k
priority: 5
readarr:
- name: readarr # /triggers/readarr
priority: 1
sonarr:
- name: sonarr-docker # /triggers/sonarr-docker
priority: 2
# Rewrite the path from within the container
# to your local filesystem.
rewrite:
- from: /tv/
to: /mnt/unionfs/Media/TV/
# <- targets ->
targets:
plex:
- url: https://plex.domain.tld # URL of your Plex server
token: XXXX # Plex API Token
rewrite:
- from: /mnt/unionfs/Media/ # local file system
to: /data/ # path accessible by the Plex docker container (if applicable)
emby:
- url: https://emby.domain.tld # URL of your Emby server
token: XXXX # Emby API Token
rewrite:
- from: /mnt/unionfs/Media/ # local file system
to: /data/ # path accessible by the Emby docker container (if applicable)# Specify the port to listen on (3030 is the default when not specified)
port: 3030# Specify the host interface(s) to listen on (0.0.0.0 is the default when not specified)
host:
- 127.0.0.1
- 172.19.185.13
- 192.168.0.1:5959- If no port is specified, it will use the default port configured.
- This configuration option is only needed if you have a requirement to listen to multiple interfaces.
Autoscan has an accompanying docker image which can be found on Docker Hub.
Autoscan requires access to all files being passed between the triggers and the targets.
Just mount the source directory, for many people this is /mnt/unionfs.
Make sure these files are available within the Autoscan container. Remember that you MUST use rewriting rules if paths are not identical between triggers, autoscan and targets. These rules can be set from the config for each trigger and target individually.
Autoscan's Docker image provides various versions that are available via tags. The latest tag usually provides the latest stable version. Others are considered under development and caution must be exercised when using them.
| Tag | Description |
|---|---|
| latest | Latest released Autoscan binary with independently refreshed base images |
| master | Most recent GitHub master commit |
| latest-nonroot | Opt-in distroless image using the latest released Autoscan binary |
| master-nonroot | Opt-in distroless image using the most recent master binary |
Application releases also publish <version> and <version>-nonroot tags.
Base refreshes update the floating tags without changing the released binary.
docker run \
--name=autoscan \
-e "PUID=1000" \
-e "PGID=1001" \
-p 3030:3030 \
-v "/opt/autoscan:/config" \
-v "/mnt/unionfs:/mnt/unionfs:ro" \
--restart=unless-stopped \
-d saltydk/autoscanAutoscan's Docker image supports the following parameters.
| Parameter | Function |
|---|---|
-p 3030:3030 |
The port used by Autoscan's webhook triggers |
-e PUID=1000 |
The UserID to run the Autoscan binary as |
-e PGID=1000 |
The GroupID to run the Autoscan binary as |
-e AUTOSCAN_VERBOSITY=0 |
The Autoscan logging verbosity level to use. (0 = info, 1 = debug, 2 = trace) |
-e AUTOSCAN_LOG_FORMAT=text |
File log format. Set to json to opt in to JSON file logs. |
-e AUTOSCAN_LOG_LEVEL=info |
Explicit log level, overriding verbosity when set. |
-e AUTOSCAN_HTTP_TIMEOUT=30s |
Incoming HTTP request read deadline. Set to 0 to disable request deadlines. |
-v /config |
Autoscan's config and database file |
Any other volumes can be referenced within Autoscan's config file config.yml, assuming it has been specified as a volume.
The -nonroot images are available alongside the existing Alpine/s6 images for
testing and migration. They use gcr.io/distroless/static-debian13:nonroot, with
the same Autoscan binary, CA certificates, and timezone data. Autoscan runs
directly as UID/GID 65532:65532 by default. These images have no shell, package
manager, s6, curl, or archive utilities.
For an existing installation, set Docker's numeric user to the UID/GID currently
used by Autoscan, and keep the same configuration and media mounts. For example,
an installation using PUID=1000 and PGID=1001 can run:
docker run \
--name=autoscan \
--user 1000:1001 \
-e TZ=Etc/UTC \
-p 3030:3030 \
-v "/opt/autoscan:/config" \
-v "/mnt/unionfs:/mnt/unionfs:ro" \
--restart=unless-stopped \
-d saltydk/autoscan:latest-nonrootIn Compose, the equivalent setting is user: "1000:1001". Stop the existing
container before starting its replacement; only one instance should use the
database. The selected user must own or be able to write /config, the database,
and existing log files, and must be able to traverse the media/anchor mounts.
Keep existing log ownership aligned with that user so log rotation can preserve
it. The nonroot image does not change bind-mount ownership. Newly initialized
named volumes use the default 65532:65532 ownership; a custom numeric user
requires a volume prepared for that user.
PUID, PGID, and s6 initialization hooks do not apply to this variant. A UMASK
environment variable does not change its process umask. AUTOSCAN_* and TZ
remain supported. Use absolute paths; writable XDG directories are configured
under /config. A read-only root filesystem is supported with writable /config
and /tmp, for example by adding --read-only --tmpfs /tmp:rw,nosuid,noexec,size=64m.
Run health checks externally against /health or the authenticated webhook;
checks that execute curl or a shell inside the container need changing. Autoscan
receives SIGTERM directly and normally stops with exit code 143. Container
restart policy provides restart behavior. To return to the s6 variant, select
the corresponding image tag without -nonroot and restore PUID/PGID settings.
The standard images use the shared saltydk/alpine-s6overlay base pinned by source commit
and multi-platform manifest digest. The base owns the Alpine packages; Autoscan
adds its compiled binary and s6 service without changing that package inventory.
The existing /config mount, port 3030, PUID/PGID, and AUTOSCAN_*
environment variables continue to work.
The runtime recipes live in docker/master/ and docker/release/, including
their Dockerfile, Dockerfile.nonroot, and startup scripts. The nonroot base is
pinned by its published multi-platform manifest digest. Development changes go into the master
recipe. Both recipes copy a staged binary; binary selection happens in CI.
The image and release tooling in scripts/ runs on the system python3 and
supports Python 3.10–3.15. CI runs its unit tests on 3.10, 3.15 and the
runner's python3 with warnings as errors, and a weekly workflow repeats them
on every GitHub-hosted Ubuntu runner image.
Build development binaries and stage the Linux artifacts before building an image:
task snapshot
python3 scripts/image.py --recipe master base verify
python3 scripts/image.py stage
mkdir -p docker/master/binaries
cp -a dist/docker/. docker/master/binaries/
docker buildx build --platform linux/amd64 --load -t local/autoscan docker/master
scripts/test-image.sh local/autoscan linux/amd64 x86_64 "$(git rev-parse --short=7 HEAD)"Both Dockerfile variants support linux/arm64 and linux/arm/v7. To build the
nonroot variant, add -f docker/master/Dockerfile.nonroot to the build command
and append nonroot to the acceptance command. Its acceptance checks run from
the host and cover default/custom users, a read-only root, log rotation,
persisted scans, trust roots, timezone files, and stop behavior. Running acceptance
checks for another architecture requires QEMU or a matching native runner.
Staging reads GoReleaser's artifact metadata so compiler-specific directory
suffixes do not affect the build.
To inspect a base update, run python3 scripts/image.py base update. Add --write
to update the base pin in both Dockerfiles after the resolver has verified the
source tag, digest, and matching revision labels on all three platforms. Other
recipe differences are preserved. --recipe master base verify and
--recipe release base verify check each committed pin, so historical builds do
not require the base to remain latest.
The base updater owns this pin; Renovate manages other supported dependencies.
Use python3 scripts/image.py --variant nonroot base update and
python3 scripts/image.py --recipe master --variant nonroot base verify for the
distroless pins. Its validation checks the required architecture subset and
nonroot default user; historical pins remain valid when the upstream tag moves.
CI builds and boots each platform, checks the authenticated webhook and service user, verifies the standard image's inherited package inventory, and applies the shared Trivy and Docker Scout policies. Trivy blocks fixable HIGH/CRITICAL vulnerabilities; Scout also blocks CISA KEV findings. Credential-dependent Scout checks run outside pull requests. SARIF reports and explicit per-platform outcomes are retained as artifacts. Pull requests do not publish images.
build.yml builds development binaries and calls docker.yml to test the master
recipe on every branch push and pull request. Standard and nonroot variants have
independent acceptance and publication jobs, so a failing experimental variant
does not prevent the standard image from publishing. Master commits publish
master and master-nonroot; other branches and pull requests only test images.
release.yml publishes GoReleaser binaries for version tags, then calls the same
Docker workflow with the release recipe. Before any binary or image publication,
the release workflow requires the two runtime recipes to match exactly, including
base pins for both variants, file contents, and permissions. Synchronize the release recipe with
the tested master recipe before tagging, and check it locally with:
python3 scripts/image.py check-releaseOnly the generated binaries/ directories are excluded from that comparison.
Recipe differences remain permitted during development.
Release images download the published application's Linux binaries and verify
their SHA-512 checksums. An application release publishes its versioned image tag
and latest, plus their -nonroot counterparts. Base refreshes retain those same
release binaries and publish latest/latest-nonroot, alongside the independently
rebuilt development images.
After all candidates pass, CI publishes a unique source/run-tagged candidate with an SBOM, verifies its platform identities and attestations, and promotes that same manifest. Image labels record both the recipe commit and the binary commit. A moved source ref or a newer application release prevents stale promotion.
The base updater checks both base variants in both recipes every six hours.
The daily security workflow scans all four published floating tags. The updater
checks each image independently and retries
pending publication even when the base pins are unchanged. Unrelated development
commits do not trigger a latest refresh.
The shared Alpine base refreshes its packages every six hours. Autoscan adopts its verified published digest on a subsequent base-update check. Autoscan installs no additional Alpine packages, so it has no inherited-package solver conflict to defer. Base verification and publication errors remain failures.
To accelerate an Alpine base update manually, run the base repository's ci
workflow with refresh-packages enabled, wait for successful publication, then
run Autoscan's Update base image workflow. The nonroot recipe continues to
refresh its separate distroless base independently.
The released shared container security actions report ordinary HIGH/CRITICAL CVEs and retain the CISA KEV block. Candidate runtime tests stay required. Scheduled and post-publication reporting cover all four published runtime tags on amd64, arm64, and arm/v7. Each reporting invocation keeps separate artifacts; complete current scans can resolve tracked issues, while missing assessments preserve them. Network retries run inside the shared Python tooling.