perara / wg-manager

A easy to use WireGuard dashboard and management tool
MIT License
594 stars 74 forks source link

Adding autostart of wireguard server #14

Closed simonlerpard closed 4 years ago

simonlerpard commented 4 years ago

Fixes #13

Adding the option to automatically start the wireguard server when the docker container starts. It's possible to control which wireguard interface to actually start by specifying the environment variable AUTOSTART_INTERFACES with a comma-separated list of interfaces.

Also fixed a forgotten end-parentheses in the README table.

perara commented 4 years ago

Looks good. Did you test to include the startup sequence in /app/main.py instead of subprocess.call(["python3", "autostart.py"])? We could probably include this directly here https://github.com/perara/wg-manager/blob/master/wg_dashboard_backend/main.py#L69-L78 if you would care to do so :)

simonlerpard commented 4 years ago

I did overcomplicate it a bit... Thanks for bringing it up. And it turned out I found a few other things as well. And the reason why the current code actually didn't work as it was supposed to.

I'll close this pull request in favour of the implementation in #15 instead :)

perara commented 4 years ago

15 Looks good, I could not find this patch there. Does your changes fix #14?

simonlerpard commented 4 years ago

Yes, this one (#14) isn't needed because of #15.

15 doesn't however start the interface if the interface was stopped before the docker was stopped. It does only fix to keep the state upon restart, which was the actual issue in #13.

If you or anyone else would like to start an interface based on an ENV variable, that's another issue/task and should be fairly easy to implement :)