How can I expose apprise on another port?
I use a custom docker macvlan network and I'm trying to find where I can change the default port 8000 to 80, any help? thank you, amazing project
I'm not sure about docker macvlan, but just re-map the port you want when you call your docker:
# The below maps the internal 8000 to your external port 8000
docker run --name apprise \
-p 8000:8000 \
-e PUID=$(id -u) \
-e PGID=$(id -g) \
-e APPRISE_STATEFUL_MODE=simple \
-e APPRISE_WORKER_COUNT=1 \
-v /etc/apprise:/config \
-d apprise/local:latest
# What you're asking for is just a slight tweak to the same call:
-p 80:8000 \
-e PUID=$(id -u) \
-e PGID=$(id -g) \
-e APPRISE_STATEFUL_MODE=simple \
-e APPRISE_WORKER_COUNT=1 \
-v /etc/apprise:/config \
-d apprise/local:latest
See here
thank you for joining @caronc, port mapping is not available with macvlan driver
I would suggest switching to something that will map it for you then. Alternatively you can leverage iptables. Here is how to do it (taken from ChatGPT):
You can use the nat table’s PREROUTING chain to redirect incoming TCP traffic from port 8000 to port 8080. For example, run:
sudo iptables -t nat -A PREROUTING -p tcp --dport 8000 -j REDIRECT --to-port 8080
Explanation
-t nat: Specifies the NAT table.-A PREROUTING: Appends the rule to the PREROUTING chain (which is used for altering packets as soon as they come in).-p tcp: Applies the rule to TCP packets.--dport 8000: Matches packets destined for port 8000.-j REDIRECT: Jumps to the REDIRECT target, which alters the destination port.--to-port 8080: Redirects the traffic to port 8080.
Note
-
If you’re redirecting traffic generated on the local machine (i.e., originating from the same host), you might need to use the OUTPUT chain:
sudo iptables -t nat -A OUTPUT -p tcp --dport 8000 -j REDIRECT --to-port 8080 -
Remember that iptables rules are not persistent across reboots by default. To save them, you might need to use tools like
iptables-saveor configure your distribution’s firewall persistence service.
unfortunately the iptables rules in the host net namespace are irrelevant when using the macvlan driver, because the packet never passes through the host net namespace. Thus the option to change the default port would come very handy
Are you sure you need to use a macvlan connection? That's a layer 2/3 thing and has little to do with an IP address/port pair, which is layer 4 (ish!)
Docs: https://docs.docker.com/engine/network/drivers/macvlan/
Apprise really does not need its own MAC address. The one I've just deployed goes through three proxies and two TLS changes and still works. To be fair one of the proxies is the built in nginx 8)
thank you for joining the discussion @gerdesj I'm absolutely sure that my network configuration needs docker to use macvlan drivers, and port mapping is not available with macvlan driver. So it would indeed be useful to be able to change the default port as usually possible with many other services
Added HTTP_PORT as an environment variable which should allow you to accomplish what you want:
Example:
mkdir -p config
# The following starts the container on the internal port 80
docker run --name apprise-dev \
-p 80:80 \
-e PUID=$(id -u) \
-e PGID=$(id -g) \
-e HTTP_PORT=80 \
-e APPRISE_STATEFUL_MODE=simple \
-e APPRISE_WORKER_COUNT=1 \
-v ./config:/config \
-d caronc/apprise:edge