Skip to content

Instantly share code, notes, and snippets.

@hanahaneull
Created June 28, 2020 06:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hanahaneull/7db1a43b5971f017098d5c93794febd6 to your computer and use it in GitHub Desktop.
Save hanahaneull/7db1a43b5971f017098d5c93794febd6 to your computer and use it in GitHub Desktop.
{
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
"meta": {
"version": "PTDL_v1"
},
"exported_at": "2020-03-26T16:10:33+01:00",
"name": "discord.js generic",
"author": "parker@parkervcp.com",
"description": "a generic discord js bot egg\r\n\r\nThis will clone a git repo for a bot. it defaults to master if no branch is specified.\r\n\r\nInstalls the node_modules on install. If you set user_upload then I assume you know what you are doing.",
"image": "quay.io\/parkervcp\/pterodactyl-images:debian_nodejs-12",
"startup": "if [[ -d .git ]] && [[ {{AUTO_UPDATE}} == \"1\" ]]; then git pull; fi && \/usr\/local\/bin\/npm install --production && \/usr\/local\/bin\/node \/home\/container\/{{BOT_JS_FILE}}",
"config": {
"files": "{}",
"startup": "{\r\n \"done\": \"change this part\"\r\n}",
"logs": "{}",
"stop": "^c"
},
"scripts": {
"installation": {
"script": "#\/bin\/ash\r\n\r\napk add --no-cache git make gcc g++ python\r\n\r\ncd \/mnt\/server\r\n\r\nif [[ ! ${INSTALL_REPO} = *\\.git ]]; then\r\n INSTALL_REPO=$(echo -e ${INSTALL_REPO} | sed 's:\/*$::')\r\n INSTALL_REPO=\"${INSTALL_REPO}.git\"\r\nfi\r\n\r\necho -e \"working on installing a discord.js bot from ${INSTALL_REPO}\"\r\n\r\nif [ \"${USER_UPLOAD}\" == \"true\" ] || [ \"${USER_UPLOAD}\" == \"1\" ]; then\r\n\techo -e \"assuming user knows what they are doing have a good day.\"\r\n\texit 0\r\nelse\r\n\tif [ \"$(ls -A \/mnt\/server)\" ]; then\r\n\t\techo -e \"\/mnt\/server directory is not empty.\"\r\n\t if [ -d .git ]; then\r\n\t\t\techo -e \".git directory exists\" \r\n\t\t\tif [ -f .git\/config ]; then\r\n\t\t\t\techo -e \"loading info from git config\"\r\n\t\t\t\tORIGIN=$(git config --get remote.origin.url)\r\n\t\t\telse\r\n\t\t\t\techo -e \"files found with no git config\"\r\n\t\t\t\techo -e \"closing out without touching things to not break anything\"\r\n\t\t\t\texit 10\r\n\t\t\tfi\r\n\t\tfi\r\n\t\tif [ \"${ORIGIN}\" == \"${INSTALL_REPO}\" ]; then\r\n\t\t\techo \"pulling latest from github\"\r\n\t\t\tgit pull \r\n\t\t\techo -e \"updating local npm modules\"\r\n\t\t\t\/usr\/local\/bin\/npm install --production\r\n\t\tfi\r\n\telse\r\n \techo -e \"\/mnt\/server is empty.\\ncloning files into repo\"\r\n\t\tif [ -z ${INSTALL_BRANCH} ]; then\r\n\t\t\techo -e \"assuming master branch\"\r\n\t\t\tINSTALL_BRANCH=master\r\n\t\tfi\r\n \r\n\t\techo -e \"running 'git clone --single-branch --branch ${INSTALL_BRANCH} ${INSTALL_REPO} .'\"\r\n\t\tgit clone --single-branch --branch ${INSTALL_BRANCH} ${INSTALL_REPO} .\r\n\t\techo -e \"install npm modules locally\"\r\n\t\t\/usr\/local\/bin\/npm install --production\r\n\tfi\r\nfi \r\n\r\necho -e \"install complete\"\r\nexit 0",
"container": "node:10-alpine",
"entrypoint": "ash"
}
},
"variables": [
{
"name": "Install Repo",
"description": "The git repo to clone and install the discord js bot from",
"env_variable": "INSTALL_REPO",
"default_value": "",
"user_viewable": 1,
"user_editable": 1,
"rules": "nullable|string|max:128"
},
{
"name": "Install Branch",
"description": "The branch of the bot to install",
"env_variable": "INSTALL_BRANCH",
"default_value": "",
"user_viewable": 1,
"user_editable": 1,
"rules": "nullable|string|max:32"
},
{
"name": "User Uploaded Files",
"description": "Skip all the install cruft is you are just letting a user upload files.\r\n\r\n0 = false (default)\r\n1 = true",
"env_variable": "USER_UPLOAD",
"default_value": "0",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|bool"
},
{
"name": "Auto Update",
"description": "When using a git repo pull the latest files on startup.",
"env_variable": "AUTO_UPDATE",
"default_value": "0",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|boolean"
},
{
"name": "Bot js file",
"description": "The file that starts the bot.",
"env_variable": "BOT_JS_FILE",
"default_value": "index.js",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|string"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment