Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-compose SUBSPACE_IPV4_POOL= ignored? #158

Open
eroper opened this issue Feb 22, 2021 · 3 comments · May be fixed by #196
Open

docker-compose SUBSPACE_IPV4_POOL= ignored? #158

eroper opened this issue Feb 22, 2021 · 3 comments · May be fixed by #196

Comments

@eroper
Copy link

eroper commented Feb 22, 2021

After providing SUBSPACE_IPV4_POOL as a docker-compose environment variable, I'm still ending up with peers defined in the default 10.99.98.3 space. Is this expected behavior?

version: "3.3"
services:
  subspace:
   image: eroper/subspace:latest
   container_name: subspace
   volumes:
    - /subspace-data:/data
   restart: always
   environment:
    - SUBSPACE_HTTP_HOST=somehost.example.com
    - SUBSPACE_LETSENCRYPT=true
    - SUBSPACE_HTTP_INSECURE=false
    - SUBSPACE_HTTP_ADDR=":80"
    - SUBSPACE_NAMESERVER=X.X.X.X
    - SUBSPACE_LISTENPORT=XXXXX
    - SUBSPACE_IPV4_POOL=192.168.198.0/24
    - SUBSPACE_IPV6_POOL=fd00::10:97:0/64
    - SUBSPACE_IPV4_GW=192.168.198.1
    - SUBSPACE_IPV6_GW=fd00::10:97:1
    - SUBSPACE_IPV6_NAT_ENABLED=1
   cap_add:
    - NET_ADMIN
   network_mode: "host"
[Interface]
PrivateKey = XXXX
ListenPort = XXXXX

[Peer]
PublicKey =XXXX
AllowedIPs = 10.99.97.3/32,fd00::10:97:3/128
@DerDanilo
Copy link

I can confirm that this doesn't seem to work. The gateway and DNS server target seems okay though (wireguard server as single dns server).

@1F916
Copy link

1F916 commented Mar 13, 2021

I could confirm this in testing with and without docker-compose.
Based on this line in "handlers.go" it looks like the actual subspace program is looking for an environment variable named "SUBSPACE_IPV4_PREF" instead of "SUBSPACE_IPV4_POOL". It worked in my tests when I set something like "SUBSPACE_IPV4_PREF=192.168.198.".
You still need to keep the "SUBSPACE_IPV4_POOL" variable though, because "entrypoint.sh" sets iptables rules based on that.

The following docker-compose.yml worked fine for me:

version: "3.3"
services:
  subspace:
   image: subspacecommunity/subspace:latest
   container_name: subspace
   volumes:
    - /opt/docker/subspace:/data
   restart: always
   environment:
    - SUBSPACE_HTTP_HOST=wireguard.example.com
    - SUBSPACE_LETSENCRYPT=true
    - SUBSPACE_HTTP_INSECURE=false
    - SUBSPACE_HTTP_ADDR=":80"
    - SUBSPACE_NAMESERVERS=1.1.1.1,8.8.8.8
    - SUBSPACE_LISTENPORT=51820
    - SUBSPACE_IPV4_POOL=192.168.201.0/24
    - SUBSPACE_IPV4_PREF=192.168.201.
    - SUBSPACE_IPV4_CIDR=24
    - SUBSPACE_IPV4_GW=192.168.201.1
    - SUBSPACE_IPV6_NAT_ENABLED=0
   cap_add:
    - NET_ADMIN
   network_mode: "host"

@1F916
Copy link

1F916 commented Mar 13, 2021

Upon further investigation, this line in "entrypoint.sh" basically sets the correct "SUBSPACE_IPV4_PREF" whenever "SUBSPACE_IPV4_GW" is left empty. So providing "SUBSPACE_IPV4_GW" basically leads to "SUBSPACE_IPV4_POOL" getting ignored in the main program, because the "SUBSPACE_IPV4_PREF" variable it expects is never set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants