feat: 💥 Allow creating multiple instances of app containers #1789
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
Allow creating multiple instances of built-in apps without using an override.
Approach
Replace all references of the app's name in templates in
~/.docker/compose/.apps
to<appname>
and<APPNAME>
.On run, copy the folders of apps being used to
~/.docker/compose/.instances
, using folder names similar to below.:.instances/radarr
.instances/radarr__radarr4k
The "appname" variables in the files in these folders will be replaced by the folder name (
<appname>
in lower case,<APPNAME>
in upper case).We will then use the
.instances
folder instead of the.apps
folder when creating the.env
file, and when calling Docker Compose.The service names and container names of the instances will match the folder names, to avoid possible conflicts with names of other built-in apps (in the above example, both service name and container name of the
radarr4k
instance would beradarr__radarr4k
). The user could then choose to change the container name to something else if they wish in the.env
file (for example,RADARR__RADARR4K__CONTAINER_NAME='radarr4k'
). This would allow the user to use a shorter name for Docker commands and network references (for example,docker stop radarr4k
andhttp://radarr4k:7878
instead ofdocker stop radarr__radarr4k
andhttp://radarr__radarr4k:7878
). The service name will remain unchanged.The format of the app variable names will be changed slightly, going from a single underscore before the start of the variable part to two underscores. We will attempt to migrate existing old variables to the new naming when they are encountered. The general format is
<APPNAME>__<VARIABLE>
or<APPNAME>__<INSTANCENAME>__<VARIABLE>
(i.e.RADARR__CONTAINER_NAME
orRADARR__RADARR4K__CONTAINER_NAME
).Open Questions and Pre-Merge TODOs
Check all boxes as they are completed
Use github checklists. When solved, check the box and explain the answer.
Learning
Describe the research stage
Links to blog posts, patterns, libraries or addons used to solve this problem
Requirements
Check all boxes as they are completed
These changes meet the standards for contributing.
I have read the code of conduct.