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

[BUG] Hardcoded http port does not play nice with changing the bound port #599

Closed
Xeboc opened this issue Mar 12, 2024 · 5 comments
Closed
Labels
bug Something isn't working

Comments

@Xeboc
Copy link

Xeboc commented Mar 12, 2024

Describe the bug
A startup script uses a hard coded port to run the collector service once on startup:
https://github.com/AnalogJ/scrutiny/blob/master/rootfs/etc/services.d/collector-once/run#L10

This does not play nice with changing the port in the config file:
https://github.com/AnalogJ/scrutiny/blob/master/example.scrutiny.yaml#L21

And causes an endless wait state:

scrutiny  | scrutiny api not ready
scrutiny  | scrutiny api not ready
scrutiny  | scrutiny api not ready
...

Expected behavior
Changing the port in the config file is picked up by the startup script. Maybe an ENV parameter will cover this? Or the startup script can be disabled? Or multiple ports can be defined? Or...?

Screenshots
N/A

Log Files
N/A

@Xeboc Xeboc added the bug Something isn't working label Mar 12, 2024
@aidan-gibson
Copy link

In lots of places https://github.com/search?q=repo%3AAnalogJ%2Fscrutiny+8080+AND+NOT+path%3A*.md&type=code

Annoying bug would be trivial to patch, no time to do myself rn unfortunately.

@AnalogJ
Copy link
Owner

AnalogJ commented May 16, 2024

hm, can you help me understand the issue here?

That file is only used when running the collector in Docker. In which case you shouldn't need to update the port (instead just bind the external port to a different number -p 9090:8080

@aidan-gibson
Copy link

Oh sweet I'm crazy, it works! Sorry, I had tried this some months ago and changing the port in my docker compose wasn't successful, and I assumed this was the same issue without testing. Sorry about that! Lovely software, thanks a ton for making this!

@AnalogJ
Copy link
Owner

AnalogJ commented May 16, 2024

great! closing :)

@AnalogJ AnalogJ closed this as completed May 16, 2024
@Xeboc
Copy link
Author

Xeboc commented May 17, 2024

Not sure why my bug report was hijacked and closed here.

I don't use direct host networking running docker files (my default bridge is disabled) and instead assign an individual bridge subnet and separate IP addresses for each container. This allows for greater network isolation on a server running many docker images. The suggestion to simply bind the port doesn't work in my case, which is why I filed the bug report.

Given this docker-compose.yaml:

services:
  scrutiny:
    image: ghcr.io/analogj/scrutiny:master-omnibus
    container_name: scrutiny
    cap_add:
      - SYS_RAWIO
    volumes:
      - /run/udev:/run/udev:ro
      - ./config:/opt/scrutiny/config
      - ./influxdb:/opt/scrutiny/influxdb
    networks:
      network:
        ipv4_address: "172.18.1.2"
        aliases:
          - scrutiny
    ports:
      - "172.18.1.2:<any port>:8080"
    devices:
      - "/dev/sda"
    restart: always

networks:
  network:
    driver: bridge
    driver_opts:
      com.docker.network.bridge.name: br-scrutiny
    enable_ipv6: false
    ipam:
      driver: default
      config:
        - subnet: 172.18.1.0/24

Any port binding to the ip will fail:

Error response from daemon: driver failed programming external connectivity on endpoint
scrutiny (<container id>): Error starting userland proxy: listen tcp4 172.18.1.2:<any port>:
bind: cannot assign requested address

So I change the IP address in the configuration file, which works fine, except for the startup script uses a hard coded value, rather than reading it from the config file. I'm simply requesting that the startup script reads the port from the config file rather than be hard coded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants