This commit is contained in:
Quinten 2023-12-30 11:52:04 +01:00 committed by GitHub
parent 0d25359315
commit c1dc43224c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,7 @@
"version": "PTDL_v2",
"update_url": null
},
"exported_at": "2023-12-29T13:41:08-08:00",
"exported_at": "2023-12-30T11:50:55+01:00",
"name": "NATS",
"author": "pterodactyl@geosk.xyz",
"description": "NATS is a simple, secure and performant communications system for digital systems, services and devices. NATS is part of the Cloud Native Computing Foundation (CNCF). NATS has over 40 client language implementations, and its server can run on-premise, in the cloud, at the edge, and even on a Raspberry Pi. NATS can secure and simplify design and operation of modern distributed systems.",
@ -22,20 +22,20 @@
},
"scripts": {
"installation": {
"script": "# NATS Server installer.\r\n# Authored by Geosskk\r\n#! \/bin\/bash\r\n\r\napt update\r\napt install -y curl unzip\r\nARCH=$([[ \"$(uname -m)\" == \"x86_64\" ]] && echo \"amd64\" || echo \"arm64\")\r\n\r\ncd \/mnt\/server\r\n\r\nVERSION_RESPONSE=$(curl -sLI -o \/dev\/null -w '%{http_code}' https:\/\/github.com\/nats-io\/nats-server\/releases\/tag\/v${NATS_VERSION})\r\n\r\nif [[ \"$VERSION_RESPONSE\" -ne 200 ]]; then\r\n echo \"Specified version not found, using latest.\"\r\n\r\n LATEST_TAG=$(curl -s https:\/\/api.github.com\/repos\/nats-io\/nats-server\/releases\/latest | grep \"tag_name\" | cut -d : -f 2,3 | tr -d \"v[:blank:]\\\",\")\r\n # FILE_URL=$(curl -s https:\/\/api.github.com\/repos\/nats-io\/nats-server\/releases\/latest | grep \"browser_download_url\" | cut -d : -f 2,3 | tr -d \"[:blank:]\\\",\" | grep \"linux-${ARCH}.zip\")\r\n\r\n if [ -z \"$LATEST_TAG\" ]; then\r\n echo \"Unable to get the latest release's info.\"\r\n exit 1\r\n fi\r\n\r\n echo \"Found latest tag v$LATEST_TAG\"\r\n\r\n NATS_VERSION=$LATEST_TAG\r\n\r\n FILE_URL=\"https:\/\/github.com\/nats-io\/nats-server\/releases\/download\/v${NATS_VERSION}\/nats-server-v${NATS_VERSION}-linux-${ARCH}.zip\"\r\nelse\r\n echo \"Version $NATS_VERSION found.\"\r\n\r\n FILE_URL=\"https:\/\/github.com\/nats-io\/nats-server\/releases\/download\/v${NATS_VERSION}\/nats-server-v${NATS_VERSION}-linux-${ARCH}.zip\"\r\nfi\r\n\r\necho \"The file URL is $FILE_URL\"\r\n\r\nFILE_URL_RESPONSE=$(curl -sLI -o \/dev\/null -w '%{http_code}' $FILE_URL)\r\n\r\nif [[ \"$FILE_URL_RESPONSE\" -ne 200 ]]; then\r\n echo \"The file URL failed to respond with status code 200, responded with $FILE_URL_RESPONSE.\"\r\n exit 1\r\nfi\r\n\r\ncurl -L ${FILE_URL} -o nats-server.zip\r\nunzip nats-server.zip\r\nrm nats-server.zip\r\ncp nats-server-v${NATS_VERSION}-linux-${ARCH}\/* .\/\r\nrm -R nats-server-v${NATS_VERSION}-linux-${ARCH}\/\r\n\r\nchmod +x nats-server",
"container": "debian:buster-slim",
"script": "#!\/bin\/bash\r\n\r\n# NATS Server installer.\r\n# Authored by Geosskk\r\n\r\nmkdir -p \/mnt\/server\r\ncd \/mnt\/server\r\n\r\n## get release info and download links\r\nLATEST_JSON=$(curl --silent \"https:\/\/api.github.com\/repos\/nats-io\/nats-server\/releases\/latest\")\r\nRELEASES=$(curl --silent \"https:\/\/api.github.com\/repos\/nats-io\/nats-server\/releases\")\r\nARCH=$([[ \"$(uname -m)\" == \"x86_64\" ]] && echo \"linux-amd64.tar.gz\" || echo \"linux-arm64.tar.gz\")\r\n\r\nif [ -z \"${VERSION}\" ] || [ \"${VERSION}\" == \"latest\" ]; then\r\n DOWNLOAD_URL=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url | grep -i ${MATCH})\r\nelse\r\n VERSION_CHECK=$(echo ${RELEASES} | jq -r --arg VERSION \"${VERSION}\" '.[] | select(.tag_name==$VERSION) | .tag_name')\r\n if [ \"${VERSION}\" == \"${VERSION_CHECK}\" ]; then\r\n DOWNLOAD_URL=$(echo ${RELEASES} | jq -r --arg VERSION \"${VERSION}\" '.[] | select(.tag_name==$VERSION) | .assets[].browser_download_url' | grep -i ${MATCH})\r\n else\r\n echo -e \"defaulting to latest release\"\r\n DOWNLOAD_URL=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url)\r\n fi\r\nfi\r\n\r\ncurl -sSL -o nats-server.tar.gz ${DOWNLOAD_URL}\r\ntar xvf nats-server.tar.gz --strip-components=1\r\nrm nats-server.tar.gz\r\n\r\nchmod +x nats-server\r\n\r\n## install end\r\necho \"-----------------------------------------\"\r\necho \"Installation completed...\"\r\necho \"-----------------------------------------\"",
"container": "ghcr.io\/parkervcp\/installers:debian",
"entrypoint": "bash"
}
},
"variables": [
{
"name": "Version",
"description": "The version of NATS to install, if not found will try to get the latest release.",
"env_variable": "NATS_VERSION",
"default_value": "2.10.7",
"description": "The version of NATS to install.\r\nFor a specific version, example: v2.10.7",
"env_variable": "VERSION",
"default_value": "latest",
"user_viewable": true,
"user_editable": true,
"rules": "nullable|string|max:20",
"rules": "required|string|max:20",
"field_type": "text"
},
{