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

💡 Feature request: Add option to disable IPV6 #296

Open
broizter opened this issue Oct 19, 2024 · 9 comments · May be fixed by #307
Open

💡 Feature request: Add option to disable IPV6 #296

broizter opened this issue Oct 19, 2024 · 9 comments · May be fixed by #307
Labels
enhancement New feature or request

Comments

@broizter
Copy link

broizter commented Oct 19, 2024

Currently redlib will not start on a host where IPV6 is disabled. I would like to see an environment variable to disable binding to ipv6.

error binding to [::]:8080: error creating server listener: Address family not supported by protocol (os error 97)
@broizter broizter added the enhancement New feature or request label Oct 19, 2024
@Tokarak
Copy link
Contributor

Tokarak commented Oct 20, 2024

Meanwhile, you can work around by binding to 0.0.0.0:8080, which is all ipv4 addresses.

@broizter
Copy link
Author

Meanwhile, you can work around by binding to 0.0.0.0:8080, which is all ipv4 addresses.

I could only find an option to chose the port to bind to, not address. How do you define what address to bind to?

@Tokarak
Copy link
Contributor

Tokarak commented Oct 20, 2024

     Running `/Users/tok/.cargo/cache/release/redlib --help`
Private front-end for Reddit written in Rust

Usage: redlib [OPTIONS]

Options:
  -r, --redirect-https
          Redirect all HTTP requests to HTTPS (no longer functional)
  -a, --address <ADDRESS>
          Sets address to listen on [default: [::]]
  -p, --port <PORT>
          Port to listen on [env: PORT=] [default: 8080]
  -H, --hsts <EXPIRE_TIME>
          HSTS header to tell browsers that this site should only be accessed over HTTPS [default: 604800]
      --no-https-verification <no-https-verification>
          Disables HTTPS certificate verification between the instance and reddit. This can be useful to debug the HTTPS connection with an HTTPS sniffer. Only works when the 'no-https-verification' feature is enabled at compile time.
  -h, --help
          Print help
  -V, --version
          Print version

to pass options to the binary through cargo:
cargo run -- --help

@broizter
Copy link
Author

broizter commented Oct 20, 2024

Is it possible to pass that command line option through docker without modifying the dockerfile itself? When adding it like I usually would I get an error

Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "-a": executable file not found in $PATH: unknown

@Tokarak
Copy link
Contributor

Tokarak commented Oct 20, 2024

You need to change the Docker Compose file, not the Dockerfile. I haven't actually used the release container image.

@broizter
Copy link
Author

broizter commented Oct 20, 2024

I tried

command:
  - "-a 0.0.0.0"

and

command:
  - "-a"
  -  "0.0.0.0"

in my compose.yaml neither of them worked. It gave me the error message I attached in previous post.

@Tokarak
Copy link
Contributor

Tokarak commented Oct 20, 2024

You're right, I checked the compose and Dockerfile. Everything is hardcoded in the Dockerfile. This should be changed. The cli flags should be specified in the compose file rather than in the Dockerfile. This could go in a new issue.

As to resolve your issue: maybe ipv6 can be disabled in docker or in the container? Check the Network sections of the compose file.

@broizter
Copy link
Author

broizter commented Oct 20, 2024

I managed to make it work now. The correct thing to add to your compose file is:

command:
  - "/usr/local/bin/redlib"
  - "-a"
  - "0.0.0.0"

I will leave this issue open though because I think there should be an environment variable in the same way there is one for what port to bind to.

@Tokarak
Copy link
Contributor

Tokarak commented Oct 21, 2024

Nice! It's strange that the default compose.yml doesn't have a "command" section, though.

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

Successfully merging a pull request may close this issue.

2 participants