From 8eb3f761e7becf00e71754742e3ca3713787294b Mon Sep 17 00:00:00 2001 From: Michael Parker Date: Wed, 12 Jun 2019 17:41:25 -0400 Subject: [PATCH 1/4] updated install script. --- bots/discord/discord.js/egg-discord-js-generic.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bots/discord/discord.js/egg-discord-js-generic.json b/bots/discord/discord.js/egg-discord-js-generic.json index 7bd0d3b7..aa277b42 100644 --- a/bots/discord/discord.js/egg-discord-js-generic.json +++ b/bots/discord/discord.js/egg-discord-js-generic.json @@ -3,7 +3,7 @@ "meta": { "version": "PTDL_v1" }, - "exported_at": "2019-04-01T15:16:34-04:00", + "exported_at": "2019-06-12T17:40:57-04: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.", @@ -17,7 +17,7 @@ }, "scripts": { "installation": { - "script": "#\/bin\/ash\r\n\r\napk add --no-cache git\r\n\r\ncd \/mnt\/server\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", + "script": "#\/bin\/ash\r\n\r\napk add --no-cache git make gcc g++ python\r\n\r\ncd \/mnt\/server\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" } From b076ca8a9b5bf52edc7467c10a996a71621f257a Mon Sep 17 00:00:00 2001 From: Michael Parker Date: Wed, 12 Jun 2019 17:48:11 -0400 Subject: [PATCH 2/4] fix startup conf fix startup conf for those easily confused. --- bots/discord/discord.js/egg-discord-js-generic.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bots/discord/discord.js/egg-discord-js-generic.json b/bots/discord/discord.js/egg-discord-js-generic.json index aa277b42..8017c49a 100644 --- a/bots/discord/discord.js/egg-discord-js-generic.json +++ b/bots/discord/discord.js/egg-discord-js-generic.json @@ -3,7 +3,7 @@ "meta": { "version": "PTDL_v1" }, - "exported_at": "2019-06-12T17:40:57-04:00", + "exported_at": "2019-06-12T17:47:09-04: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.", @@ -11,7 +11,7 @@ "startup": "\/usr\/local\/bin\/node \/home\/container\/index.js", "config": { "files": "{}", - "startup": "{}", + "startup": "{\r\n \"done\": \"change this part\"\r\n}", "logs": "{}", "stop": "^c" }, From 2e2d70635e795b0d0137770f15a1a7454ae7e0a0 Mon Sep 17 00:00:00 2001 From: "Michael (Parker) Parker" Date: Thu, 13 Jun 2019 10:46:29 -0400 Subject: [PATCH 3/4] update discordjs start command add an auto update variable added command to run git pull if .git and auto_update are set added npm install to start command. --- bots/discord/discord.js/egg-discord-js-generic.json | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bots/discord/discord.js/egg-discord-js-generic.json b/bots/discord/discord.js/egg-discord-js-generic.json index 8017c49a..573ca56c 100644 --- a/bots/discord/discord.js/egg-discord-js-generic.json +++ b/bots/discord/discord.js/egg-discord-js-generic.json @@ -3,12 +3,12 @@ "meta": { "version": "PTDL_v1" }, - "exported_at": "2019-06-12T17:47:09-04:00", + "exported_at": "2019-06-13T10:40:57-04: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:bot_discordjs", - "startup": "\/usr\/local\/bin\/node \/home\/container\/index.js", + "startup": "if [[ -d .git ]] && [[ ${AUTO_UPDATE} == \"1\" ]]; then git pull; fi && \/usr\/local\/bin\/npm install --production && \/usr\/local\/bin\/node \/home\/container\/index.js", "config": { "files": "{}", "startup": "{\r\n \"done\": \"change this part\"\r\n}", @@ -49,6 +49,15 @@ "user_viewable": 1, "user_editable": 0, "rules": "required|bool" + }, + { + "name": "Auto Update", + "description": "When using a git repo pull the latest files on startup.", + "env_variable": "AUTO_UPDATE", + "default_value": "false", + "user_viewable": 1, + "user_editable": 1, + "rules": "required|boolean" } ] } \ No newline at end of file From 68726f7074c4c4683ce468bf6812e894d9f84a24 Mon Sep 17 00:00:00 2001 From: Michael Parker Date: Sun, 16 Jun 2019 11:08:16 -0400 Subject: [PATCH 4/4] fix start command --- bots/discord/discord.js/egg-discord-js-generic.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bots/discord/discord.js/egg-discord-js-generic.json b/bots/discord/discord.js/egg-discord-js-generic.json index 573ca56c..9ea8f656 100644 --- a/bots/discord/discord.js/egg-discord-js-generic.json +++ b/bots/discord/discord.js/egg-discord-js-generic.json @@ -3,12 +3,12 @@ "meta": { "version": "PTDL_v1" }, - "exported_at": "2019-06-13T10:40:57-04:00", + "exported_at": "2019-06-16T11:06:52-04: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:bot_discordjs", - "startup": "if [[ -d .git ]] && [[ ${AUTO_UPDATE} == \"1\" ]]; then git pull; fi && \/usr\/local\/bin\/npm install --production && \/usr\/local\/bin\/node \/home\/container\/index.js", + "startup": "`if [[ -d .git ]] && [[ ${AUTO_UPDATE} == \"1\" ]]; then git pull; fi && \/usr\/local\/bin\/npm install --production && \/usr\/local\/bin\/node \/home\/container\/index.js`", "config": { "files": "{}", "startup": "{\r\n \"done\": \"change this part\"\r\n}", @@ -54,7 +54,7 @@ "name": "Auto Update", "description": "When using a git repo pull the latest files on startup.", "env_variable": "AUTO_UPDATE", - "default_value": "false", + "default_value": "0", "user_viewable": 1, "user_editable": 1, "rules": "required|boolean"