leonovk / wg-rest-api

WireGuard VPN + Easy REST API in one package
https://hub.docker.com/r/leonovk/wg-rest-api
MIT License
44 stars 6 forks source link

Installation problem #37

Closed TrustCane closed 4 months ago

TrustCane commented 4 months ago

Hi, please help me to solve my error during installation.

The first question I have is: "where to get<🚨YOUR_ADMIN_API_TOKEN>?". As I understand it I need to generate it myself and use it during connection?

But I catch the following error when I need to start docker: Executing the command:

docker run -d \
-e WG_HOST=<🚨YOUR_SERVER_IP> \
-e AUTH_TOKEN=<🚨YOUR_ADMIN_API_TOKEN> \
-e ENVIRONMENT=production
-v ~/.wg-rest:/etc/wireguard \
-p 51820:51820/udp \
-p 3000:3000 \
--cap-add=NET_ADMIN \
--restart unless-stopped \
wg-rest-api

And I get: docker: Error response from daemon: driver failed programming external connectivity on endpoint kind_snyder (72fe5f7700966dafdf220954b381df08e1732d714d93809f9e920cbc3803156e): Error starting userland proxy: listen udp4 0.0.0.0:51820: bind: address already in use. As I understand the error says that I already have 51820 port in use. But yes, it is, it's the same port that WireGuard runs on, for which I want to put your API. Please tell me what I'm doing wrong or how to solve the error.

leonovk commented 4 months ago

You can generate YOUR_ADMIN_API_TOKEN using any application for generating hashes, or simply set any value as a password. Essentially this will be the password for your API.

If you already have a working wireguard on your server. You need to change the port in the application launch settings by setting the WG_PORT environment variable. However, wg-rest-api does not need a running wireguard on your server. You just need to launch a container created from the image and everything will work, the wireguard is already inside the image, and all your clients will be mounted in your file system and you can reuse them as you please.

If you still can’t launch the application, write to me in telegram -> https://t.me/leonovk

leonovk commented 4 months ago

UPD, if you set a custom port for wireguard operation via an environment variable, do not forget to also map the ports

-p xxxx:xxxx/udp