cmh / entrypoint.sh
eleeter's picture
Create entrypoint.sh
1938c4f verified
Raw
History Blame Contribute Delete
708 Bytes
#!/bin/bash
# 1. Force Discord IPs into the system hosts file
# This ensures Discord ALWAYS works regardless of DNS
echo "162.159.138.232 discord.com" >> /etc/hosts || echo "162.159.138.232 discord.com" >> /tmp/hosts
echo "162.159.135.232 gateway.discord.gg" >> /etc/hosts || echo "162.159.135.232 gateway.discord.gg" >> /tmp/hosts
# 2. Create the .env file so the library doesn't crash
echo "ENVIRONMENT=PRODUCTION" > .env
# 3. Run the bot
# NOTICE: We REMOVED "-Djdk.net.hosts.file" because it was blocking MongoDB
# We keep the other flags to help the connection stay alive
java -Djava.net.preferIPv4Stack=true \
-Dsun.net.inetaddr.ttl=0 \
-Dsun.net.inetaddr.negative.ttl=0 \
-jar app.jar