[v3] [wip] docker + docker-compose support #2273

Closed
calebj wants to merge 4 commits from v3/docker-compose into V3/develop
calebj commented 2018-10-29 04:49:25 +01:00 (Migrated from github.com)

Type

  • Bugfix
  • Enhancement
  • New feature

Description of the changes

Allows a user to spin up a Red instance by configuring .env and pressing go. The Red image is built in-tree, and the Lavalink container uses the official image. There is also a Dockerfile included for custom builds of the Lavalink image, but the jar must be provided.

Since the Audio cog must be loaded and connected to Lavalink to configure an external server (see #2335), an environment variable check had to be added. It's the simplest way to pass a default hostname through to the LL server connection settings.

TODO:

  • Include docs for non-x86 w/ alternate lib paths (sedmelluq/lavaplayer#137)
  • Use a regular volume OR store data in ~/.config like normal instances
### Type - [ ] Bugfix - [ ] Enhancement - [x] New feature ### Description of the changes Allows a user to spin up a Red instance by configuring `.env` and pressing go. The Red image is built in-tree, and the Lavalink container uses the official image. There is also a Dockerfile included for custom builds of the Lavalink image, but the jar must be provided. Since the Audio cog must be loaded and connected to Lavalink to configure an external server (see #2335), an environment variable check had to be added. It's the simplest way to pass a default hostname through to the LL server connection settings. ### TODO: - [ ] Include docs for non-x86 w/ alternate lib paths (sedmelluq/lavaplayer#137) - [ ] Use a regular volume OR store data in ~/.config like normal instances
Twentysix26 (Migrated from github.com) reviewed 2018-10-29 04:49:25 +01:00
SuperSandro2000 commented 2018-10-29 11:23:42 +01:00 (Migrated from github.com)

Similar approach #2163

Similar approach #2163
calebj commented 2019-02-01 16:33:51 +01:00 (Migrated from github.com)

Not so blocked anymore; this is open for testing and QA while I get documentation together.

Not so blocked anymore; this is open for testing and QA while I get documentation together.
mikeshardmind commented 2019-02-03 13:14:32 +01:00 (Migrated from github.com)

This is working on Linux Hosts (tested x86 and x64), and on Windows 10 hosts (tested x64)

I can't test on any other hosts currently.

This is working on Linux Hosts (tested x86 and x64), and on Windows 10 hosts (tested x64) I can't test on any other hosts currently.
palmtree5 commented 2019-02-03 22:27:11 +01:00 (Migrated from github.com)

I can confirm this works on a Windows 10 host, though I want to note that [p]shutdown just leads to the bot restarting automatically which could be unexpected

I can confirm this works on a Windows 10 host, though I want to note that `[p]shutdown` just leads to the bot restarting automatically which could be unexpected
calebj commented 2019-02-03 23:49:10 +01:00 (Migrated from github.com)

[...] though I want to note that [p]shutdown just leads to the bot restarting automatically which could be unexpected

The last commit is a tweak that lets you use --abort-on-container-exit in docker-compose to get the desired behavior. This'll be noted in the docs.

> [...] though I want to note that `[p]shutdown` just leads to the bot restarting automatically which could be unexpected The last commit is a tweak that lets you use `--abort-on-container-exit` in docker-compose to get the desired behavior. This'll be noted in the docs.
SuperSandro2000 commented 2019-02-04 07:54:11 +01:00 (Migrated from github.com)

@palmtree5 you can't stop anything I know from isnide a docker container.

I would set the restart policy of everything to:
restart: unless-stopped or you easily get sticky containers that can be hard to remove and if one of them errors shit can't just stop it and examine the issue or attach a console.

@palmtree5 you can't stop anything I know from isnide a docker container. I would set the restart policy of everything to: ``restart: unless-stopped`` or you easily get sticky containers that can be hard to remove and if one of them errors shit can't just stop it and examine the issue or attach a console.
Kowlin commented 2019-03-04 03:55:01 +01:00 (Migrated from github.com)

Out of curiosity, what's the status of this PR?

Out of curiosity, what's the status of this PR?
SuperSandro2000 commented 2019-03-04 07:51:02 +01:00 (Migrated from github.com)

I still have a problem with:

  • The restart policy
    A container could potentially loop with a start up crash and I think this is not a good suggestions.
  • The base image
    Debian offers no advantage over Alpine except increasing the image size. IIRC it was the only image that had jre >9 a couple of months ago but this got resolved. If we stick with Debian we just force the user to download about 60 MB more.
    Most popular pip packages have a previous alpine for all arches anyway.
  • The dist-upgrade command that is really really bad practice.
    Basically the user needs to download the core packages twice for no reason and it significantly increases the image size especially on the end of an image is life cycle.

@Kowlin you can basically use the images but you will probably need to download more data than necessary and need more storage space than necessary.
And look at the todo.
Edit: If you desperately need an image you can take a look at my old multi-arch one https://hub.docker.com/r/supersandro2000/reddiscord/

I still have a problem with: * The restart policy A container could potentially loop with a start up crash and I think this is not a good suggestions. * The base image Debian offers no advantage over Alpine except increasing the image size. IIRC it was the only image that had jre >9 a couple of months ago but this got resolved. If we stick with Debian we just force the user to download about 60 MB more. Most popular pip packages have a previous alpine for all arches anyway. * The dist-upgrade command that is really really bad practice. Basically the user needs to download the core packages twice for no reason and it significantly increases the image size especially on the end of an image is life cycle. @Kowlin you can basically use the images but you will probably need to download more data than necessary and need more storage space than necessary. And look at the todo. Edit: If you desperately need an image you can take a look at my old multi-arch one https://hub.docker.com/r/supersandro2000/reddiscord/
mikeshardmind commented 2019-03-04 08:15:20 +01:00 (Migrated from github.com)

restart: unless-stopped breaks the ability to shut down the bot from discord.
Currently possible using --abort-on-container-exit in compose

restart: on-failure makes sense for this use case.

`restart: unless-stopped` breaks the ability to shut down the bot from discord. Currently possible using `--abort-on-container-exit` in compose `restart: on-failure` makes sense for this use case.
SuperSandro2000 (Migrated from github.com) reviewed 2019-03-04 08:18:35 +01:00
@ -0,0 +1,23 @@
FROM python:3.7-slim-buster
SuperSandro2000 (Migrated from github.com) commented 2019-02-03 22:27:25 +01:00

Why are the linux headers and alpine sdk kept in the final image?

Why are the linux headers and alpine sdk kept in the final image?
SuperSandro2000 (Migrated from github.com) commented 2019-03-04 07:53:09 +01:00

Put the copy before the first run and combine them or your removal process hurts the image more than it helps.

Put the copy before the first run and combine them or your removal process hurts the image more than it helps.
@ -0,0 +1,25 @@
version: "3"
SuperSandro2000 (Migrated from github.com) commented 2019-03-04 07:56:45 +01:00

If you connect to the lavalink container from another docker container via lavalink you don't need to expose anything on the host.
We still need to consider that if those ports are used the container won't start.

If you connect to the lavalink container from another docker container via ``lavalink`` you don't need to expose anything on the host. We still need to consider that if those ports are used the container won't start.
SuperSandro2000 (Migrated from github.com) commented 2019-03-04 07:58:58 +01:00

You don't run a dist-upgrade in a docker container!!! Either upgrade a package you need to update or build a base image with the updated packages. You potentially create a >400mb diff here and ship those megabaytes twice to the user.

You don't run a dist-upgrade in a docker container!!! Either upgrade a package you need to update or build a base image with the updated packages. You potentially create a >400mb diff here and ship those megabaytes twice to the user.
SuperSandro2000 (Migrated from github.com) commented 2019-03-04 08:00:28 +01:00

After the build we can remove build essentials if they are not needed on run time and they get removed in the same RUN command.

After the build we can remove build essentials if they are not needed on run time and they get removed in the same RUN command.
SuperSandro2000 (Migrated from github.com) commented 2019-03-04 08:01:15 +01:00

I think that 3 retries are enough or the container build could be blocked for 1 or 2 minutes before it fails.

I think that 3 retries are enough or the container build could be blocked for 1 or 2 minutes before it fails.
SuperSandro2000 commented 2019-03-04 08:19:24 +01:00 (Migrated from github.com)

@mikeshardmind makes sense. We could argue a whole day about should you be able to but we don't need to.
But we could change the other containers. I just don't like container that start even if I shut them off manually.

@mikeshardmind makes sense. We could argue a whole day about should you be able to but we don't need to. But we could change the other containers. I just don't like container that start even if I shut them off manually.
SuperSandro2000 commented 2019-03-04 09:28:06 +01:00 (Migrated from github.com)

@calebj I did a quick branch with all my changes that I think are necessary before this can be merged over here. Feel free to merge or reuse them.

@calebj I did a quick branch with all my changes that I think are necessary before this can be merged over [here](https://github.com/SuperSandro2000/Red-DiscordBot/commits/docker). Feel free to merge or reuse them.
abelfodil commented 2019-10-18 09:28:19 +02:00 (Migrated from github.com)
https://github.com/abelfodil/Red-DiscordBot-Docker
Drapersniper commented 2019-10-18 09:50:31 +02:00 (Migrated from github.com)

https://github.com/abelfodil/Red-DiscordBot-Docker

This docker image has some things we wouldn’t want by default, the Prefix is set to “-“ and the mentionable flag is also set, one thing worth mentioning too is that’s JSON

> https://github.com/abelfodil/Red-DiscordBot-Docker This docker image has some things we wouldn’t want by default, the Prefix is set to “-“ and the mentionable flag is also set, one thing worth mentioning too is that’s JSON
Drapersniper commented 2019-12-10 10:32:17 +01:00 (Migrated from github.com)

Another thing worth flagging up is that Mongo is being depricated, and as such this should be updated to remove anything thats mongo specific (and possibly replace it with postgres)

Another thing worth flagging up is that Mongo is being depricated, and as such this should be updated to remove anything thats mongo specific (and possibly replace it with postgres)
Drapersniper commented 2020-07-06 20:40:33 +02:00 (Migrated from github.com)

@calebj is this something you are still actively working on or have you dropped this PR. asking to figure out wether to close and open an issue for Docker support or keep this open as you are working on it but haven't just pushed any changes.

@calebj is this something you are still actively working on or have you dropped this PR. asking to figure out wether to close and open an issue for Docker support or keep this open as you are working on it but haven't just pushed any changes.
Drapersniper commented 2020-07-23 11:29:44 +02:00 (Migrated from github.com)

Closing due to innactivity.

Note: Docker support is something we want, however for it to be implemented we require both educating SS as making is avaliable and documented would result in us actively supporting it. There is also other factors to consider here, but if anyone wishes to work on a full docker implementation by all means do so after talking to us in the main server about it (https://discord.gg/red)

Closing due to innactivity. Note: Docker support is something we want, however for it to be implemented we require both educating SS as making is avaliable and documented would result in us actively supporting it. There is also other factors to consider here, but if anyone wishes to work on a full docker implementation by all means do so after talking to us in the main server about it (<https://discord.gg/red>)
SuperSandro2000 commented 2020-07-23 14:53:25 +02:00 (Migrated from github.com)

educating SS

Not sure what this means but I hope not what google offered me.

> educating SS Not sure what this means but I hope not what google offered me.
yamikaitou commented 2020-07-23 14:54:05 +02:00 (Migrated from github.com)

SS as in Support Squad

SS as in Support Squad
Kowlin commented 2020-07-23 14:54:49 +02:00 (Migrated from github.com)

No it isn't, it refers to support squad, it's an bit of an unfortunate mixing of 2 acronyms

No it isn't, it refers to support squad, it's an bit of an unfortunate mixing of 2 acronyms

Pull request closed

Sign in to join this conversation.
No reviewers
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!2273
No description provided.