Closed DaanSelen closed 2 weeks ago
Hi @DaanSelen thank you very much for working on this! I'm thinking I'll merge this to main once I merge my v4 to main, so I don't need to mess up my current changes :)
Thank you again.. There are few people been asking a Docker image for the dashboard but I have zero knowledge on it, so you did a big favour for me :)
Hi @DaanSelen thank you very much for working on this! I'm thinking I'll merge this to main once I merge my v4 to main, so I don't need to mess up my current changes :)
The current Docker image is for version 3.0.6.2, the image's Dockerfile copies the main branch of donaldzou/wgdashboard so once that's updated, the image will pull it. I can work on looking into the v4 image, but do you have a estimated release period/date?
I don't have a guaranteed timeline.. But if the docker image is pulling directly from Github, maybe it can do something like this:
update_wgd() {
new_ver=$(python3 -c "import json; import urllib.request; data = urllib.request.urlopen('https://api.github.com/repos/donaldzou/WGDashboard/releases/latest').read(); output = json.loads(data);print(output['tag_name'])")
printf "%s\n" "$dashes"
printf "| Are you sure you want to update to the %s? (Y/N): " "$new_ver"
read up
if [ "$up" = "Y" ]; then
printf "| Shutting down WGDashboard... |\n"
if check_wgd_status; then
stop_wgd
fi
mv wgd.sh wgd.sh.old
printf "| Downloading %s from GitHub... |\n" "$new_ver"
git stash > /dev/null 2>&1
git pull https://github.com/donaldzou/WGDashboard.git $new_ver --force > /dev/null 2>&1
printf "| Upgrading pip |\n"
python3 -m pip install -U pip > /dev/null 2>&1
printf "| Installing latest Python dependencies |\n"
python3 -m pip install -U -r requirements.txt > /dev/null 2>&1
printf "| Update Successfully! |\n"
printf "%s\n" "$dashes"
rm wgd.sh.old
else
printf "%s\n" "$dashes"
printf "| Update Canceled. |\n"
printf "%s\n" "$dashes"
fi
}
This is a function used in wgd.sh
to get the latest release tag aka version, and pull the specific version with git pull. Hope that could streamline the docker image's future proof
I don't have a guaranteed timeline.. But if the docker image is pulling directly from Github, maybe it can do something like this:
This does rely on the image updating itself, with Docker images, if you have a central registry then it is more centralized if you just pull the image again. You are right that in my current version this does not work correctly. Because the entire directory of /src is saved with docker. If you in the future separate the files that contain data in a directory I could instead only use that, but I don't know if thats easily done.
Ahh I see, I wonder how other docker images do an "update"? Maybe what we can do is force to check update every single time the docker image start? since it is just an "Ubuntu VM" (correct me if I'm wrong) and run the bash commands to do the update?
Ubuntu VM
Close! But it is a Debian VM, at least in the version I made. You can see that at the top of the file FROM debian:stable-slim
.
And what should be done (and can be done through GitHub actions) is to rebuild the image every interval
such as every week. So that every week the image is updated if the repository updates.
Using it that way, end-users don't have to go into the container and see if everything is still okay, we should centralize that from the registry and let the users just pull the new docker image and run it with the previous files needed to personalize the environment, such as the database and the .ini files.
Do you understand what I mean?
Ah I think any major distro should work, and yes that's a good idea :)
Ah I think any major distro should work, and yes that's a good idea :)
I myself am totally not familiar with GitHub and pull requests etc, but you could already merge this into the main (so I can fork it again) and then I can fork the 4.0 and start working on that already, now I am only allowed to have 1 fork of this repository without breaking GitHub's ToS. And then people have a way to use the current one.
If possible we can upload the compiled image to Docker Hub (right now its on my personal registry which is fine, but the uplink is only 100mbit).
Ah gotcha yeah for sure I'll do it now :)
Doneeeee ;)
Thanks forking v4 soon! If you want, can you give me an idea on which files WGDashboard needs to "remember", I've noticed its the wg-dashboard.ini file and you talked about a database file. Are there more? otherwise it can perhaps be done with only those 2 files (and the /etc/wireguard/wg0.conf). But feel free to submit issues on the docker container. I will pick those up!
For sure! I think besides those 2 files (db and dashboard config file), all .conf
under /etc/wireguard/
should be remember, just in case user will create multiple configuration.
I'll also explain for your knowledge what the Docker container does for 'saving' the data between containers. I have made it so the files get installed in /opt/wireguarddashboard/app
this creates your img
, src
directories in there. And for the persistency I added inside the docker-compose the directory app:/opt/wireguarddashboard/app
. You can see on the right of the :
the directory it creates a volume of.
But my problem is... its the entire directory, otherwise I have to create a line for each individual file which needs to be saved on the host. Which would not be too bad for 2 files, but you might have more in the future with more features, or who knows maybe even plugins!
Think of it like: there is a part which is generic, such as the dashboard.py
which can be replaced anytime with the latest version and the program would not care. And the part which is used to configure the personal settings, such as global_dns.
@donaldzou any plans to publish the image by your self? No offense to the great work of Daan but imho, in a safety perspective its a no go to let someone else build your docker images.
I'm pretty sure Daan or otherwise me, can help you to set up actions
where Github can build and publish your images automatically on new releases, to reduce any workload on each release.
Additional I got some other ideas as well to make it more customizable for the end user, such as entering some custom configs for Wireguard config instead of hard coded ones in the Docker file. It would be easier for and end user to adjust those values in docker-compose.yaml
directly rather than accessing the file.
I always welcome more features, please see what you can do. We all want to make it better!
I've been working on this Dockerfile and everything regarding it for this project and hope it is well received.
Referring Issue: https://github.com/donaldzou/WGDashboard/issues/272