iamkubi / pydactyl

Python wrapper for the Pterodactyl Panel API
MIT License
69 stars 21 forks source link

'No nodes satisfying the requirements specified for automatic deployment could be found.' #36

Closed ZikaCodez closed 3 years ago

ZikaCodez commented 3 years ago

My code :

from pydactyl import PterodactylClient

client = PterodactylClient('https://panel.krag.host', 'apikeyhere')

env = {
  'GIT_ADDRESS': '', 'BRANCH': '', 'USER_UPLOAD': '0', 'AUTO_UPDATE': '0', 'BOT_PY_FILE': 'bot.py', 'PY_PACKAGES': '', 'USERNAME': '', 'ACCESS_TOKEN': '', 'REQUIREMENTS_FILE': '', 'STARTUP': 'if [[ -d .git ]] && [[ {{AUTO_UPDATE}} == "1" ]]; then git pull; fi; if [[ ! -z {{PY_PACKAGES}} ]]; then pip install -U --target .local/lib/python3.8/site-packages {{PY_PACKAGES}}; fi; if [[ -f /home/container/${REQUIREMENTS_FILE} ]]; then pip install -U --target .local/lib/python3.8/site-packages -r ${REQUIREMENTS_FILE}; fi; /usr/local/bin/python /home/container/{{BOT_PY_FILE}}', 'P_SERVER_LOCATION': 'panel.krag.host', 'P_SERVER_ALLOCATION_LIMIT': 0
}

startupCMD = 'if [[ -d .git ]] && [[ {{AUTO_UPDATE}} == "1" ]]; then git pull; fi; if [[ ! -z {{PY_PACKAGES}} ]]; then pip install -U --target .local/lib/python3.8/site-packages {{PY_PACKAGES}}; fi; if [[ -f /home/container/${REQUIREMENTS_FILE} ]]; then pip install -U --target .local/lib/python3.8/site-packages -r ${REQUIREMENTS_FILE}; fi; /usr/local/bin/python /home/container/{{BOT_PY_FILE}}'

client.servers.create_server(name="Testing API", user_id=5, nest_id=6, egg_id=15, memory_limit=1028, swap_limit=0, disk_limit=1024, location_ids=[1], environment=env, cpu_limit=25, io_limit=500, database_limit=0, allocation_limit=3, backup_limit=0, docker_image='quay.io/parkervcp/pterodactyl-images:debian_python-3.8', startup_cmd=startupCMD, dedicated_ip=False, start_on_completion=True, oom_disabled=True, default_allocation=None, additional_allocations=None)
print("created")

Error I get :

    raise PterodactylApiError('API Request resulted in errors: %s' %
pydactyl.exceptions.PterodactylApiError: API Request resulted in errors: [{'code': 'NoViableNodeException', 'status': '400', 'detail': 'No nodes satisfying the requirements specified for automatic deployment could be found.'}]

I have only one node and its ID is 1 and its short code is testnode.krag.host. Can someone tell me what's wrong?

iamkubi commented 3 years ago

Either the there isn't enough memory or disk available on your node, your location_id is wrong (node_id is not the same as location_id), or... there weren't any valid allocations matching - which seems to be your issue since you haven't provided any allocations. Discord bots don't require ports, but Pterodactyl requires every server has a port, so even though the bot doesn't require one you still have to specify one.