[Docker] Tracking issue for missing points before we are able to officially support docker #4160

Closed
opened 2020-08-05 22:59:46 +02:00 by Drapersniper · 7 comments
Drapersniper commented 2020-08-05 22:59:46 +02:00 (Migrated from github.com)
  • #4046 needs to be merged for headless setup - (Blocking)
  • Investigate docker issues with config in Windows envs (May no longer be an issue with WSL2) - (Blocking)
  • Allow for starting audio with a external connection by default (So that lavalink can be a separate image) - (Blocking)
  • Disallow JSON as the default driver on docker setups?
  • Docker image and automatic image builds (Nightly and release builds) - (Blocking)
  • Docker docs - (Desired, but can be initially marked for "Experienced users")
  • Support Squad "training" - (Blocking)
  • Docker Image MUST support all approved cogs.

There's probably other things I'm forgetting, so feel free to mention it, please try to keep this issue as clean as possible thought.

If you are a docker user are you aware of any issues currently?

- [ ] #4046 needs to be merged for headless setup - (Blocking) - [ ] Investigate docker issues with config in Windows envs (May no longer be an issue with WSL2) - (Blocking) - [ ] Allow for starting audio with a external connection by default (So that lavalink can be a separate image) - (Blocking) - [ ] Disallow JSON as the default driver on docker setups? - [ ] Docker image and automatic image builds (Nightly and release builds) - (Blocking) - [ ] Docker docs - (Desired, but can be initially marked for "Experienced users") - [ ] Support Squad "training" - (Blocking) - [ ] Docker Image **MUST** support all approved cogs. There's probably other things I'm forgetting, so feel free to mention it, please try to keep this issue as clean as possible thought. If you are a docker user are you aware of any issues currently?
tanasegabriel commented 2020-09-23 20:01:28 +02:00 (Migrated from github.com)

@Drapersniper I've been running Red in Docker (on ARM, because I hate myself) for quite a while. I basically bundle everything in the image, including my custom cogs.

It's pretty stable as it is IMO, but as this issue mentions, it could do with a bit of polishing. I could definitely do with the headless setup, I currently do printf "<instance_name>\n<path>\ny\n1\n" | redbot-setup to work my way around this.

However, the biggest inconvenience I have is that cogs specified under the load-cogs argument do not load on a fresh container with the instance data directory missing. This happens because core/settings.json does not exist. It is populated while starting up for the first time, but not loaded. A container restart solves the problem.

I tried fiddling with that file, but Red seems to be very fussy about knowing the last known system info (last_system_info key). This wasn't always the case, I think I first observed this when Python3.8 became a dependency, but the various changes to the permission system might be a safer bet.

I abandoned the idea of debugging this due to lack of time and because I mount my instance data for persistent storage.

Also, why would you prefer to have lavalink as a separate image? It is being downloaded automatically if it doesn't exist, upon the first boot. I know, it's the "docker way" to isolate everything, but I feel it is a core part of Red and not of much use outside of it (at least for me).

Apart from this, it's just minor things, like making sure everything is up to date, to avoid those pesky DMs because the container restarted / a newer image was pulled, but still contains an older version of red (I use watchtower and I rebuild upon newer base images being released). Nothing that an entrypoint script cannot help with!

This is exciting news though, I look forward to having official Docker support.

@Drapersniper I've been running Red in Docker (on ARM, because I hate myself) for quite a while. I basically bundle everything in the image, including my custom cogs. It's pretty stable as it is IMO, but as this issue mentions, it could do with a bit of polishing. I could definitely do with the headless setup, I currently do `printf "<instance_name>\n<path>\ny\n1\n" | redbot-setup` to work my way around this. However, the biggest inconvenience I have is that cogs specified under the `load-cogs` argument do not load on a fresh container with the instance data directory missing. This happens because `core/settings.json` does not exist. It is populated while starting up for the first time, but not loaded. A container restart solves the problem. I tried fiddling with that file, but Red seems to be very fussy about knowing the last known system info (`last_system_info` key). This wasn't always the case, I think I first observed this when Python3.8 became a dependency, but the various changes to the permission system might be a safer bet. I abandoned the idea of debugging this due to lack of time and because I mount my instance data for persistent storage. Also, why would you prefer to have `lavalink` as a separate image? It is being downloaded automatically if it doesn't exist, upon the first boot. I know, it's the "docker way" to isolate everything, but I feel it is a core part of Red and not of much use outside of it (at least for me). Apart from this, it's just minor things, like making sure everything is up to date, to avoid those pesky DMs because the container restarted / a newer image was pulled, but still contains an older version of red (I use `watchtower` and I rebuild upon newer base images being released). Nothing that an entrypoint script cannot help with! This is exciting news though, I look forward to having official Docker support.
vilgotf commented 2020-10-22 11:49:52 +02:00 (Migrated from github.com)

I maintain a minimal docker (container) setup if you want inspiration:

I maintain a minimal docker (container) setup if you want inspiration:
Drapersniper commented 2020-10-22 11:51:10 +02:00 (Migrated from github.com)

We will be releasing an official Docker Image, which Phasecore will be working on with us in the near future.

The issue right now is not the dockerfile; It's getting Red itself to fully work on a container.

We will be releasing an official Docker Image, which Phasecore will be working on with us in the near future. The issue right now is not the dockerfile; It's getting Red itself to fully work on a container.
PhasecoreX commented 2020-11-24 17:46:07 +01:00 (Migrated from github.com)

When I occasionally get the chance to work on the Docker image, the main issue I keep running into is dealing with UIDs. Depending on what user the container process is running as, the config file can be located in different places. I think I need something where I can specify redbot --config-dir /config/dir or redbot --config-file /config/file.json in order to bypass all of that. A permission check would still need to exist I think, so this line can still be run, just skip the stuff before it.

I can make an issue for this if you want, but I also already see this comment on an issue already that is pretty close to what I want. If the config.json is per-instance instead of holding every instance, that would actually be very cool (no more redbot <instance>). A Docker container won't be running more than one instance anyway.

When I occasionally get the chance to work on the Docker image, the main issue I keep running into is dealing with UIDs. Depending on what user the container process is running as, the config file can be [located in different places](https://github.com/Cog-Creators/Red-DiscordBot/blob/08bd0567ad7010633beb4e3cf38d6cb4164cfa72/redbot/setup.py#L22). I think I need something where I can specify `redbot --config-dir /config/dir` or `redbot --config-file /config/file.json` in order to bypass all of that. A permission check would still need to exist I think, so [this line](https://github.com/Cog-Creators/Red-DiscordBot/blob/08bd0567ad7010633beb4e3cf38d6cb4164cfa72/redbot/setup.py#L29) can still be run, just skip the stuff before it. I can make an issue for this if you want, but I also already see [this comment](https://github.com/Cog-Creators/Red-DiscordBot/issues/2396#issuecomment-463882435) on an issue already that is pretty close to what I want. If the `config.json` is per-instance instead of holding every instance, that would actually be very cool (no more `redbot <instance>`). A Docker container won't be running more than one instance anyway.
Drapersniper commented 2020-11-24 17:57:27 +01:00 (Migrated from github.com)

When I occasionally get the chance to work on the Docker image, the main issue I keep running into is dealing with UIDs. Depending on what user the container process is running as, the config file can be located in different places. I think I need something where I can specify redbot --config-dir /config/dir or redbot --config-file /config/file.json in order to bypass all of that. A permission check would still need to exist I think, so this line can still be run, just skip the stuff before it.

I can make an issue for this if you want, but I also already see this comment on an issue already that is pretty close to what I want. If the config.json is per-instance instead of holding every instance, that would actually be very cool (no more redbot <instance>). A Docker container won't be running more than one instance anyway.

You are free to handle this as you see fit, one thing I not 1000% keen is the config being per instance. but if handled outside of Red I don't see an actual reason not to do this way.

One thing to mention is I would actually want the docker image to have its own venv (tl:dr so cogs dont mess with the primary python install).

> When I occasionally get the chance to work on the Docker image, the main issue I keep running into is dealing with UIDs. Depending on what user the container process is running as, the config file can be [located in different places](https://github.com/Cog-Creators/Red-DiscordBot/blob/08bd0567ad7010633beb4e3cf38d6cb4164cfa72/redbot/setup.py#L22). I think I need something where I can specify `redbot --config-dir /config/dir` or `redbot --config-file /config/file.json` in order to bypass all of that. A permission check would still need to exist I think, so [this line](https://github.com/Cog-Creators/Red-DiscordBot/blob/08bd0567ad7010633beb4e3cf38d6cb4164cfa72/redbot/setup.py#L29) can still be run, just skip the stuff before it. > > I can make an issue for this if you want, but I also already see [this comment](https://github.com/Cog-Creators/Red-DiscordBot/issues/2396#issuecomment-463882435) on an issue already that is pretty close to what I want. If the `config.json` is per-instance instead of holding every instance, that would actually be very cool (no more `redbot <instance>`). A Docker container won't be running more than one instance anyway. You are free to handle this as you see fit, one thing I not 1000% keen is the config being per instance. but if handled outside of Red I don't see an actual reason not to do this way. One thing to mention is I would actually want the docker image to have its own venv (tl:dr so cogs dont mess with the primary python install).
PhasecoreX commented 2020-11-24 19:17:51 +01:00 (Migrated from github.com)

Doesn't redbot already install cog dependencies into $DATA_DIR/cogs/Downloader/lib? The idea was to have redbot be installed when building the image, I thought. Redbot in the docker image won't have the ability to modify system python anyway.

Doesn't redbot already install cog dependencies into `$DATA_DIR/cogs/Downloader/lib`? The idea was to have redbot be installed when building the image, I thought. Redbot in the docker image won't have the ability to modify system python anyway.
Drapersniper commented 2020-11-24 19:21:37 +01:00 (Migrated from github.com)

Good point I completely forgot about downloader putting the dependencies in a separate lib.

When I said primary python install I mean the container python so there's no conflicts when installing/updating cogs but due to that being in its own lib folder that's not a valid concern.

Good point I completely forgot about downloader putting the dependencies in a separate lib. When I said primary python install I mean the container python so there's no conflicts when installing/updating cogs but due to that being in its own lib folder that's not a valid concern.
Sign in to join this conversation.
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot#4160
No description provided.