Skip to content

Instantly share code, notes, and snippets.

@Saturn745
Created June 22, 2023 08:30
Show Gist options
  • Save Saturn745/dc241060ced33f7b8f280b4243770916 to your computer and use it in GitHub Desktop.
Save Saturn745/dc241060ced33f7b8f280b4243770916 to your computer and use it in GitHub Desktop.
FiveM pterodactyl egg, with the ability to pull your resources from a GIT repo.
{
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
"meta": {
"version": "PTDL_v2",
"update_url": null
},
"exported_at": "2023-06-22T08:29:42+00:00",
"name": "FiveM - GIT",
"author": "[email protected]",
"description": "A new FiveM egg for the latest builds due to recent changes in FiveM",
"features": null,
"docker_images": {
"ghcr.io/parkervcp/yolks:debian": "ghcr.io/parkervcp/yolks:debian"
},
"file_denylist": [],
"startup": "if [[ -d resources/.git ]] && [[ \"1\" == \"1\" ]]; then git -C resources/ pull; fi; $(pwd)/alpine/opt/cfx-server/ld-musl-x86_64.so.1 --library-path \"$(pwd)/alpine/usr/lib/v8/:$(pwd)/alpine/lib/:$(pwd)/alpine/usr/lib/\" -- $(pwd)/alpine/opt/cfx-server/FXServer +set citizen_dir $(pwd)/alpine/opt/cfx-server/citizen/ +set sv_licenseKey cfxk_1AwSfKSehoFG8jCuv3o1F_2ss1pz +set steam_webApiKey none +set sv_maxplayers 7 +set serverProfile default +set txAdminPort 40120 $( [ \"$TXADMIN_ENABLE\" == \"1\" ] || printf %s '+exec server.cfg' )",
"config": {
"files": "{\r\n \"server.cfg\": {\r\n \"parser\": \"file\",\r\n \"find\": {\r\n \"endpoint_add_tcp\": \"endpoint_add_tcp \\\"0.0.0.0:{{server.build.default.port}}\\\"\",\r\n \"endpoint_add_udp\": \"endpoint_add_udp \\\"0.0.0.0:{{server.build.default.port}}\\\"\",\r\n \"sv_hostname\": \"sv_hostname \\\"{{server.build.env.SERVER_HOSTNAME}}\\\"\",\r\n \"set sv_licenseKey\": \"set sv_licenseKey {{server.build.env.FIVEM_LICENSE}}\",\r\n \"set steam_webApiKey\": \"set steam_webApiKey {{server.build.env.STEAM_WEBAPIKEY}}\",\r\n \"sv_maxclients\": \"sv_maxclients {{server.build.env.MAX_PLAYERS}}\"\r\n }\r\n }\r\n}",
"startup": "{\r\n \"done\": \"succeeded. Welcome!\"\r\n}",
"logs": "{}",
"stop": "quit"
},
"scripts": {
"installation": {
"script": "#!/bin/bash\r\n# FiveM Installation Script\r\n#\r\n# Server Files: /mnt/server\r\napt update -y\r\napt install -y tar xz-utils file jq\r\n\r\nmkdir -p /mnt/server/resources\r\n\r\ncd /mnt/server/resources\r\nif [ \"${USE_GIT}\" == \"true\" ] || [ \"${USE_GIT}\" == \"1\" ]; then\r\n echo -e \"assuming user knows what they are doing have a good day.\"\r\n if [[ ${GIT_ADDRESS} != *.git ]]; then\r\n GIT_ADDRESS=${GIT_ADDRESS}.git\r\n fi\r\n \r\n if [ -z \"${USERNAME}\" ] && [ -z \"${ACCESS_TOKEN}\" ]; then\r\n echo -e \"using anon api call\"\r\n else\r\n GIT_ADDRESS=\"https://${USERNAME}:${ACCESS_TOKEN}@$(echo -e ${GIT_ADDRESS} | cut -d/ -f3-)\"\r\n fi\r\n\r\n if [ \"$(ls -A /mnt/server/resources)\" ]; then\r\n echo -e \"/mnt/server/resources directory is not empty.\"\r\n if [ -d .git ]; then\r\n echo -e \".git directory exists\"\r\n if [ -f .git/config ]; then\r\n echo -e \"loading info from git config\"\r\n ORIGIN=$(git config --get remote.origin.url)\r\n else\r\n echo -e \"files found with no git config\"\r\n echo -e \"closing out without touching things to not break anything\"\r\n exit 10\r\n fi\r\n fi\r\n\r\n if [ \"${ORIGIN}\" == \"${GIT_ADDRESS}\" ]; then\r\n echo \"pulling latest from git\"\r\n git pull\r\n fi\r\n else\r\n echo -e \"/mnt/server/resources is empty.\\ncloning files into repo\"\r\n if [ -z ${BRANCH} ]; then\r\n echo -e \"cloning default branch\"\r\n git clone ${GIT_ADDRESS} .\r\n else\r\n echo -e \"cloning ${BRANCH}'\"\r\n git clone --single-branch --branch ${BRANCH} ${GIT_ADDRESS} .\r\n fi\r\n\r\n fi\r\nelse\r\n cd /mnt/server\r\n echo \"updating citizenfx resource files\"\r\n git clone https://github.com/citizenfx/cfx-server-data.git /tmp\r\n cp -Rf /tmp/resources/* resources/\r\nfi\r\n\r\ncd /mnt/server\r\n\r\nRELEASE_PAGE=$(curl -sSL https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/)\r\nCHANGELOGS_PAGE=$(curl -sSL https://changelogs-live.fivem.net/api/changelog/versions/linux/server)\r\n\r\nif [[ \"${FIVEM_VERSION}\" == \"recommended\" ]] || [[ -z ${FIVEM_VERSION} ]]; then\r\n DOWNLOAD_LINK=$(echo $CHANGELOGS_PAGE | jq -r '.recommended_download')\r\nelif [[ \"${FIVEM_VERSION}\" == \"latest\" ]]; then\r\n DOWNLOAD_LINK=$(echo $CHANGELOGS_PAGE | jq -r '.latest_download')\r\nelse\r\n VERSION_LINK=$(echo -e \"${RELEASE_PAGE}\" | grep -Eo '\".*/*.tar.xz\"' | grep -Eo '\".*/*.tar.xz\"' | sed 's/\\\"//g' | sed 's/\\.\\///1' | grep -i \"${FIVEM_VERSION}\" | grep -o =.* | tr -d '=')\r\n if [[ \"${VERSION_LINK}\" == \"\" ]]; then\r\n echo -e \"defaulting to recommedned as the version requested was invalid.\"\r\n DOWNLOAD_LINK=$(echo $CHANGELOGS_PAGE | jq -r '.recommended_download')\r\n else\r\n DOWNLOAD_LINK=$(echo https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/${VERSION_LINK})\r\n fi\r\nfi\r\n\r\nif [ ! -z \"${DOWNLOAD_URL}\" ]; then\r\n if curl --output /dev/null --silent --head --fail ${DOWNLOAD_URL}; then\r\n echo -e \"link is valid. setting download link to ${DOWNLOAD_URL}\"\r\n DOWNLOAD_LINK=${DOWNLOAD_URL}\r\n else\r\n echo -e \"link is invalid closing out\"\r\n exit 2\r\n fi\r\nfi\r\n\r\necho -e \"Running curl -sSL ${DOWNLOAD_LINK} -o ${DOWNLOAD_LINK##*/}\"\r\n\r\ncurl -sSL ${DOWNLOAD_LINK} -o ${DOWNLOAD_LINK##*/}\r\n\r\necho \"Extracting fivem files\"\r\n\r\nFILETYPE=$(file -F ',' ${DOWNLOAD_LINK##*/} | cut -d',' -f2 | cut -d' ' -f2)\r\nif [ \"$FILETYPE\" == \"gzip\" ]; then\r\n tar xzvf ${DOWNLOAD_LINK##*/}\r\nelif [ \"$FILETYPE\" == \"Zip\" ]; then\r\n unzip ${DOWNLOAD_LINK##*/}\r\nelif [ \"$FILETYPE\" == \"XZ\" ]; then\r\n tar xvf ${DOWNLOAD_LINK##*/}\r\nelse\r\n echo -e \"unknown filetype. Exiting\"\r\n exit 2\r\nfi\r\n\r\nrm -rf ${DOWNLOAD_LINK##*/} run.sh\r\n\r\nif [ -e server.cfg ]; then\r\n echo \"Skipping downloading default server config file as one already exists\"\r\nelse\r\n echo \"Downloading default fivem config\"\r\n curl https://raw.githubusercontent.com/parkervcp/eggs/master/game_eggs/gta/fivem/server.cfg >>server.cfg\r\nfi\r\n\r\nmkdir -p logs/\r\n\r\necho \"install complete\"",
"container": "ghcr.io/parkervcp/installers:debian",
"entrypoint": "bash"
}
},
"variables": [
{
"name": "fivem license",
"description": "Required to start the service. Get your keys at https://keymaster.fivem.net/",
"env_variable": "FIVEM_LICENSE",
"default_value": "",
"user_viewable": true,
"user_editable": true,
"rules": "required|string|max:33",
"field_type": "text"
},
{
"name": "Max Players",
"description": "Set the fivem max play count",
"env_variable": "MAX_PLAYERS",
"default_value": "48",
"user_viewable": true,
"user_editable": false,
"rules": "required|integer|between:1,48",
"field_type": "text"
},
{
"name": "Server Hostname",
"description": "The name that shows up in the server browser",
"env_variable": "SERVER_HOSTNAME",
"default_value": "My new FXServer!",
"user_viewable": true,
"user_editable": true,
"rules": "required|string",
"field_type": "text"
},
{
"name": "fivem version",
"description": "The fivem version that is to be installed. Invalid versions will default to recommended.\r\n\r\nAn example is `6013-d8ae399d15680da569022f57ab7f2474d307c821`\r\n\r\nYou can get the latest version from here - https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/",
"env_variable": "FIVEM_VERSION",
"default_value": "recommended",
"user_viewable": true,
"user_editable": true,
"rules": "required|string|max:50",
"field_type": "text"
},
{
"name": "Download Link",
"description": "This is the link to download fivem from. This is only used in the install script.\r\n\r\nThe file you link to needs to be an fx.tar.zx file.\r\n\r\nExample:\r\nhttps://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/6013-d8ae399d15680da569022f57ab7f2474d307c821/fx.tar.xz",
"env_variable": "DOWNLOAD_URL",
"default_value": "",
"user_viewable": false,
"user_editable": false,
"rules": "string|nullable",
"field_type": "text"
},
{
"name": "Steam Web Api Key",
"description": "Use your Steam WebApiKey or set to 'none'. Get your key at https://steamcommunity.com/dev/apikey/",
"env_variable": "STEAM_WEBAPIKEY",
"default_value": "none",
"user_viewable": true,
"user_editable": true,
"rules": "required|string",
"field_type": "text"
},
{
"name": "txAdmin Port",
"description": "The port for the txAdmin panel",
"env_variable": "TXADMIN_PORT",
"default_value": "40120",
"user_viewable": true,
"user_editable": false,
"rules": "required|string|max:20",
"field_type": "text"
},
{
"name": "Enable txadmin",
"description": "Enables txadmin.\r\n\r\nset to 1 to enable. (default is 0 for false)",
"env_variable": "TXADMIN_ENABLE",
"default_value": "0",
"user_viewable": true,
"user_editable": true,
"rules": "required|boolean",
"field_type": "text"
},
{
"name": "Git Repo Address",
"description": "Git repo to clone for your resources directory. If you use this option it will not download the default FiveM resources\r\n\r\nI.E. https://github.com/parkervcp/repo_name",
"env_variable": "GIT_ADDRESS",
"default_value": "",
"user_viewable": true,
"user_editable": true,
"rules": "nullable|string",
"field_type": "text"
},
{
"name": "Git Branch",
"description": "What branch to pull from git.\r\n\r\nDefault is blank to pull the repo default branch",
"env_variable": "BRANCH",
"default_value": "",
"user_viewable": true,
"user_editable": true,
"rules": "nullable|string",
"field_type": "text"
},
{
"name": "Git Username",
"description": "Username to auth with git.",
"env_variable": "USERNAME",
"default_value": "",
"user_viewable": true,
"user_editable": true,
"rules": "nullable|string",
"field_type": "text"
},
{
"name": "Git Access Token",
"description": "Password to use with git.\r\n\r\nIt's best practice to use a Personal Access Token.\r\nhttps://github.com/settings/tokens\r\nhttps://gitlab.com/-/profile/personal_access_tokens",
"env_variable": "ACCESS_TOKEN",
"default_value": "",
"user_viewable": true,
"user_editable": true,
"rules": "nullable|string",
"field_type": "text"
},
{
"name": "Use GIT",
"description": "If this is set to 1 the server will pull all resources from a git repo on boot. If it is 0 it will not and will use the files on the server",
"env_variable": "USE_GIT",
"default_value": "0",
"user_viewable": true,
"user_editable": true,
"rules": "required|boolean",
"field_type": "text"
},
{
"name": "Auto Update",
"description": "Pull the latest files on startup when using a Git repo.",
"env_variable": "AUTO_UPDATE",
"default_value": "0",
"user_viewable": true,
"user_editable": true,
"rules": "required|boolean",
"field_type": "text"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment