revenz / Fenrus

A personal home page for quick access to all your personal apps/sites.
MIT License
505 stars 29 forks source link

change port does not work? #199

Closed dft601 closed 11 months ago

dft601 commented 12 months ago

Hi sorry, I am really new to docker and container. So if I set up Fenrus in normal way, I do not get connection to some applications.... Don't know why, as told I am to new in this. My thought as solution for that is to set up Fenrus to host network instead of bridge... But Port 3000 is already used... so I tried in docker compose as described:

environment:
      - TZ=Europe/Berlin
      - Port=3333

But it seems that it is not recognized.

Starting Fenrus at http://+:3000
fenrus  | Starting Fenrus...
fenrus  | 2023-08-28 08:03:53.2900 [INF] => Starting worker: CalendarEventWorker
fenrus  | 2023-08-28 08:03:53.3339 [INF] => Starting worker: MailWorker
fenrus  | 2023-08-28 08:03:53.3372 [INF] => Fenrus v23.08.3.994 started
fenrus  | Unhandled exception. System.IO.IOException: Failed to bind to address http://[::]:3000: address already in use.
fenrus  |  ---> Microsoft.AspNetCore.Connections.AddressInUseException: Address already in use

Mike

pippo73 commented 12 months ago

I don't know if you start the server using composer or the CLI. Here is my composer file

services:
  fenrus:
    image: revenz/fenrus
    container_name: fenrus
    environment:
      - TZ=Europe/Rome
    volumes:
      - /home/user/Ferrus/data:/app/data
    ports:
      - 3002:3000
    restart: unless-stopped

As you can see, since the 3000 port on my server is already busy, I switch the default port of the container (3000) to a free port of my server (3002)

in order to connect I use http://ip.of.the.server:3002

Hope this is what you need BTW, if you use discord, maybe you can have a faster reply for this kind of things ;-)

if you start by CLI


docker run -d \
--name=Fenrus \
-e TZ=Europe/Rome \
-p 3002:3000 \
-v /home/user/Ferrus/data:/app/data \
--restart unless-stopped \
revenz/fenrus:latest
dft601 commented 12 months ago

Hi I will have a look into discord...

But no, this does not help... this was the first thing I did... okay for all apps running on the host. All my containers which are also "bridged" in this way do not show data in fenrus, because they cannot be reached. For example:
Sabnzbd is on http://192.168.178.55:9292/ It is also in a docker container "bridged" p 8080:9292 I can open the link from Fenrus, but I cannot show the additional data. In properties it shows: "Test failed" Emby is running directly on the host as: http://192.168.178.55:9292/ In Fenrus it is reachable and shows pictures and so on...

That´s why I also tried to use Fenrus as
network_mode: host With another port than 3000, because this is already used...

Okay, I will change the Port of AdGuardHome which blocks port 3000 at the moment...

Mike

pippo73 commented 12 months ago

Whait a sec. Let's do a step by step support :-) 1) how do you run fenrus? with docker command line or with docker composer? 2) could you post here the exact command or the yaml file you use? 3) could you post here the output?

dft601 commented 12 months ago

Thanks.

1) I have a QNAP NAS. I run it from "Container Station" and I use a self created YAML file for mostly all containers. They almost all run in "bridged" mode and are accessible from my home network on different ports of the NAS. (some on a static IP like IOBROKER)

2) yes sure:

First I had this:

version: "3"
services:
  fenrus:
    image: revenz/fenrus
    container_name: fenrus
    environment:
      - TZ=Europe/Berlin
    volumes:
      - /share/Container/docker/fenrus:/app/data
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - 3333:3000
    restart: unless-stopped 

The normal way.... and there I cannot reach the other bridget docker containers... Tdarr, Sabnzbd,.... I can open them , but I do not get the additional Information.

So I tried with network_mode: host and added in the environment the Port=3333, as described here....

Note: You can customise the port used by using the environmental variable "Port"

-e Port=1234

so:

version: "3"
services:
  fenrus:
    image: revenz/fenrus
    network_mode: host
    container_name: fenrus
    environment:
      - TZ=Europe/Berlin
      - Port=3333
    volumes:
      - /share/Container/docker/fenrus:/app/data
      - /var/run/docker.sock:/var/run/docker.sock
    restart: unless-stopped

3) And when I do this it conflicts with port 3000 on my NAS (used by AdGuardHome) That´s what I posted in first post...

Starting Fenrus at http://+:3000
fenrus  | Starting Fenrus...
fenrus  | 2023-08-28 08:03:53.2900 [INF] => Starting worker: CalendarEventWorker
fenrus  | 2023-08-28 08:03:53.3339 [INF] => Starting worker: MailWorker
fenrus  | 2023-08-28 08:03:53.3372 [INF] => Fenrus v23.08.3.994 started
fenrus  | Unhandled exception. System.IO.IOException: Failed to bind to address http://[::]:3000: address already in use.
fenrus  |  ---> Microsoft.AspNetCore.Connections.AddressInUseException: Address already in use

It seems that Port=3333 is ignored....

Now when I 15 minutes ago changed the port of AdGuardHome to 3001 , Fenrus runs on port 3000 and now I also have a connection to SabNzbd and so on...

pippo73 commented 12 months ago

I don't know how your QNAP system works but i do some supposition If you want, you could try with

version: "3"
services:
  fenrus:
    image: revenz/fenrus
    container_name: fenrus
    network_mode: host
    environment:
      - TZ=Europe/Berlin
    volumes:
      - /share/Container/docker/fenrus:/app/data
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - 3333:3000
    restart: unless-stopped

Personally I did not understood what should do the environment: - Port=3333 do, but maybe you could try this one. Just remember that It takes some time to update the data on the widgets (I had a similar problem and I don't use the "host" option)

if you have access to the shell of your NAS you can see the log of the docker with the following command

sudo docker logs --follow fenrus

It will give the chance to see what happens in realtime

otherwise let see what says @revenz ...

dft601 commented 12 months ago

Hi Pippo,

thanks.

 ports:
      - 3333:3000

This has no effect, when you have network in host mode. I read some documentation... ( I also tried)

The environment: - Port=3333 should change the standard Port of Fenrus.... As I told it is described here on the main page under section "Docker"

I can see all logs in the container station.... That´s where I got the log... But your command also works...

As described I had the problem that Fenrus does not react to the environment variable. So it stays on Port 3000 which gives the conflict with my AdGuardHome on Port 3000.

And that´s what I wanted to tell... Fenrus does not react to environment: Port

Mike

pippo73 commented 12 months ago

ok, I surrender... let see what @revenz says tonight ;-)

revenz commented 12 months ago

Well looking at the docker-entrypoint.sh, which is the entry point of the file, it should use the environmental variable PORT , uppercase. and read that value.

Also if that doesnt work, docker you can override the entrypoint, so you could customize the entry point to

dotnet Fenrus.dll --urls=http//+:3333
dft601 commented 12 months ago

Thanks, sorry, I do not know anything about entrypoints....

But your suggestion helped.... all uppercase

environment:
      - PORT=3333

this works...

So please change your explanation on main page.

Note: You can customise the port used by using the environmental variable "Port"

-e Port=1234

And thanks four your good work! Mike

revenz commented 11 months ago

updated readme