Compare commits

...

3 Commits

Author SHA1 Message Date
idk
3c25e1f4ad change value of localhost in all config files before running the router, don't check the network prefix, just use dockerenv 2022-11-13 16:20:39 -05:00
idk
c190acc82e allow users to set the IP address where the console/apps are reachable 2022-10-10 10:38:05 -04:00
b877ed926a When running via docker-compose.yml file and in it mapping for example ...
"127.0.0.1:7656:7656"
    "127.0.0.1:7657:7657" ...
    so those ports are only available on 127.0.0.1 on the host, this does not work with the standard delivered startapp.sh. All i2p ports inside the container must listen on 0.0.0.0 to be reachable from the host (on 127.0.0.1). Also my i2p-docker-network is on 172.21.x.x, so "grep 172.17." won't work.
2022-10-07 14:09:53 +00:00
2 changed files with 16 additions and 5 deletions

View File

@ -28,6 +28,17 @@ docker build -t i2p .
### Running a container
#### Environment Variables
It is possible to set the IP address where the I2P router is accessible by setting
the `IP_ADDR` environment variable in your `docker run` command or your `docker-compose`
file. For example, if you want to make your I2P router listen on all addresses, then
you should pass `-e IP_ADDR=0.0.0.0` to your `docker run` command.
It is also possible to configure the memory available to the I2P router using
environment variables. To do this, use the: `JVM_XMX` environment variable by passing,
for example, `-e JVM_XMX=256m`.
#### Volumes
The container requires a volume for the configuration data to be mounted. Optionally, you can mount a separate volume for torrent ("i2psnark") downloads. See the example below.

View File

@ -24,12 +24,13 @@ done
if [ -f /.dockerenv ]; then
echo "[startapp] Running in container"
if [ -z "$IP_ADDR" ]; then
export IP_ADDR=$(hostname -i)
if echo "$IP_ADDR" | grep "172.17"; then
echo "[startapp] Running in docker network"
sed -i "s/127.0.0.1/${IP_ADDR}/g" ./clients.config ./i2ptunnel.config
fi
echo "[startapp] setting reachable IP to container IP $IP_ADDR"
find . -name '*.config' -exec sed -i "s/127.0.0.1/$IP_ADDR/g" {} \;
find . -name '*.config' -exec sed -i "s/localhost/$IP_ADDR/g" {} \;
fi
# Options required for reflective access in dynamic JVM languages like Groovy and Jython
@ -38,4 +39,3 @@ JAVA17OPTS="--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/su
JAVAOPTS="-Djava.net.preferIPv4Stack=false -Djava.library.path=${I2P}:${I2P}/lib -Di2p.dir.base=${I2P} -Di2p.dir.config=${HOME}/.i2p -DloggerFilenameOverride=logs/log-router-@.txt -Xmx$JVM_XMX"
java -cp "${CLASSPATH}" ${JAVA_OPTS} net.i2p.router.RouterLaunch