From c60e256bf3dc0878fd161cfa3feb3cfcb0e64eed Mon Sep 17 00:00:00 2001
From: Pascal Zarrad 
Date: Mon, 5 Jul 2021 20:43:02 +0200
Subject: [PATCH 1/7] Add Grafana readme
---
 software/grafana/README.md | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 software/grafana/README.md
diff --git a/software/grafana/README.md b/software/grafana/README.md
new file mode 100644
index 00000000..57346598
--- /dev/null
+++ b/software/grafana/README.md
@@ -0,0 +1,25 @@
+# Grafama
+
+### From the [Grafana](https://github.com/grafana/grafana) GitHub
+The open and composable observability and data visualization platform.
+Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
+
+### Configuration recommendation
+If you do not manually setup SSL, restrict access to the exposed unencrypted webserver using a firewall.
+Use a reverse proxy (with SSL termination) to make Grafana accessible through ports 80 or 443 alongside
+other services on your local webserver.
+
+# Update support
+The egg _should_ keep the data and conf folder when reinstalling. Therefore a reinstallation with "latest" as the selected version
+can be used to update Grafana. During a reinstallation all plugins will be updated too. Newly added plugins will be installed during
+a reinstallation.
+
+If you want to reset the server completly, remove the `conf` and `data` directories manually before reinstalling.
+
+### Server Ports
+
+Ports required to run the server in a table format.
+
+| Port         | default |
+| ------------ | ------- |
+| Webinterface | 3000    |
From 913ee571c2b809ed51ab27083ce25af9c3916162 Mon Sep 17 00:00:00 2001
From: Pascal Zarrad 
Date: Tue, 6 Jul 2021 00:27:59 +0200
Subject: [PATCH 2/7] Add Grafana egg
---
 software/grafana/egg-grafana.json | 50 +++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 software/grafana/egg-grafana.json
diff --git a/software/grafana/egg-grafana.json b/software/grafana/egg-grafana.json
new file mode 100644
index 00000000..7538141f
--- /dev/null
+++ b/software/grafana/egg-grafana.json
@@ -0,0 +1,50 @@
+{
+    "_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
+    "meta": {
+        "version": "PTDL_v1",
+        "update_url": null
+    },
+    "exported_at": "2021-07-06T11:05:00+02:00",
+    "name": "Grafana",
+    "author": "p.zarrad@outlook.de",
+    "description": "The open and composable observability and data visualization platform.\r\nVisualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.",
+    "features": null,
+    "images": [
+        "quay.io\/parkervcp\/pterodactyl-images:base_debian"
+    ],
+    "file_denylist": [],
+    "startup": ".\/bin\/grafana-server web",
+    "config": {
+        "files": "{\r\n    \"conf\/defaults.ini\": {\r\n        \"parser\": \"ini\",\r\n        \"find\": {\r\n            \"server.http_port\": \"{{server.build.default.port}}\"\r\n        }\r\n    }\r\n}",
+        "startup": "{\r\n    \"done\": \"HTTP Server Listen\"\r\n}",
+        "logs": "{}",
+        "stop": "^C"
+    },
+    "scripts": {
+        "installation": {
+            "script": "#!\/bin\/sh\r\nshopt -s extglob\r\n# Switch to mounted directory\r\ncd \/mnt\/server\r\n# Update installation system and install curl\r\napt-get update && apt-get upgrade -y\r\napt-get install -y curl\r\n# Cleanup previous install if available\r\nrm -rfv !(conf|data)\r\n# Download and extract Grafana\r\nversion=${GRAFANA_VERSION}\r\nif [ \"$version\" = \"latest\" ]; then version=$(curl --silent \"https:\/\/api.github.com\/repos\/grafana\/grafana\/releases\/latest\" | grep '\"tag_name\":' | sed -E 's\/.*\"([^\"]+)\".*\/\\1\/' | cut -c2-); fi\r\ncurl https:\/\/dl.grafana.com\/oss\/release\/grafana-${version}.linux-amd64.tar.gz --output grafana.tar.gz\r\ntar -zxvf grafana.tar.gz\r\nmv -n grafana-*\/* .\/\r\nrm -rf grafana.tar.gz grafana-*\/\r\n# Update existing plugins and install Grafana plugins\r\nif [ \"${GRAFANA_PLUGINS}\" != \"none\" ]; then\r\nfor v in $(tr ',' '\\n' <<< \"${GRAFANA_PLUGINS}\") ; do .\/bin\/grafana-cli --pluginsDir=\"\/mnt\/server\/data\/plugins\" plugins install \"$v\" ; done\r\nfi",
+            "container": "debian:buster-slim",
+            "entrypoint": "bash"
+        }
+    },
+    "variables": [
+        {
+            "name": "Grafana Version",
+            "description": "The version of Grafana to install. By default the latest version is being installed.",
+            "env_variable": "GRAFANA_VERSION",
+            "default_value": "latest",
+            "user_viewable": true,
+            "user_editable": true,
+            "rules": "required|string|max:20"
+        },
+        {
+            "name": "Grafana Plugins",
+            "description": "A list of Grafana plugins that should be installed. Enter the plugins comma separated (e. g. a,b,c).\r\nYou can enter none if you don't want to install any plugins.",
+            "env_variable": "grafana_plugins",
+            "default_value": "none",
+            "user_viewable": true,
+            "user_editable": true,
+            "rules": "required|string"
+        }
+    ]
+}
From df13c87964f7e52375c258a58e2e18a25c7f0022 Mon Sep 17 00:00:00 2001
From: Pascal Zarrad 
Date: Tue, 6 Jul 2021 11:08:43 +0200
Subject: [PATCH 3/7] Update Grafana readme
---
 software/grafana/README.md | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/software/grafana/README.md b/software/grafana/README.md
index 57346598..106a7ee9 100644
--- a/software/grafana/README.md
+++ b/software/grafana/README.md
@@ -4,15 +4,9 @@
 The open and composable observability and data visualization platform.
 Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
 
-### Configuration recommendation
-If you do not manually setup SSL, restrict access to the exposed unencrypted webserver using a firewall.
-Use a reverse proxy (with SSL termination) to make Grafana accessible through ports 80 or 443 alongside
-other services on your local webserver.
-
 # Update support
 The egg _should_ keep the data and conf folder when reinstalling. Therefore a reinstallation with "latest" as the selected version
-can be used to update Grafana. During a reinstallation all plugins will be updated too. Newly added plugins will be installed during
-a reinstallation.
+can be used to update Grafana.
 
 If you want to reset the server completly, remove the `conf` and `data` directories manually before reinstalling.
 
From 4e0a87bb5286bfab865a435c8f91a55b3f29ad07 Mon Sep 17 00:00:00 2001
From: Pascal Zarrad 
Date: Tue, 6 Jul 2021 11:16:45 +0200
Subject: [PATCH 4/7] Add Grafana
---
 README.md | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/README.md b/README.md
index c1df35db..4ba4e9b3 100644
--- a/README.md
+++ b/README.md
@@ -238,3 +238,5 @@ If you are reading this it looks like you are looking to add an egg to your serv
 * [Code-Server](/software/code-server)
 ### haste-server
 * [haste-server](/software/haste-server)
+### Grafana
+* [Grafana](/software/grafana)
From 2cd23d3a73b20ab086191b101e3ea4e1124efc7e Mon Sep 17 00:00:00 2001
From: Pascal Zarrad 
Date: Tue, 6 Jul 2021 11:24:49 +0200
Subject: [PATCH 5/7] Improve Grafana readme and add credentials
---
 software/grafana/README.md | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/software/grafana/README.md b/software/grafana/README.md
index 106a7ee9..286de2ce 100644
--- a/software/grafana/README.md
+++ b/software/grafana/README.md
@@ -4,9 +4,13 @@
 The open and composable observability and data visualization platform.
 Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
 
-# Update support
-The egg _should_ keep the data and conf folder when reinstalling. Therefore a reinstallation with "latest" as the selected version
-can be used to update Grafana.
+### Initial credentials
+After the first start of Grafana, you can login using the following credentials:
+ - Username: admin
+ - Password: admin
+
+### Update support
+The egg _should_ keep the data and conf folder when reinstalling. Therefore a reinstallation with "latest" as the selected version can be used to update Grafana.
 
 If you want to reset the server completly, remove the `conf` and `data` directories manually before reinstalling.
 
From 4c88dcc007811c5ac9baec822dee802e30080ea8 Mon Sep 17 00:00:00 2001
From: Pascal Zarrad 
Date: Tue, 6 Jul 2021 20:17:31 +0200
Subject: [PATCH 6/7] Put Grafana at the right position
---
 README.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 4ba4e9b3..bab4ab94 100644
--- a/README.md
+++ b/README.md
@@ -236,7 +236,7 @@ If you are reading this it looks like you are looking to add an egg to your serv
 ## [Software](/software/)
 ### Code Server
 * [Code-Server](/software/code-server)
-### haste-server
-* [haste-server](/software/haste-server)
 ### Grafana
 * [Grafana](/software/grafana)
+### haste-server
+* [haste-server](/software/haste-server)
From f1027d6cc0c1f15d16c93b02102ea530cc7705eb Mon Sep 17 00:00:00 2001
From: Pascal Zarrad 
Date: Tue, 6 Jul 2021 20:52:06 +0200
Subject: [PATCH 7/7] Improve Grafana installation script
---
 software/grafana/egg-grafana.json | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/software/grafana/egg-grafana.json b/software/grafana/egg-grafana.json
index 7538141f..6b2312d4 100644
--- a/software/grafana/egg-grafana.json
+++ b/software/grafana/egg-grafana.json
@@ -4,7 +4,7 @@
         "version": "PTDL_v1",
         "update_url": null
     },
-    "exported_at": "2021-07-06T11:05:00+02:00",
+    "exported_at": "2021-07-06T23:52:45+02:00",
     "name": "Grafana",
     "author": "p.zarrad@outlook.de",
     "description": "The open and composable observability and data visualization platform.\r\nVisualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.",
@@ -22,7 +22,7 @@
     },
     "scripts": {
         "installation": {
-            "script": "#!\/bin\/sh\r\nshopt -s extglob\r\n# Switch to mounted directory\r\ncd \/mnt\/server\r\n# Update installation system and install curl\r\napt-get update && apt-get upgrade -y\r\napt-get install -y curl\r\n# Cleanup previous install if available\r\nrm -rfv !(conf|data)\r\n# Download and extract Grafana\r\nversion=${GRAFANA_VERSION}\r\nif [ \"$version\" = \"latest\" ]; then version=$(curl --silent \"https:\/\/api.github.com\/repos\/grafana\/grafana\/releases\/latest\" | grep '\"tag_name\":' | sed -E 's\/.*\"([^\"]+)\".*\/\\1\/' | cut -c2-); fi\r\ncurl https:\/\/dl.grafana.com\/oss\/release\/grafana-${version}.linux-amd64.tar.gz --output grafana.tar.gz\r\ntar -zxvf grafana.tar.gz\r\nmv -n grafana-*\/* .\/\r\nrm -rf grafana.tar.gz grafana-*\/\r\n# Update existing plugins and install Grafana plugins\r\nif [ \"${GRAFANA_PLUGINS}\" != \"none\" ]; then\r\nfor v in $(tr ',' '\\n' <<< \"${GRAFANA_PLUGINS}\") ; do .\/bin\/grafana-cli --pluginsDir=\"\/mnt\/server\/data\/plugins\" plugins install \"$v\" ; done\r\nfi",
+            "script": "#!\/bin\/sh\r\nshopt -s extglob\r\n# Switch to mounted directory\r\ncd \/mnt\/server\r\n# Update installation system and install curl\r\napt-get update\r\napt-get install -y curl\r\n# Cleanup previous install if available\r\nif [ -d \"conf\" ]; then mv conf conf.bak; fi\r\nrm -rfv !(conf.bak|data)\r\n# Download and extract Grafana\r\nversion=${GRAFANA_VERSION}\r\nif [ \"$version\" = \"latest\" ]; then version=$(curl --silent \"https:\/\/api.github.com\/repos\/grafana\/grafana\/releases\/latest\" | grep '\"tag_name\":' | sed -E 's\/.*\"([^\"]+)\".*\/\\1\/' | cut -c2-); fi\r\ncurl https:\/\/dl.grafana.com\/oss\/release\/grafana-${version}.linux-amd64.tar.gz --output grafana.tar.gz\r\ntar -zxvf grafana.tar.gz\r\nmv -n grafana-*\/* .\/\r\nrm -rf grafana.tar.gz grafana-*\/\r\n# Restore configuration if necessary\r\nif [ -d \"conf.bak\" ]; then rm -rf conf && mv conf.bak conf && rm -rf conf.bak; fi\r\n# Update existing plugins and install Grafana plugins\r\nif [ ! -z \"${GRAFANA_PLUGINS}\" ]; then\r\nfor v in $(tr ',' '\\n' <<< \"${GRAFANA_PLUGINS}\") ; do .\/bin\/grafana-cli --pluginsDir=\"\/mnt\/server\/data\/plugins\" plugins install \"$v\" ; done\r\nfi",
             "container": "debian:buster-slim",
             "entrypoint": "bash"
         }
@@ -39,12 +39,12 @@
         },
         {
             "name": "Grafana Plugins",
-            "description": "A list of Grafana plugins that should be installed. Enter the plugins comma separated (e. g. a,b,c).\r\nYou can enter none if you don't want to install any plugins.",
+            "description": "A list of Grafana plugins that should be installed. Enter the plugins comma separated (e. g. a,b,c).",
             "env_variable": "grafana_plugins",
-            "default_value": "none",
+            "default_value": "",
             "user_viewable": true,
             "user_editable": true,
-            "rules": "required|string"
+            "rules": "nullable|string"
         }
     ]
 }