trying to fix anoyying error with dht peers

This commit is contained in:
Dobromir Popov
2023-08-30 22:47:15 +00:00
parent 5cb1f53c2f
commit 7facee3e56

View File

@ -1,4 +1,6 @@
# dobromirpopov/petals-ai :latest full # dobromirpopov/petals-ai :latest full
# dobromirpopov/petals-ai:full
#
FROM python:slim FROM python:slim
# System dependencies # System dependencies
@ -16,20 +18,18 @@ ENV ENV_PARAMS=
# pull petals and bake it into the image. comment for lite image # pull petals and bake it into the image. comment for lite image
RUN git clone https://github.com/d-popov/health.petals.dev.git && cd /health.petals.dev && pip install -r requirements.txt RUN git clone https://github.com/d-popov/health.petals.dev.git && cd /health.petals.dev && pip install -r requirements.txt
# Create the entrypoint script inside the Dockerfile # Create the entrypoint script inside the Dockerfile
RUN echo '#!/bin/sh\n\ RUN echo '#!/bin/sh\n\
INITIAL_PEERS=""\n\ echo "Script is starting..."\n\
if [ -n "$DHT_PEERS" ]; then\n\ echo "MODE is set to: $MODE"\n\
INITIAL_PEERS="--initial_peers $DHT_PEERS"\n\ echo "DHT_PEERS is set to: $DHT_PEERS"\n\
fi\n\
if [ ! -f "/initialized" ]; then\n\ if [ ! -f "/initialized" ]; then\n\
touch /initialized\n\ touch /initialized\n\
pip install --upgrade petals\n\ pip install --upgrade petals\n\
case "$MODE" in\n\ case "$MODE" in\n\
"monitor")\n\ "monitor")\n\
git clone https://github.com/d-popov/health.petals.dev.git && \ # git clone https://github.com/d-popov/health.petals.dev.git && \
cd /health.petals.dev && pip install -r requirements.txt\n\ # cd /health.petals.dev && pip install -r requirements.txt\n\
;;\n\ ;;\n\
"chat")\n\ "chat")\n\
git clone https://github.com/petals-infra/chat.petals.dev.git && \ git clone https://github.com/petals-infra/chat.petals.dev.git && \
@ -41,14 +41,25 @@ if [ ! -f "/initialized" ]; then\n\
esac\n\ esac\n\
fi\n\ fi\n\
if [ "$MODE" = "monitor" ] && [ -n "$DHT_PEERS" ]; then\n\ if [ "$MODE" = "monitor" ] && [ -n "$DHT_PEERS" ]; then\n\
echo "INITIAL_PEERS = ['$(echo $DHT_PEERS | sed "s/ /','/g")']" >> /health.petals.dev/config.py;\n\ FORMATTED_PEERS=$(echo $DHT_PEERS | sed "s/ /','/g")\n\
echo "setting initial peers to ['$(echo $DHT_PEERS | sed "s/ /','/g")']";\n\ echo "Debug FORMATTED_PEERS: $FORMATTED_PEERS"\n\
echo "INITIAL_PEERS = ['$FORMATTED_PEERS']" >> /health.petals.dev/config.py\n\
#echo "INITIAL_PEERS = ['$(echo $DHT_PEERS | sed "s/ /','/g")']" >> /health.petals.dev/config.py;\n\
echo "INITIAL_PEERS = ['"$FORMATTED_PEERS"']" >> /health.petals.dev/config.py\n\
#echo "monitorring private swarm. Initial peers set to ['$(echo $DHT_PEERS | sed "s/ /','/g")']"\n\
echo "monitoring private swarm. Initial peers set to ['"$FORMATTED_PEERS"']"\n\
else \n\
echo "monitor has no DHT peers. Monitoring public swarm."\n\
fi\n\ fi\n\
if [ -n "$HF_TOKEN" ]; then\n\ if [ -n "$HF_TOKEN" ]; then\n\
git config --global credential.helper store && \n\ git config --global credential.helper store && \n\
huggingface-cli login --token $HF_TOKEN --add-to-git-credential && \n\ huggingface-cli login --token $HF_TOKEN --add-to-git-credential && \n\
ENV_PARAMS="--use_auth_token $ENV_PARAMS"\n\ ENV_PARAMS="--use_auth_token $ENV_PARAMS"\n\
fi\n\ fi\n\
INITIAL_PEERS=""\n\
if [ -n "$DHT_PEERS" ]; then\n\
INITIAL_PEERS="--initial_peers $DHT_PEERS"\n\
fi\n\
case "$MODE" in\n\ case "$MODE" in\n\
"monitor")\n\ "monitor")\n\
cd /health.petals.dev\n\ cd /health.petals.dev\n\