Closed notrurs closed 4 years ago
But! If I try to do the same from host machine, page layout breaks.
You'll need to set MELLIVORA_CONFIG_SITE_URL
and MELLIVORA_CONFIG_SITE_URL_STATIC_RESOURCES
to your virtual machine IP (or hostname) in include/config/config.inc.php
.
Thank you!
I have Ubuntu 19.04 on VirtualBox that is running Mellivora via docker. If I connect to another network, the ip of the virtual machine will change. How to set MELLIVORA_CONFIG_SITE_URL
and MELLIVORA_CONFIG_SITE_URL_STATIC_RESOURCES
, that in this case the ip address is inserted itself and does not have to be set by myself?
I tried $HOSTNAME
, $_SERVER[SERVER_ADDR]
and sevaral other options. From outside either failed to connect, or page layout breaks.
At the moment, the best intermediate solution I have found for myself is create global variable $SERVER_IP
before start docker-compose:
IP="$(ip addr show enp0s3 | awk '$1 == "inet" { print $2 }' | cut -d/ -f1)"
export SERVER_IP=${IP}
sudo docker-compose -f docker-compose.dev.yml up -d
echo '----------------'
echo 'USE THIS IP:' $SERVER_IP
echo '----------------'
And then I set MELLIVORA_CONFIG_SITE_URL
and MELLIVORA_CONFIG_SITE_URL_STATIC_RESOURCES
to $SERVER_IP
:
Config::set('MELLIVORA_CONFIG_SITE_URL', $SERVER_IP);
Config::set('MELLIVORA_CONFIG_SITE_URL_STATIC_RESOURCES', $SERVER_IP);
But, if I connect, e.g. 192.168.0.169, from another computer I see this:
Seems like OK (despite the mistake), but if I login, page layout breaks:
I guess I'm on the wrong way to solve this problem.
What I should do? Probably, this is solved several times easier.
If someone is faced with the same problem, here is the solution I reached. First of all, you need at least python 3.6.
I created insert_ip.py
in same directory with config.inc.php
. Don't forget to change path
from sys import argv
ip = argv[1]
with open('/home/notrurs/mellivora/include/config/config.default.inc.php', 'r') as f:
data = f.readlines()
data[41] = f"Config::set('MELLIVORA_CONFIG_SITE_URL', 'http://{ip}/');"
data[42] = f"Config::set('MELLIVORA_CONFIG_SITE_URL_STATIC_RESOURCES', 'http://{ip}/');"
with open('/home/notrurs/mellivora/include/config/config.default.inc.php', 'w') as f:
f.write(''.join(data))
print("Input ip done!")
And then start.sh
in mellivora
dir. Don't forget to change interface in line 1:
IP="$(ip addr show enp0s3 | awk '$1 == "inet" { print $2 }' | cut -d/ -f1)"
export SERVER_IP=${IP}
python3 ./include/config/insert_ip.py $SERVER_IP
sudo docker-compose -f docker-compose.dev.yml up -d
echo "------------------------"
echo "USE THIS IP:" $SERVER_IP
echo "------------------------"
Now you just should input ./start.sh
and mellivora will run
Hi! I installed mellivora via docker. When I try to connect to web interface inside virtual machine, all OK![issue2](https://user-images.githubusercontent.com/19313648/62979846-968adf00-be2d-11e9-9478-0ccdb2f8285c.png)
But! If I try to do the same from host machine, page layout breaks.![issue1](https://user-images.githubusercontent.com/19313648/62979974-f2556800-be2d-11e9-9eba-788e29892755.png)
What should I do, that everything is displayed as it should with this connection? Maybe there is some ip settings for docker containers depending on host's ip?