mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-11-22 15:40:22 +00:00
hostname improve
This commit is contained in:
parent
f0aa5ccd03
commit
8c6dde9fc3
3 changed files with 7 additions and 3 deletions
|
@ -8,7 +8,7 @@ WORKDIR /usr/src/app
|
||||||
# Copy source and install pip dpendencies
|
# Copy source and install pip dpendencies
|
||||||
COPY api ./api
|
COPY api ./api
|
||||||
COPY static ./static
|
COPY static ./static
|
||||||
COPY requirements.txt main.py database.sqlite ./
|
COPY requirements.txt main.py hostname.py database.sqlite ./
|
||||||
RUN apt update
|
RUN apt update
|
||||||
|
|
||||||
# Install supervisords
|
# Install supervisords
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
# start by supervisord
|
# start by supervisord
|
||||||
internal_ip=$(ip addr show eth0 | awk '/inet /{split($2, a, "/"); print a[1]}')
|
internal_ip=$(ip addr show eth0 | awk '/inet /{split($2, a, "/"); print a[1]}')
|
||||||
nsenter -m -u -i -n -p -t 1 sh -c "echo test_host:$internal_ip >> /tmp/hosts"
|
python3 /usr/src/app/hostname.py
|
||||||
nsenter -m -u -i -n -p -t 1 sh -c "echo $(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' websoft9-appmanage) websoft9-appmanage >> /etc/hosts"
|
|
||||||
/usr/bin/supervisord
|
/usr/bin/supervisord
|
||||||
supervisorctl start all
|
supervisorctl start all
|
||||||
tail -f /dev/null
|
tail -f /dev/null
|
||||||
|
|
5
appmanage/hostname.py
Normal file
5
appmanage/hostname.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
from api.utils.common_log import myLogger
|
||||||
|
from api.utils import shell_execute
|
||||||
|
|
||||||
|
shell_execute.execute_command_output_all("sed -i '/websoft9-appmanage/d' /etc/hosts")
|
||||||
|
shell_execute.execute_command_output_all("echo $(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' websoft9-appmanage) websoft9-appmanage >> /etc/hosts")
|
Loading…
Reference in a new issue