Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Update config to work with new caddy version #2112

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Gorian
Copy link
Contributor

@Gorian Gorian commented Feb 2, 2023

added git config pull.ff only to startup command to fix git warning, and updated caddy run command as new version uses --config instead of -config

Description

Checklist for all submissions

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you tested and reviewed your changes with confidence that everything works?
  • Did you branch your changes and PR from that branch and not from your master branch?
    • If not, why?:
  • You verify that the start command applied does not use a shell script
    • If some script is needed then it is part of a current yolk or a PR to add one
  • The egg was exported from the panel

New egg Submissions

  1. Does your submission pass tests (server is connectable)?
  2. Does your egg use a custom docker image?
    • Have you tried to use a generic image?
    • Did you PR the necessary changes to make it work?
  3. Have you added the egg to the main README.md and any other README files in subdirectories of the egg (e.g /game_eggs) according to the alphabetical order?
  4. Have you added a unique README.md for the egg you are adding according to the alphabetical order?
  5. You verify that the start command applied does not use a shell script
    • If some script is needed then it is part of a current yolk or a PR to add one
  6. The egg was exported from the panel

added `git config pull.ff only` to startup command to fix git warning, and updated caddy run command as new version uses `--config` instead of `-config`
@parkervcp
Copy link
Collaborator

@Gorian I ask that you fill out the checklist in the PR.

@Gorian
Copy link
Contributor Author

Gorian commented Feb 3, 2023

Oops, my bad! Done @parkervcp :)

"logs": "{}",
"stop": "^C"
},
"scripts": {
"installation": {
"script": "#!\/bin\/bash\r\n# 5e Tools install script\r\n#\r\n# Server Files: \/mnt\/server\r\ndeclare -r DIR=\"\/mnt\/server\"\r\ndeclare -r CADDY_INSTALL_URL=\"https:\/\/caddyserver.com\/api\/download?os=linux&arch=amd64&idempotency=41554620449867\"\r\ndeclare -r LOCAL_REPO=\"${DIR}\/5e-tools\"\r\n\r\ndie() {\r\n local message=\"$1\"\r\n printf \"\\n%s\\n\" \"${message}\"\r\n exit 2\r\n}\r\ncd_error() {\r\n die \"ERROR: installation encountered an error while trying to change directory\"\r\n}\r\n\r\nmain() {\r\n local git_origin\r\n apt update\r\n apt install -y wget\r\n cd \"${DIR}\" || cd_error\r\n printf \"\\nInstalling Caddy...\\n\"\r\n wget \"${CADDY_INSTALL_URL}\" -O .\/caddy\r\n chmod +x .\/caddy\r\n printf \"\\nGenerating Caddy configuration...\\n\"\r\n # this is a default config\r\n # key variables, such as the port, will get overwritten with the pterodactyl\r\n # configuration parser\r\n cat <<EOF >\"${DIR}\/caddy.json\"\r\n{\r\n \"apps\": {\r\n \"http\": {\r\n \"servers\": {\r\n \"srv0\": {\r\n \"listen\": [\r\n \":8080\"\r\n ],\r\n \"routes\": [\r\n {\r\n \"handle\": [\r\n {\r\n \"handler\": \"vars\",\r\n \"root\": \"\/home\/container\/5e-tools\"\r\n },\r\n {\r\n \"encodings\": {\r\n \"gzip\": {},\r\n \"zstd\": {}\r\n },\r\n \"handler\": \"encode\",\r\n \"prefer\": [\r\n \"zstd\",\r\n \"gzip\"\r\n ]\r\n },\r\n {\r\n \"handler\": \"file_server\"\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n }\r\n }\r\n }\r\n}\r\nEOF\r\n git config --global pull.ff only\r\n if [[ ! -d \"${LOCAL_REPO}\" ]]; then\r\n printf \"\\nCloning latest version (this may take a while)...\\n\"\r\n # $REPOSITORY is passed via environment variable from pterodactyl\r\n git clone \"${REPOSITORY}\" \"${LOCAL_REPO}\"\r\n else\r\n cd \"${LOCAL_REPO}\" || cd_error\r\n git_origin=\"$(git config --get remote.origin.url)\"\r\n cd \"${DIR}\" || cd_error\r\n printf \"\\n\\ngit origin is %s\\n\\n\" \"${git_origin}\"\r\n # if the user hasn't change the repository variable\r\n if [[ \"${git_origin}\" == \"${REPOSITORY}\" ]]; then\r\n cd \"${LOCAL_REPO}\" || cd_error\r\n printf \"\\nRepository already installed - updating...\\n\"\r\n git fetch --all\r\n git reset --hard origin\/master\r\n git pull\r\n cd \"${DIR}\" || cd_error\r\n else\r\n printf \"\\nRepository variable changed since last update\\n...\\n\"\r\n rm -rf \"${LOCAL_REPO}\"\r\n git clone \"${REPOSITORY}\" \"${LOCAL_REPO}\"\r\n fi\r\n fi\r\n printf \"\\nInstallation Complete\\n\"\r\n}\r\nmain \"@\"",
"script": "#!\/bin\/bash\r\n# 5e Tools install script\r\n#\r\n# Server Files: \/mnt\/server\r\ndeclare -r DIR=\"\/mnt\/server\"\r\ndeclare -r CADDY_INSTALL_URL=\"https:\/\/caddyserver.com\/api\/download?os=linux&arch=amd64\"\r\ndeclare -r LOCAL_REPO=\"${DIR}\/5e-tools\"\r\n\r\ndie() {\r\n local message=\"$1\"\r\n printf \"\\n%s\\n\" \"${message}\"\r\n exit 2\r\n}\r\n\r\ncd_error() {\r\n die \"ERROR: installation encountered an error while trying to change directory\"\r\n}\r\n\r\nmain() {\r\n local git_origin\r\n apt update\r\n apt install -y wget\r\n cd \"${DIR}\" || cd_error\r\n printf \"\\nInstalling Caddy...\\n\"\r\n wget \"${CADDY_INSTALL_URL}\" -O .\/caddy\r\n chmod +x .\/caddy\r\n printf \"\\nGenerating Caddy configuration...\\n\"\r\n # this is a default config\r\n # key variables, such as the port, will get overwritten with the pterodactyl\r\n # configuration parser\r\n cat <<EOF >\"${DIR}\/caddy.json\"\r\n{\r\n \"apps\": {\r\n \"http\": {\r\n \"servers\": {\r\n \"srv0\": {\r\n \"listen\": [\r\n \":8080\"\r\n ],\r\n \"routes\": [\r\n {\r\n \"handle\": [\r\n {\r\n \"handler\": \"vars\",\r\n \"root\": \"\/home\/container\/5e-tools\"\r\n },\r\n {\r\n \"encodings\": {\r\n \"gzip\": {},\r\n \"zstd\": {}\r\n },\r\n \"handler\": \"encode\",\r\n \"prefer\": [\r\n \"zstd\",\r\n \"gzip\"\r\n ]\r\n },\r\n {\r\n \"handler\": \"file_server\"\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n }\r\n }\r\n }\r\n}\r\nEOF\r\n git config --global pull.ff only\r\n if [[ ! -d \"${LOCAL_REPO}\" ]]; then\r\n printf \"\\nCloning latest version (this may take a while)...\\n\"\r\n # $REPOSITORY is passed via environment variable from pterodactyl\r\n git clone \"${REPOSITORY}\" \"${LOCAL_REPO}\" --progress\r\n else\r\n cd \"${LOCAL_REPO}\" || cd_error\r\n git_origin=\"$(git config --get remote.origin.url)\"\r\n cd \"${DIR}\" || cd_error\r\n printf \"\\n\\ngit origin is %s\\n\\n\" \"${git_origin}\"\r\n # if the user hasn't change the repository variable\r\n if [[ \"${git_origin}\" == \"${REPOSITORY}\" ]]; then\r\n cd \"${LOCAL_REPO}\" || cd_error\r\n printf \"\\nRepository already installed - updating...\\n\"\r\n git fetch --all\r\n git reset --hard origin\/master\r\n git pull\r\n cd \"${DIR}\" || cd_error\r\n else\r\n printf \"\\nRepository variable changed since last update\\n...\\n\"\r\n rm -rf \"${LOCAL_REPO}\"\r\n git clone \"${REPOSITORY}\" \"${LOCAL_REPO}\"\r\n fi\r\n fi\r\n printf \"\\nInstallation Complete\\n\"\r\n}\r\nmain \"@\"",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All you changed was to remove the idempotency from the url and add --progressto a git clone. This doesn't appear to actually change a config

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦🏻 I thought the new start command got exported too. I'll fix.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Gorian please look at PR

@QuintenQVD0 QuintenQVD0 marked this pull request as draft August 6, 2023 13:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants