- Changed json parsing to look for latest instead of assuming the last entry

- Removed password variable because you can't set an empty password
- Added variables to help host public servers
- Added the map creation options to use the map-gen json files
- Added the server settings launch option which is required for public servers
This commit is contained in:
Matthew Chan 2018-06-08 21:11:47 +01:00
parent 2f3b2be8ea
commit b3b40d10b9

View File

@ -3,29 +3,21 @@
"meta": { "meta": {
"version": "PTDL_v1" "version": "PTDL_v1"
}, },
<<<<<<< HEAD "exported_at": "2018-06-08T20:57:39+01:00",
"exported_at": "2018-05-26T14:21:49+01:00",
=======
"exported_at": "2018-05-27T23:24:15-04:00",
>>>>>>> 4cc093031372bdf930226de3ff4bb4f81c8a7cf6
"name": "Factorio", "name": "Factorio",
"author": "parker@parkervcp.com", "author": "parker@parkervcp.com",
"description": "The vanilla Factorio server.\r\n\r\nhttps:\/\/www.factorio.com\/", "description": "The vanilla Factorio server.\r\n\r\nhttps:\/\/www.factorio.com\/",
"image": "quay.io\/pterodactyl\/core:glibc", "image": "quay.io\/pterodactyl\/core:glibc",
"startup": ".\/bin\/x64\/factorio --port {{SERVER_PORT}} --start-server {{SAVE_NAME}}.zip", "startup": ".\/bin\/x64\/factorio --port {{SERVER_PORT}} --server-settings data\/server-settings.json --start-server {{SAVE_NAME}}.zip",
"config": { "config": {
"files": "{\r\n \"data\/server-settings.json\": {\r\n \"parser\": \"json\",\r\n \"find\": {\r\n \"game_password\": \"{{server.build.env.SERVER_PASS}}\",\r\n \"max_players\": \"{{server.build.env.MAX_SLOTS}}\"\r\n }\r\n }\r\n}", "files": "{\r\n \"data\/server-settings.json\": {\r\n \"parser\": \"json\",\r\n \"find\": {\r\n \"name\": \"{{server.build.env.SERVER_NAME}}\",\r\n \"description\": \"{{server.build.env.SERVER_DESC}}\",\r\n \"max_players\": \"{{server.build.env.MAX_SLOTS}}\",\r\n \"username\": \"{{server.build.env.SERVER_USERNAME}}\",\r\n \"token\": \"{{server.build.env.SERVER_TOKEN}}\",\r\n \"autosave_interval\": \"{{server.build.env.SAVE_INTERVAL}}\",\r\n \"autosave_slots\": \"{{server.build.env.SAVE_SLOTS}}\",\r\n \"afk_autokick_interval\": \"{{server.build.env.AFK_KICK}}\"\r\n }\r\n }\r\n}",
"startup": "{\r\n \"done\": \"InGame\",\r\n \"userInteraction\": []\r\n}", "startup": "{\r\n \"done\": \"InGame\",\r\n \"userInteraction\": []\r\n}",
"logs": "{\r\n \"custom\": false,\r\n \"location\": \"factorio-current.log\"\r\n}", "logs": "{\r\n \"custom\": false,\r\n \"location\": \"factorio-current.log\"\r\n}",
"stop": "^C" "stop": "^C"
}, },
"scripts": { "scripts": {
"installation": { "installation": {
<<<<<<< HEAD "script": "#!\/bin\/ash\r\n# Factorio Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\napk add --no-cache curl tar xz jq\r\n\r\nlatest_stable=`curl -sL https:\/\/updater.factorio.com\/get-available-versions | jq '.[\"core-linux_headless64\"] | .[] | .[\"stable\"] | select(. != null)' | sed -e 's\/\"\/\/g'`\r\nlatest_experimental=`curl -sL https:\/\/www.factorio.com\/download-headless\/experimental | grep -m 1 -o -E '([0-9]\\.[0-9][0-9]\\.[0-9][0-9] | [0-9]\\.[0-9][0-9]\\.[0-9])'`\r\n\r\nif [ -z \"${FACTORIO_VERSION}\" ] || [ \"${FACTORIO_VERSION}\" == \"latest\" ]; then\r\n DL_VERSION=$latest_stable\r\nelif [ \"${FACTORIO_VERSION}\" == \"experimental\" ]; then\r\n DL_VERSION=$latest_experimental\r\nelse\r\n DL_VERSION=${FACTORIO_VERSION}\r\nfi\r\n\r\necho -e \"\\n running 'curl -sL https:\/\/www.factorio.com\/get-download\/${DL_VERSION}\/headless\/linux64 -o factorio-${DL_VERSION}.tar.gz' \\n\"\r\n\r\ncd \/mnt\/server\r\n\r\ncurl -sL https:\/\/www.factorio.com\/get-download\/${DL_VERSION}\/headless\/linux64 -o factorio-${DL_VERSION}.tar.gz\r\n\r\ntar -xf factorio-${DL_VERSION}.tar.gz --strip-components=1 -C \/mnt\/server\r\n\r\nrm factorio-${DL_VERSION}.tar.gz\r\n\r\nif [ -e data\/map-gen-settings.json ]; then\r\n echo \"map-gen exists\"\r\nelse\r\n echo \"copying map-gen default settings\"\r\n mv data\/map-gen-settings.example.json data\/map-gen-settings.json\r\nfi\r\n\r\nif [ -e data\/server-settings.json ]; then\r\n echo \"server settings exists\"\r\nelse\r\n echo \"copying server default settings\"\r\n mv data\/server-settings.example.json data\/server-settings.json\r\nfi\r\n\r\nif [ -e map-settings.json ]; then\r\n echo \"map settings exists\"\r\nelse\r\n echo \"copying map default settings\"\r\n mv data\/map-settings.example.json data\/map-settings.json\r\nfi\r\n\r\nif [ -e ${SAVE_NAME}.zip ]; then\r\n echo \"save file exists\"\r\nelse\r\n .\/bin\/x64\/factorio --create ${SAVE_NAME} --map-settings data\/map-settings.json --map-gen-settings data\/map-gen-settings.json\r\n chmod o+w ${SAVE_NAME}.zip\r\nfi",
"script": "#!\/bin\/ash\r\n# Factorio Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\napk add --no-cache curl tar xz\r\n\r\nlatest_stable=`curl -s https:\/\/updater.factorio.com\/get-available-versions | sed -e 's\/},{\/}\\n{\/g' | grep stable | grep -o -E '([0-9]\\.[0-9][0-9]\\.[0-9][0-9]|[0-9]\\.[0-9][0-9]\\.[0-9])'`\r\nlatest_experimental=`curl -s https:\/\/www.factorio.com\/download-headless\/experimental | grep -m 1 -o -E '([0-9]\\.[0-9][0-9]\\.[0-9][0-9]|[0-9]\\.[0-9][0-9]\\.[0-9])'`\r\n\r\nif [ -z \"${FACTORIO_VERSION}\" ] || [ \"${FACTORIO_VERSION}\" == \"latest\" ]; then\r\n DL_VERSION=$latest_stable\r\nelif [ \"${FACTORIO_VERSION}\" == \"experimental\" ]; then\r\n DL_VERSION=$latest_experimental\r\nelse\r\n DL_VERSION=${FACTORIO_VERSION}\r\nfi\r\n\r\necho -e \"\\n running 'curl -L https:\/\/www.factorio.com\/get-download\/${DL_VERSION}\/headless\/linux64 -o factorio-${DL_VERSION}.tar.gz' \\n\"\r\n\r\ncd \/mnt\/server\r\n\r\ncurl -L https:\/\/www.factorio.com\/get-download\/${DL_VERSION}\/headless\/linux64 -o factorio-${DL_VERSION}.tar.gz\r\n\r\ntar -xf factorio-${DL_VERSION}.tar.gz --strip-components=1 -C \/mnt\/server\r\n\r\nrm factorio-${DL_VERSION}.tar.gz\r\n\r\nif [ -e data\/map-gen-settings.json ]; then\r\n echo \"map-gen exists\"\r\nelse\r\n echo \"copying map-gen default settings\"\r\n mv data\/map-gen-settings.example.json data\/map-gen-settings.json\r\nfi\r\n\r\nif [ -e data\/server-settings.json ]; then\r\n echo \"server settings exists\"\r\nelse\r\n echo \"copying server default settings\"\r\n mv data\/server-settings.example.json data\/server-settings.json\r\nfi\r\n\r\nif [ -e map-settings.json ]; then\r\n echo \"map settings exists\"\r\nelse\r\n echo \"copying map default settings\"\r\n mv data\/map-settings.example.json data\/map-settings.json\r\nfi\r\n\r\nif [ -e ${SAVE_NAME}.zip ]; then\r\n echo \"save file exists\"\r\nelse\r\n .\/bin\/x64\/factorio --create ${SAVE_NAME}\r\n chmod o+w ${SAVE_NAME}.zip\r\nfi",
=======
"script": "#!\/bin\/ash\r\n# Factorio Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\napk add --no-cache curl tar xz jq\r\n\r\nlatest_stable=`curl -s https:\/\/updater.factorio.com\/get-available-versions | jq '.[\"core-linux_headless64\"] | .[length-1] | .[\"stable\"]' | sed -e 's\/\"\/\/g'`\r\nlatest_experimental=`curl -s https:\/\/www.factorio.com\/download-headless\/experimental | grep -m 1 -o -E '([0-9]\\.[0-9][0-9]\\.[0-9][0-9] | [0-9]\\.[0-9][0-9]\\.[0-9])'`\r\n\r\nif [ -z \"${FACTORIO_VERSION}\" ] || [ \"${FACTORIO_VERSION}\" == \"latest\" ]; then\r\n DL_VERSION=$latest_stable\r\nelif [ \"${FACTORIO_VERSION}\" == \"experimental\" ]; then\r\n DL_VERSION=$latest_experimental\r\nelse\r\n DL_VERSION=${FACTORIO_VERSION}\r\nfi\r\n\r\necho -e \"\\n running 'curl -L https:\/\/www.factorio.com\/get-download\/${DL_VERSION}\/headless\/linux64 -o factorio-${DL_VERSION}.tar.gz' \\n\"\r\n\r\ncd \/mnt\/server\r\n\r\ncurl -L https:\/\/www.factorio.com\/get-download\/${DL_VERSION}\/headless\/linux64 -o factorio-${DL_VERSION}.tar.gz\r\n\r\ntar -xf factorio-${DL_VERSION}.tar.gz --strip-components=1 -C \/mnt\/server\r\n\r\nrm factorio-${DL_VERSION}.tar.gz\r\n\r\nif [ -e data\/map-gen-settings.json ]; then\r\n echo \"map-gen exists\"\r\nelse\r\n echo \"copying map-gen default settings\"\r\n mv data\/map-gen-settings.example.json data\/map-gen-settings.json\r\nfi\r\n\r\nif [ -e data\/server-settings.json ]; then\r\n echo \"server settings exists\"\r\nelse\r\n echo \"copying server default settings\"\r\n mv data\/server-settings.example.json data\/server-settings.json\r\nfi\r\n\r\nif [ -e map-settings.json ]; then\r\n echo \"map settings exists\"\r\nelse\r\n echo \"copying map default settings\"\r\n mv data\/map-settings.example.json data\/map-settings.json\r\nfi\r\n\r\nif [ -e ${SAVE_NAME}.zip ]; then\r\n echo \"save file exists\"\r\nelse\r\n .\/bin\/x64\/factorio --create ${SAVE_NAME}\r\n chmod o+w ${SAVE_NAME}.zip\r\nfi",
>>>>>>> 4cc093031372bdf930226de3ff4bb4f81c8a7cf6
"container": "frolvlad\/alpine-glibc", "container": "frolvlad\/alpine-glibc",
"entrypoint": "ash" "entrypoint": "ash"
} }
@ -49,15 +41,6 @@
"user_editable": 0, "user_editable": 0,
"rules": "required|numeric|digits_between:1,3" "rules": "required|numeric|digits_between:1,3"
}, },
{
"name": "Server Password",
"description": "Password to log onto the server.",
"env_variable": "SERVER_PASS",
"default_value": "password",
"user_viewable": 1,
"user_editable": 1,
"rules": "alpha_dash|between:1,100"
},
{ {
"name": "Save Name", "name": "Save Name",
"description": "The save name for the server.", "description": "The save name for the server.",
@ -66,6 +49,69 @@
"user_viewable": 1, "user_viewable": 1,
"user_editable": 1, "user_editable": 1,
"rules": "alpha_dash|between:1,100" "rules": "alpha_dash|between:1,100"
},
{
"name": "Server Token",
"description": "Your factorio.com token, it is required for your server to be visible in the public server list.",
"env_variable": "SERVER_TOKEN",
"default_value": "undefined",
"user_viewable": 1,
"user_editable": 1,
"rules": "alpha_num|max:100"
},
{
"name": "Server Name",
"description": "Name of the game as it will appear in the game listing",
"env_variable": "SERVER_NAME",
"default_value": "Factorio Server",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|string|max:100"
},
{
"name": "Server Description",
"description": "Description of the game that will appear in the listing.",
"env_variable": "SERVER_DESC",
"default_value": "Description",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|string|max:200"
},
{
"name": "Server Username",
"description": "Username used for the server",
"env_variable": "SERVER_USERNAME",
"default_value": "unnamed",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|string|max:40"
},
{
"name": "Auto Save Interval",
"description": "Time between auto saves specified in minutes",
"env_variable": "SAVE_INTERVAL",
"default_value": "10",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|numeric|digits_between:1,3"
},
{
"name": "Auto Save Slots",
"description": "The number of auto saves to keep.",
"env_variable": "SAVE_SLOTS",
"default_value": "5",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|numeric|digits_between:1,3"
},
{
"name": "AFK Kick",
"description": "Time specified in minutes to kick AFK players.\r\n0 is off",
"env_variable": "AFK_KICK",
"default_value": "0",
"user_viewable": 1,
"user_editable": 1,
"rules": "required|numeric|digits_between:1,3"
} }
] ]
} }