Skip to content

Commit c990bc6

Browse files
committedMay 14, 2024··
First attempt, let's see if it works
1 parent c91d4ed commit c990bc6

File tree

10 files changed

+306
-2
lines changed

10 files changed

+306
-2
lines changed
 

‎.github/ISSUE_TEMPLATE/bug-report.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Bug Report
3+
about: Something is broken!
4+
title: ''
5+
labels: bug
6+
assignees: PhasecoreX
7+
8+
---
9+
10+
<!--
11+
Before submitting a bug report, check to see if any of the following fixes your issue:
12+
13+
- Make sure you are using the most up-to-date image.
14+
- Try stopping the container, deleting the `venv` folder in `/data` (ONLY the `venv` folder!), and then restarting the container.
15+
16+
Thanks!
17+
-->
18+
19+
**Describe the bug**
20+
A clear and concise description of what the bug is.
21+
22+
**Run command**
23+
```
24+
The Docker command/docker-compose.yml you are using to start the dashboard (and redbot) container.
25+
Be sure to censor your bot token (or any other sensitive info) if it is present!
26+
```
27+
28+
**Environment info:**
29+
What system are you running Docker on?
30+
31+
**Additional context**
32+
Add any other context about the problem here. A more in-depth description, logs, screenshots, whatever.
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature Request
3+
about: I know how to make this image better!
4+
title: ''
5+
labels: enhancement
6+
assignees: PhasecoreX
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

‎.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
# Maintain dependencies for GitHub Actions
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "daily"
8+
groups:
9+
github-actions:
10+
patterns:
11+
- "*"

‎.github/workflows/build.yml

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- Dockerfile
9+
- .github/workflows/build.yml
10+
- root/**
11+
pull_request:
12+
branches:
13+
- main
14+
paths:
15+
- Dockerfile
16+
- .github/workflows/build.yml
17+
- root/**
18+
repository_dispatch:
19+
types:
20+
- upstream_image_update
21+
workflow_dispatch:
22+
23+
jobs:
24+
docker:
25+
runs-on: ubuntu-latest
26+
permissions:
27+
packages: write
28+
env:
29+
TITLE: Red-Dashboard
30+
GHCR_SLUG: ghcr.io/phasecorex/red-dashboard
31+
DOCK_SLUG: docker.io/phasecorex/red-dashboard
32+
steps:
33+
-
34+
name: Checkout
35+
uses: actions/checkout@v4
36+
-
37+
name: Docker meta
38+
id: meta
39+
uses: docker/metadata-action@v5
40+
with:
41+
images: |
42+
${{ env.GHCR_SLUG }}
43+
${{ env.DOCK_SLUG }}
44+
labels: |
45+
maintainer=${{ github.repository_owner }}
46+
org.opencontainers.image.vendor=${{ github.repository_owner }}
47+
org.opencontainers.image.title=${{ env.TITLE }}
48+
-
49+
name: Set up QEMU
50+
uses: docker/setup-qemu-action@v3
51+
-
52+
name: Set up Docker Buildx
53+
uses: docker/setup-buildx-action@v3
54+
-
55+
name: Login to GitHub Container Registry
56+
if: github.event_name != 'pull_request'
57+
uses: docker/login-action@v3
58+
with:
59+
registry: ghcr.io
60+
username: ${{ github.repository_owner }}
61+
password: ${{ secrets.GITHUB_TOKEN }}
62+
-
63+
name: Login to DockerHub
64+
if: github.event_name != 'pull_request'
65+
uses: docker/login-action@v3
66+
with:
67+
username: ${{ secrets.DOCKERHUB_USERNAME }}
68+
password: ${{ secrets.DOCKERHUB_TOKEN }}
69+
-
70+
name: Build and push
71+
uses: docker/build-push-action@v5
72+
with:
73+
platforms: |
74+
linux/amd64
75+
linux/arm/v7
76+
linux/arm64
77+
push: ${{ github.event_name != 'pull_request' }}
78+
tags: |
79+
${{ env.GHCR_SLUG }}:latest
80+
${{ env.DOCK_SLUG }}:latest
81+
cache-from: |
82+
${{ env.GHCR_SLUG }}:latest
83+
labels: ${{ steps.meta.outputs.labels }}
84+
-
85+
name: Check manifest
86+
if: github.event_name != 'pull_request'
87+
run: |
88+
docker buildx imagetools inspect ${{ env.GHCR_SLUG }}:latest
89+
docker buildx imagetools inspect ${{ env.DOCK_SLUG }}:latest
90+
-
91+
name: Check pull
92+
if: github.event_name != 'pull_request'
93+
run: |
94+
docker pull ${{ env.GHCR_SLUG }}:latest
95+
docker image inspect ${{ env.GHCR_SLUG }}:latest
96+
docker pull ${{ env.DOCK_SLUG }}:latest
97+
docker image inspect ${{ env.DOCK_SLUG }}:latest

‎Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM python:3.11-slim-bullseye as core-build
2+
3+
# Add PhasecoreX user-entrypoint script
4+
ADD https://raw.githubusercontent.com/PhasecoreX/docker-user-image/master/user-entrypoint.sh /bin/user-entrypoint
5+
RUN chmod +x /bin/user-entrypoint && /bin/user-entrypoint --init
6+
ENTRYPOINT ["/bin/user-entrypoint"]
7+
8+
VOLUME /data
9+
10+
COPY root/ /
11+
12+
CMD ["/app/start-reddash.sh"]
13+

‎README.md

+57-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,57 @@
1-
# docker-red-dashboard
2-
The newest Red-Web-Dashboard in a convenient container
1+
# Red-Dashboard
2+
The newest Red-Dashboard in a convenient multi-arch container
3+
4+
## Quick Start
5+
Follow the install instructions from [the official documentation](https://red-web-dashboard.readthedocs.io/en/latest/index.html), but start from the [Installing Companion Cog](https://red-web-dashboard.readthedocs.io/en/latest/configuration_guides/installing_companion_cog.html) step. Once you have made it to the "Running the Webserver" step, just run this container instead and link it to your [Red-DiscordBot](https://github.com/PhasecoreX/docker-red-discordbot) container:
6+
7+
```
8+
docker run -v /local_folder_for_persistence:/data --network=container:red-discordbot phasecorex/red-dashboard
9+
```
10+
11+
You will have to change the `red-discordbot` portion of the `--network` argument to be whatever the name is of your [Red-DiscordBot](https://github.com/PhasecoreX/docker-red-discordbot) container. Also make sure you're running Red-DiscordBot with the `--rpc` flag enabled.
12+
13+
## Docker-Compose
14+
15+
Here's an example docker-compose.yml with both Red-DiscordBot and Red-Dashboard:
16+
17+
```
18+
services:
19+
red-discordbot:
20+
image: phasecorex/red-discordbot:extra-audio
21+
container_name: red-discordbot
22+
restart: always
23+
volumes:
24+
- /local_folder_for_persistence/red-discordbot:/data
25+
environment:
26+
- TZ=America/Detroit
27+
- PUID=1000
28+
- EXTRA_ARGS=--rpc
29+
30+
red-dashboard:
31+
image: phasecorex/red-dashboard:latest
32+
container_name: red-dashboard
33+
restart: always
34+
network_mode: "service:red-discordbot"
35+
depends_on:
36+
- red-discordbot
37+
volumes:
38+
- /local_folder_for_persistence/red-dashboard:/data
39+
environment:
40+
- TZ=America/Detroit
41+
- PUID=1000
42+
```
43+
44+
Notice that the Red-DiscordBot container has an added `EXTRA_ARGS=--rpc` environment variable, and the dashboard container has `network_mode: "service:red-discordbot"`.
45+
46+
## Reverse Proxy
47+
48+
Since the dashboard is using the network mode of the Red-DiscordBot container, the dashboard will be accessible from `http://<red-discordbot-container-name>:42356`. Your reverse proxy will have to point at that URL to work, NOT the dashboard container! An example for Caddy in a container in the same network as the Red-DiscordBot container would be:
49+
50+
```
51+
your.domain.com {
52+
reverse_proxy <red-discordbot-container-name>:42356
53+
}
54+
```
55+
56+
## Non-Containerized Red-DiscordBot
57+
I don't really support it, but I think you would have to run the dashboard container in host networking mode? Not sure. Good luck!

‎root/app/functions/check-mount.sh

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env sh
2+
set -euf
3+
4+
# Ensure that /data is mounted with execute permissions
5+
MOUNT_OUTPUT=$(mount | grep " /data ")
6+
case "${MOUNT_OUTPUT}" in
7+
*noexec*)
8+
echo ""
9+
echo "ERROR"
10+
echo "Your /data mount does not allow execution, as the \"noexec\" flag is present:"
11+
echo ""
12+
echo "${MOUNT_OUTPUT}"
13+
echo ""
14+
echo "In order for this container to work correctly, either remove \"noexec\""
15+
echo "from the host mount options that /data is using (usually by editing"
16+
echo "the hosts /etc/fstab file), or choose a different location on the host"
17+
echo "for the /data volume that allows execution."
18+
exit 1
19+
;;
20+
esac

‎root/app/functions/setup-env.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env sh
2+
set -euf
3+
4+
# Remove old python venv if detected
5+
PYVERSION=$(realpath "$(command -v python)" | grep -o '[^/]*$')
6+
if [ ! -f "/data/venv/.pyversion" ] || [ "$(cat "/data/venv/.pyversion")" != "${PYVERSION}" ]; then
7+
rm -rf /data/venv
8+
mkdir -p /data/venv
9+
echo "${PYVERSION}" >"/data/venv/.pyversion"
10+
fi
11+
12+
# Prepare and activate venv
13+
echo "Activating Python virtual environment..."
14+
mkdir -p /data/venv
15+
python -m venv --upgrade --upgrade-deps /data/venv
16+
python -m venv /data/venv
17+
. /data/venv/bin/activate

‎root/app/functions/update-reddash.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env sh
2+
set -euf
3+
4+
# Make sure we are in the venv
5+
[ -n "${VIRTUAL_ENV:-}" ]
6+
7+
if [ -n "${CUSTOM_DASHBOARD_PACKAGE:-}" ]; then
8+
echo "WARNING: You have specified a custom Red-Web-Dashboard Pip install. Little to no support will be given for this setup."
9+
echo "Updating Red-Web-Dashboard with \"${CUSTOM_DASHBOARD_PACKAGE}\"..."
10+
python -m pip install --upgrade --upgrade-strategy eager --no-cache-dir wheel "${CUSTOM_DASHBOARD_PACKAGE}"
11+
echo "${CUSTOM_DASHBOARD_PACKAGE}" >"/data/venv/.reddashversion"
12+
else
13+
# Update dashboard
14+
DASHBOARD_PACKAGE_NAME="Red-Web-Dashboard${DASHBOARD_VERSION:-}"
15+
UPGRADE_STRATEGY=""
16+
if [ ! -f "/data/venv/.reddashversion" ] || [ "$(cat "/data/venv/.reddashversion")" != "${DASHBOARD_PACKAGE_NAME}" ]; then
17+
UPGRADE_STRATEGY="--upgrade-strategy eager"
18+
fi
19+
echo "Updating ${DASHBOARD_PACKAGE_NAME}..."
20+
# shellcheck disable=SC2086
21+
python -m pip install --upgrade ${UPGRADE_STRATEGY} --no-cache-dir wheel "${DASHBOARD_PACKAGE_NAME}"
22+
echo "${DASHBOARD_PACKAGE_NAME}" >"/data/venv/.reddashversion"
23+
fi

‎root/app/start-reddash.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env sh
2+
set -euf
3+
4+
# Perform mount check
5+
/app/functions/check-mount.sh
6+
7+
# Setup environment
8+
. /app/functions/setup-env.sh
9+
10+
# Update reddash if needed
11+
/app/functions/update-reddash.sh
12+
13+
# Start dashboard
14+
echo "Starting Red-Dashboard!"
15+
# shellcheck disable=SC2086
16+
reddash ${EXTRA_ARGS:-}

0 commit comments

Comments
 (0)
Please sign in to comment.