dani-garcia / vaultwarden

Unofficial Bitwarden compatible server written in Rust, formerly known as bitwarden_rs
GNU Affero General Public License v3.0
37.74k stars 1.83k forks source link

Health check failing when IPv6 enabled #3785

Closed Caros2017 closed 1 year ago

Caros2017 commented 1 year ago

I think I messed up with my pull request, so now I am making an issue for it.

Subject of the issue

When I enabled IPv6 I later realized that the healthcheck of the container was failing.

Setting ROCKET_ADDRESS=:: in docker-compose gives the error:

$ docker-compose up -d --build
services.vaultwarden.environment.13 must be a string

So to be able to use IPv6 ROCKET_ADDRESS needs to be set to ::0 ROCKET_ADDRESS=::0

In bash :: doesn't equal ::0 and hence my healthcheck is failing, since it isn't rewritten to localhost

Solution

In docker/healtcheck.sh change this:

if [ -z "${addr}" ] || [ "${addr}" = '0.0.0.0' ] || [ "${addr}" = '::' ]; then
    addr='localhost'
fi

To this:

if [ -z "${addr}" ] || [ "${addr}" = '0.0.0.0' ] || [ "${addr}" = '::0' ]; then
    addr='localhost'
fi
stefan0xC commented 1 year ago

You could also escape the string. I.e. if you use a YAML list, you can quote the whole line in your docker-compose.yml:

    environment:
      - 'ROCKET_ADDRESS=::'

Alternatively you could also specify the environment variables as a dictionary like this:

    environment:
      ROCKET_ADDRESS: "::"

Just be aware that docker-compose will interpret them differently, which is why I suggest you check your config with: docker-compose config.

Caros2017 commented 1 year ago

You could also escape the string. I.e. if you use a YAML list, you can quote the whole line in your docker-compose.yml:

    environment:
      - 'ROCKET_ADDRESS=::'

Alternatively you could also specify the environment variables as a dictionary like this:

    environment:
      ROCKET_ADDRESS: "::"

Just be aware that docker-compose will interpret them differently, which is why I suggest you check your config with: docker-compose config.

Thanks! Will use this instead!