donaldzou / WGDashboard

Simple dashboard for WireGuard VPN written in Python w/ Flask
Apache License 2.0
1.22k stars 175 forks source link

Docker image #272

Open enriluis opened 1 month ago

enriluis commented 1 month ago

Is your feature request related to a problem? Please describe. This project should have a Docker image and be able to be deployed in Docker. docker pull wgdashboard and pass env mount vol integrate with wireguard container Describe the solution you'd like A clear and concise description of what you want to happen.

DaanSelen commented 3 weeks ago

https://hub.docker.com/r/donaldzou/wgdashboard/

Is this not what you mean? I will also try to make one with the new version of WGDash.

DaanSelen commented 3 weeks ago

If possible please assign me

donaldzou commented 3 weeks ago

Hi all! Thank you for bringing this up. Not gonna lie I'm not a Docker user or an expert at all (i tried but failed) lol. If you have a good solution please let me know. I'm happy to provide help as I can :)

donaldzou commented 3 weeks ago

https://hub.docker.com/r/donaldzou/wgdashboard/

Is this not what you mean? I will also try to make one with the new version of WGDash.

Yes this is what I meant i tried lol. Everytime when it restart, everything will just be gone, I couldn't figure out how to preserve data from previous session.

DaanSelen commented 3 weeks ago

https://hub.docker.com/r/donaldzou/wgdashboard/ Is this not what you mean? I will also try to make one with the new version of WGDash.

Yes this is what I meant i tried lol. Everytime when it restart, everything will just be gone, I couldn't figure out how to preserve data from previous session.

Please can you provide the information: Where is the data regarding matching peers from the wg0.conf to actual readable names stored by WireGuard Dashboard? Other than that, I have a functioning container. Doing some more devving. Persistency seems to work now.

donaldzou commented 3 weeks ago

Hi!👋🏻

So usually WireGuard will read the configuration at /etc/wireguard and it will use the file name as the configuration name. In some rare case it will generate a config name. So the dashboard will just read those file directly to get the data.

Best, Donald

Get Outlook for iOShttps://aka.ms/o0ukef


From: dselen @.> Sent: Wednesday, June 5, 2024 4:44:40 AM To: donaldzou/WGDashboard @.> Cc: Donald Zou @.>; Comment @.> Subject: Re: [donaldzou/WGDashboard] Docker image (Issue #272)

https://hub.docker.com/r/donaldzou/wgdashboard/ Is this not what you mean? I will also try to make one with the new version of WGDash.

Yes this is what I meant i tried lol. Everytime when it restart, everything will just be gone, I couldn't figure out how to preserve data from previous session.

Please can you provide the information: Where is the data regarding matching peers from the wg0.conf to actual readable names stored by WireGuard Dashboard? Other than that, I have a functioning container. Doing some more devving.

— Reply to this email directly, view it on GitHubhttps://github.com/donaldzou/WGDashboard/issues/272#issuecomment-2148385712, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGARNUMKGHTDFCKHFDULPJ3ZFYRLRAVCNFSM6AAAAABIIAGXTOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBYGM4DKNZRGI. You are receiving this because you commented.Message ID: @.***>

DaanSelen commented 3 weeks ago

Hi!👋🏻 So usually WireGuard will read the configuration at /etc/wireguard and it will use the file name as the configuration name. In some rare case it will generate a config name. So the dashboard will just read those file directly to get the data. Best, Donald Get Outlook for iOShttps://aka.ms/o0ukef ____ From: dselen @.> Sent: Wednesday, June 5, 2024 4:44:40 AM To: donaldzou/WGDashboard @.> Cc: Donald Zou @.>; Comment @.> Subject: Re: [donaldzou/WGDashboard] Docker image (Issue #272) https://hub.docker.com/r/donaldzou/wgdashboard/ Is this not what you mean? I will also try to make one with the new version of WGDash. Yes this is what I meant i tried lol. Everytime when it restart, everything will just be gone, I couldn't figure out how to preserve data from previous session. Please can you provide the information: Where is the data regarding matching peers from the wg0.conf to actual readable names stored by WireGuard Dashboard? Other than that, I have a functioning container. Doing some more devving. — Reply to this email directly, view it on GitHub<#272 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGARNUMKGHTDFCKHFDULPJ3ZFYRLRAVCNFSM6AAAAABIIAGXTOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBYGM4DKNZRGI. You are receiving this because you commented.Message ID: @.***>

What I meant, is WGDash seems to store the public key to readable name somewhere. Wireguard configs do not store that by default. Either WGDash comments it in the wg0.conf or there is a file somewhere that keeps track of the names of the public keys, correct? Right now I just did it through persisting the /src directory.

For current state of the container; https://github.com/DaanSelen/WGDashboard-dockerized/tree/main/docker You can also pull the image and run it from (temporarily) repo.nerthus.nl/app/wireguard-dashboard:latest (However this repo of mine is subject to change).

DaanSelen commented 3 weeks ago

Hello everyone! I have been working on the docker image and I feel good about releasing or at least making known its docker pull-able from my own registry. For now, please refer to the compose.yaml file for instructions. I will be working on the markdown file in that directory soon.

More info (such as the compose.yaml/docker-compose.yaml) and source-code here: https://github.com/DaanSelen/WGDashboard-dockerized/tree/main/docker

If you want to pull the image, use (for now) docker pull repo.nerthus.nl/app/wireguard-dashboard:latest.

Anyone willing to use or test the image, please give me feedback if you encounter something. You can always submit an issue on my forked repository or comment here.

@donaldzou I am curious to what your opinion will be. Persistency works through Docker Volumes, which remembers the state of the application after restarts AND recreations of the entire container, as long as the volumes are references correctly. @ikidd If you still work with docker, and since you were the previous creator. Please review, if willing.

Kind regards, Daan Selen.

donaldzou commented 3 weeks ago

Hi!👋🏻 So usually WireGuard will read the configuration at /etc/wireguard and it will use the file name as the configuration name. In some rare case it will generate a config name. So the dashboard will just read those file directly to get the data. Best, Donald Get Outlook for iOShttps://aka.ms/o0ukef ____ From: dselen @.**> Sent: Wednesday, June 5, 2024 4:44:40 AM To: donaldzou/WGDashboard @.**> Cc: Donald Zou @.**>; Comment @.**> Subject: Re: [donaldzou/WGDashboard] Docker image (Issue #272) https://hub.docker.com/r/donaldzou/wgdashboard/ Is this not what you mean? I will also try to make one with the new version of WGDash. Yes this is what I meant i tried lol. Everytime when it restart, everything will just be gone, I couldn't figure out how to preserve data from previous session. Please can you provide the information: Where is the data regarding matching peers from the wg0.conf to actual readable names stored by WireGuard Dashboard? Other than that, I have a functioning container. Doing some more devving. — Reply to this email directly, view it on GitHub<#272 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGARNUMKGHTDFCKHFDULPJ3ZFYRLRAVCNFSM6AAAAABIIAGXTOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBYGM4DKNZRGI. You are receiving this because you commented.Message ID: @.***>

What I meant, is WGDash seems to store the public key to readable name somewhere. Wireguard configs do not store that by default. Either WGDash comments it in the wg0.conf or there is a file somewhere that keeps track of the names of the public keys, correct? Right now I just did it through persisting the /src directory.

For current state of the container; https://github.com/DaanSelen/WGDashboard-dockerized/tree/main/docker You can also pull the image and run it from (temporarily) repo.nerthus.nl/app/wireguard-dashboard:latest (However this repo of mine is subject to change).

Ahhh I see, currently everything is stored in a SQLite database under src/db/wgdashboard.db

donaldzou commented 3 weeks ago

Hi @DaanSelen ! Thank you for working on the docker image. I will test it in few days and get back to you. I'm not familiar with Docker, but in my imagination, the image should create a Linux system, install it somewhere that won't remove after pausing the image.. kinda like a VM but running in Docker? correct me if i'm wrong lol.

DaanSelen commented 3 weeks ago

Hi @DaanSelen ! Thank you for working on the docker image. I will test it in few days and get back to you. I'm not familiar with Docker, but in my imagination, the image should create a Linux system, install it somewhere that won't remove after pausing the image.. kinda like a VM but running in Docker? correct me if i'm wrong lol.

Hi there, some help to get everyone started:

If you have Docker and Docker Compose installed, skip to step: 4.

Here are the instructions:

  1. Install a Linux system, you can choose the distribution yourself. You can also emulate/virtualize it on Windows using VMware Player or Oracle VirtualBox.
  2. Install Docker on that Linux system, ref: https://docs.docker.com/engine/install/
  3. Once Docker is installed, you can if you can run the command docker compose
  4. Once that works, copy only the compose.yaml from my fork of your repository. Its in the repository's /docker folder, ref: https://github.com/DaanSelen/WGDashboard-dockerized/blob/main/docker/compose.yaml
  5. Change the values in the compose if you want some specific things, or one of the features I built into the container. I really hope my tips in the file itself will help! If not, please tell me.
  6. Make sure you are in the same directory as the compose.yaml file. Then fill in docker compose up -d (This executes the instructions I have precompiled for the interface, -d meaning --detached, a.k.a. in the background).
  7. You should see the container alive and preferably with a (healthy) (if all is working as intended) mark behind the name when you type docker ps
  8. Ports 10086 and 51820 are being used by that container, if you did not change them in the compose file.
  9. Checking persistency is done through the docker volume ls command, you should see two entries. conf and app, these are stored on the system at /var/lib/docker/volumes if I am not mistaken.

Hopefully you can manage with these instructions! And if you like the result, I'd love to help contribute my knowledge to this project!

For other willing to test the image, everyone can follow these above instructions. Kind regards, Daan Selen.

DaanSelen commented 3 weeks ago

Hi!👋🏻 So usually WireGuard will read the configuration at /etc/wireguard and it will use the file name as the configuration name. In some rare case it will generate a config name. So the dashboard will just read those file directly to get the data. Best, Donald Get Outlook for iOShttps://aka.ms/o0ukef ____ From: dselen @.**> Sent: Wednesday, June 5, 2024 4:44:40 AM To: donaldzou/WGDashboard @.**> Cc: Donald Zou @.**>; Comment @.**> Subject: Re: [donaldzou/WGDashboard] Docker image (Issue #272) https://hub.docker.com/r/donaldzou/wgdashboard/ Is this not what you mean? I will also try to make one with the new version of WGDash. Yes this is what I meant i tried lol. Everytime when it restart, everything will just be gone, I couldn't figure out how to preserve data from previous session. Please can you provide the information: Where is the data regarding matching peers from the wg0.conf to actual readable names stored by WireGuard Dashboard? Other than that, I have a functioning container. Doing some more devving. — Reply to this email directly, view it on GitHub<#272 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGARNUMKGHTDFCKHFDULPJ3ZFYRLRAVCNFSM6AAAAABIIAGXTOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBYGM4DKNZRGI. You are receiving this because you commented.Message ID: @.***>

What I meant, is WGDash seems to store the public key to readable name somewhere. Wireguard configs do not store that by default. Either WGDash comments it in the wg0.conf or there is a file somewhere that keeps track of the names of the public keys, correct? Right now I just did it through persisting the /src directory. For current state of the container; https://github.com/DaanSelen/WGDashboard-dockerized/tree/main/docker You can also pull the image and run it from (temporarily) repo.nerthus.nl/app/wireguard-dashboard:latest (However this repo of mine is subject to change).

Ahhh I see, currently everything is stored in a SQLite database under src/db/wgdashboard.db

I will see what I can do for trimming down the used space.

DaanSelen commented 2 weeks ago

Image can be closed, right @enriluis ?