natankeddem / bale

ZFS Snapshot Browser Based GUI
30 stars 2 forks source link

Cant change port #3

Closed Yakrel closed 3 weeks ago

Yakrel commented 1 month ago

Hi, I did change port to 8181 but looks like bale still running on 8080,

Here is my docker compose file

networks:
  infrastructure:
    name: infrastructure
    external: true

services:
  bale:
    image: ghcr.io/natankeddem/bale:latest
    container_name: bale
    ports:
      - 8181:8181
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ${BALE_CONFIG}:/app/config
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - VERBOSE_LOGGING=TRUE
    networks:
      - infrastructure
    restart: unless-stopped
    logging:
      driver: "json-file"
      options:
        max-size: "10M"
        max-file: "2"

and here my logs

docker logs bale 
+ PUID=1000
+ PGID=1000
+ [[ 1000 =~ ^[0-9]+$ ]]
+ [[ 1000 =~ ^[0-9]+$ ]]
+ getent group 1000
+ groupadd -g 1000 appgroup
+ useradd --create-home --shell /bin/bash --uid 1000 --gid 1000 appuser
+ mkdir -p /app/mpl
+ chown -R appuser:appgroup /app
+ mkdir -p /home/appuser/.ssh
+ chown appuser:appgroup /home/appuser/.ssh
+ cp /etc/skel/.bashrc /home/appuser/.bashrc
+ chown appuser:appgroup /home/appuser/.bashrc
+ export HOME=/home/appuser
+ HOME=/home/appuser
+ '[' -d /usr/share/fonts ']'
+ chmod -R 777 /usr/share/fonts
+ '[' -d /var/cache/fontconfig ']'
+ chmod -R 777 /var/cache/fontconfig
+ '[' -d /usr/local/share/fonts ']'
+ chmod -R 777 /usr/local/share/fonts
+ exec setpriv --reuid=1000 --regid=1000 --init-groups python main.py
2024-10-23 08:29:36,680-WARNING-mylogging-1::mylogging|115:: ***Verbose Logging Started***
2024-10-23 08:29:36,680-WARNING-__main__-1::main|8:: Could not find 'data' directory, verify bind mounts.
2024-10-23 08:29:36,681-WARNING-__main__-1::main|13:: Creating 'data' directory, settings will not be persistent.
Starting bale, bound to the following addresses http://172.18.0.6:8080, http://localhost:8080.
natankeddem commented 1 month ago

Hi @Yakrel, The internal port bale runs on is static and doesn't have any mechanism to change currently. Although that shouldn't be necessary. I think you can change ports to 8181:8080 to accomplish what you want. See the following for reference: https://docs.docker.com/get-started/docker-concepts/running-containers/publishing-ports/

Yakrel commented 4 weeks ago

Sadly I need internal port to be changed too.

natankeddem commented 4 weeks ago

Hi @Yakrel , Can you describe your use case for this change? I am curious why you can't use the docker port remapping.

Yakrel commented 4 weeks ago

I have another app that using the ports and it is same as bale when I change port, it doesnt apply it, so I cant use both apps in same WM.

natankeddem commented 4 weeks ago

Are you utilizing docker or running bale in another configuration?

Yakrel commented 4 weeks ago

I am using both bale and other app via compose file so I am using docker.

natankeddem commented 4 weeks ago

Unless you can provide me a reason why you can't use the built in port remapping in Docker, I am hesitant to make any changes. This is a solved problem with Docker, we shouldn't be trying to reinvent the wheel. I can easily run multiple instances of bale in docker concurrently on different ports on the same host, you should be able to do the same with other applications:

version: "3.8"

services:
  balex:
    image: ghcr.io/natankeddem/bale:latest
    ports:
      - 8080:8080
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ~/path/to/data/baledatax:/app/data
      - ~/path/to/data/balelogsx:/app/logs
    environment:
      - PUID=1000
      - PGID=1000
      - VERBOSE_LOGGING=TRUE # Optional
  baley:
    image: ghcr.io/natankeddem/bale:latest
    ports:
      - 8181:8080
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ~/path/to/data/baledatay:/app/data
      - ~/path/to/data/balelogsy:/app/logs
    environment:
      - PUID=1000
      - PGID=1000
      - VERBOSE_LOGGING=TRUE # Optional
Yakrel commented 3 weeks ago

The problem is with the internal port, both application using same internal port so I have to choose between bale or other application to run.

natankeddem commented 3 weeks ago

Perhaps you can share your compose files and any errors you are getting. I just showed you multiple bale instances can run flawlessly on the same host and they obviously use the same non-published ports.

Codekloeppler commented 3 weeks ago

Hi @Yakrel,

for me, It seems that you misunderstand how docker containers are working. Unless bale and your other software are running inside the exact same container and have to be defined inside the Dockerfile for the image, this container is based on, your servers will never see the internal port of each other.

Defining two services inside of a docker-compose.yaml will create two containers - not one. They can only see the external port of the other!

So there will never be a conflict, even when two containers are using the same internal port, as long as they are mapped to different external ports.

Yakrel commented 3 weeks ago

Ty for your answers, yes I misunderstood it.