mirror of
				https://gitea.augustin64.fr/piair/MsRewards-Reborn.git
				synced 2025-11-04 07:33:53 +01:00 
			
		
		
		
	bon je sais toujours pas ce que j'ai fait mais ptet que ca marche mieux qu'avant
This commit is contained in:
		
							
								
								
									
										27
									
								
								config.sh
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								config.sh
									
									
									
									
									
								
							@@ -1,3 +1,9 @@
 | 
				
			|||||||
 | 
					red=`tput setaf 1`
 | 
				
			||||||
 | 
					green=`tput setaf 2`
 | 
				
			||||||
 | 
					blue=`tput setaf 4`
 | 
				
			||||||
 | 
					reset=`tput sgr0`
 | 
				
			||||||
 | 
					echo "${blue}setting up NGINX${reset}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
rm /etc/nginx/sites-available/default
 | 
					rm /etc/nginx/sites-available/default
 | 
				
			||||||
echo "
 | 
					echo "
 | 
				
			||||||
map \$http_upgrade \$connection_upgrade {
 | 
					map \$http_upgrade \$connection_upgrade {
 | 
				
			||||||
@@ -33,10 +39,31 @@ server {
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
" >> /etc/nginx/sites-available/default
 | 
					" >> /etc/nginx/sites-available/default
 | 
				
			||||||
 | 
					echo "${green}NGINX configuration successfull${reset}"
 | 
				
			||||||
service nginx restart
 | 
					service nginx restart
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "${blue}creating sqlite databases${reset}"
 | 
				
			||||||
sqlite3 /app/MsRewards-Reborn/MsRewards.db "CREATE TABLE daily (id INTEGER PRIMARY KEY,compte TEXT,points int,date TEXT);"
 | 
					sqlite3 /app/MsRewards-Reborn/MsRewards.db "CREATE TABLE daily (id INTEGER PRIMARY KEY,compte TEXT,points int,date TEXT);"
 | 
				
			||||||
sqlite3 /app/MsRewards-Reborn/MsRewards.db "CREATE TABLE comptes (id INTEGER PRIMARY KEY,compte TEXT,last_pts int, banned int);"
 | 
					sqlite3 /app/MsRewards-Reborn/MsRewards.db "CREATE TABLE comptes (id INTEGER PRIMARY KEY,compte TEXT,last_pts int, banned int);"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "${blue}configurating grafana${reset}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cp /app/MsRewards-Reborn/grafana-config/grafana.ini /etc/grafana/
 | 
					cp /app/MsRewards-Reborn/grafana-config/grafana.ini /etc/grafana/
 | 
				
			||||||
grafana-cli plugins install frser-sqlite-datasource
 | 
					grafana-cli plugins install frser-sqlite-datasource
 | 
				
			||||||
 | 
					service grafana-server restart
 | 
				
			||||||
 | 
					curl -X "POST" "http://localhost:3000/api/datasources" \
 | 
				
			||||||
 | 
					    -H "Content-Type: application/json" \
 | 
				
			||||||
 | 
					     --user admin:admin \
 | 
				
			||||||
 | 
					     --data-raw $'{"id":1,"uid":"bed26262-6b98-4dfc-a95d-f8bd39b5d09c","orgId":1,"name":"SQLite","type":"frser-sqlite-datasource","typeName":"SQLite","typeLogoUrl":"public/plugins/frser-sqlite-datasource/img/logo.svg","access":"proxy","url":"","user":"","database":"","basicAuth":false,"isDefault":true,"jsonData":{"attachLimit":0,"path":"/app/MsRewards-Reborn/MsRewards.db","pathPefix":"file:"},"readOnly":false}'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					curl 'http://192.168.1.32:5555/grafana/api/dashboards/import' \
 | 
				
			||||||
 | 
					  -H 'content-type: application/json' \
 | 
				
			||||||
 | 
					  -H 'x-grafana-org-id: 1' \
 | 
				
			||||||
 | 
					  --user admin:admin \
 | 
				
			||||||
 | 
					  --data-raw $'{"dashboard":{"annotations":{"list":[{"builtIn":1,"datasource":{"type":"grafana","uid":"-- Grafana --"},"enable":true,"hide":true,"iconColor":"rgba(0, 211, 255, 1)","name":"Annotations & Alerts","type":"dashboard"}]},"editable":true,"fiscalYearStartMonth":0,"graphTooltip":0,"id":null,"links":[],"liveNow":false,"panels":[{"datasource":{"type":"frser-sqlite-datasource","uid":"bed26262-6b98-4dfc-a95d-f8bd39b5d09c"},"fieldConfig":{"defaults":{"color":{"mode":"thresholds"},"mappings":[],"max":10000,"thresholds":{"mode":"absolute","steps":[{"color":"dark-red","value":null},{"color":"dark-yellow","value":2000},{"color":"green","value":7500},{"color":"blue","value":10000}]}},"overrides":[]},"gridPos":{"h":11,"w":24,"x":0,"y":0},"id":3,"options":{"displayMode":"gradient","minVizHeight":10,"minVizWidth":0,"orientation":"auto","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showUnfilled":true,"valueMode":"color"},"pluginVersion":"10.0.3","targets":[{"datasource":{"type":"frser-sqlite-datasource","uid":"bed26262-6b98-4dfc-a95d-f8bd39b5d09c"},"queryText":"SELECT\\n  unixepoch() as time,\\n  c.compte,\\n  c.last_pts as \\"\\"\\nFROM \\n  comptes c;\\n","queryType":"time series","rawQueryText":"SELECT\\n  unixepoch() as time,\\n  c.compte,\\n  c.last_pts as \\"\\"\\nFROM \\n  comptes c;\\n","refId":"A","timeColumns":["time","ts"]}],"title":"Account points","type":"bargauge"},{"datasource":{"type":"frser-sqlite-datasource","uid":"bed26262-6b98-4dfc-a95d-f8bd39b5d09c"},"fieldConfig":{"defaults":{"color":{"mode":"thresholds"},"mappings":[],"max":300,"thresholds":{"mode":"absolute","steps":[{"color":"dark-red","value":null},{"color":"dark-green","value":200}]}},"overrides":[]},"gridPos":{"h":11,"w":24,"x":0,"y":11},"id":4,"options":{"displayMode":"gradient","minVizHeight":10,"minVizWidth":0,"orientation":"auto","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showUnfilled":true,"valueMode":"color"},"pluginVersion":"10.0.3","targets":[{"datasource":{"type":"frser-sqlite-datasource","uid":"bed26262-6b98-4dfc-a95d-f8bd39b5d09c"},"queryText":"SELECT\\n  unixepoch() as time,\\n  c.compte as metric,\\n  c.last_pts - d2.points as \'\'\\nFROM \\n  comptes c \\nLEFT OUTER JOIN \\n  daily d1 \\nON \\n  c.compte = d1.compte \\nAND \\n  d1.date = date()  \\n  LEFT OUTER JOIN daily d2 ON c.compte = d2.compte  AND  d2.date = DATE(\'now\',\'-1 day\')\\nORDER BY d1.points DESC","queryType":"time series","rawQueryText":"SELECT\\n  unixepoch() as time,\\n  c.compte as metric,\\n  c.last_pts - d2.points as \'\'\\nFROM \\n  comptes c \\nLEFT OUTER JOIN \\n  daily d1 \\nON \\n  c.compte = d1.compte \\nAND \\n  d1.date = date()  \\n  LEFT OUTER JOIN daily d2 ON c.compte = d2.compte  AND  d2.date = DATE(\'now\',\'-1 day\')\\nORDER BY d1.points DESC","refId":"A","timeColumns":["time","ts"]}],"title":"Daily progress","type":"bargauge"}],"refresh":"","schemaVersion":38,"style":"dark","tags":[],"templating":{"list":[]},"time":{"from":"now-6h","to":"now"},"timepicker":{},"timezone":"","title":"main","uid":"stats","version":14,"weekStart":""},"overwrite":true,"inputs":[],"folderUid":""}' \
 | 
				
			||||||
 | 
					  --compressed \
 | 
				
			||||||
 | 
					  --insecure
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "setting up default dashboard"
 | 
				
			||||||
 | 
					cp /app/MsRewards-Reborn/grafana-config/Stats-dashbord.json /usr/share/grafana/public/dashboards/home.json 
 | 
				
			||||||
							
								
								
									
										191
									
								
								modules/grafana-config/Stats-dashbord.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										191
									
								
								modules/grafana-config/Stats-dashbord.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,191 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					  "annotations": {
 | 
				
			||||||
 | 
					    "list": [
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        "builtIn": 1,
 | 
				
			||||||
 | 
					        "datasource": {
 | 
				
			||||||
 | 
					          "type": "grafana",
 | 
				
			||||||
 | 
					          "uid": "-- Grafana --"
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        "enable": true,
 | 
				
			||||||
 | 
					        "hide": true,
 | 
				
			||||||
 | 
					        "iconColor": "rgba(0, 211, 255, 1)",
 | 
				
			||||||
 | 
					        "name": "Annotations & Alerts",
 | 
				
			||||||
 | 
					        "type": "dashboard"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "editable": true,
 | 
				
			||||||
 | 
					  "fiscalYearStartMonth": 0,
 | 
				
			||||||
 | 
					  "graphTooltip": 0,
 | 
				
			||||||
 | 
					  "id": 1,
 | 
				
			||||||
 | 
					  "links": [],
 | 
				
			||||||
 | 
					  "liveNow": false,
 | 
				
			||||||
 | 
					  "panels": [
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      "datasource": {
 | 
				
			||||||
 | 
					        "type": "frser-sqlite-datasource",
 | 
				
			||||||
 | 
					        "uid": "bed26262-6b98-4dfc-a95d-f8bd39b5d09c"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "fieldConfig": {
 | 
				
			||||||
 | 
					        "defaults": {
 | 
				
			||||||
 | 
					          "color": {
 | 
				
			||||||
 | 
					            "mode": "thresholds"
 | 
				
			||||||
 | 
					          },
 | 
				
			||||||
 | 
					          "mappings": [],
 | 
				
			||||||
 | 
					          "max": 10000,
 | 
				
			||||||
 | 
					          "thresholds": {
 | 
				
			||||||
 | 
					            "mode": "absolute",
 | 
				
			||||||
 | 
					            "steps": [
 | 
				
			||||||
 | 
					              {
 | 
				
			||||||
 | 
					                "color": "dark-red",
 | 
				
			||||||
 | 
					                "value": null
 | 
				
			||||||
 | 
					              },
 | 
				
			||||||
 | 
					              {
 | 
				
			||||||
 | 
					                "color": "dark-yellow",
 | 
				
			||||||
 | 
					                "value": 2000
 | 
				
			||||||
 | 
					              },
 | 
				
			||||||
 | 
					              {
 | 
				
			||||||
 | 
					                "color": "green",
 | 
				
			||||||
 | 
					                "value": 7500
 | 
				
			||||||
 | 
					              },
 | 
				
			||||||
 | 
					              {
 | 
				
			||||||
 | 
					                "color": "blue",
 | 
				
			||||||
 | 
					                "value": 10000
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					            ]
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        "overrides": []
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "gridPos": {
 | 
				
			||||||
 | 
					        "h": 11,
 | 
				
			||||||
 | 
					        "w": 24,
 | 
				
			||||||
 | 
					        "x": 0,
 | 
				
			||||||
 | 
					        "y": 0
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "id": 3,
 | 
				
			||||||
 | 
					      "options": {
 | 
				
			||||||
 | 
					        "displayMode": "gradient",
 | 
				
			||||||
 | 
					        "minVizHeight": 10,
 | 
				
			||||||
 | 
					        "minVizWidth": 0,
 | 
				
			||||||
 | 
					        "orientation": "auto",
 | 
				
			||||||
 | 
					        "reduceOptions": {
 | 
				
			||||||
 | 
					          "calcs": [
 | 
				
			||||||
 | 
					            "lastNotNull"
 | 
				
			||||||
 | 
					          ],
 | 
				
			||||||
 | 
					          "fields": "",
 | 
				
			||||||
 | 
					          "values": false
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        "showUnfilled": true,
 | 
				
			||||||
 | 
					        "valueMode": "color"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "pluginVersion": "10.0.3",
 | 
				
			||||||
 | 
					      "targets": [
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          "datasource": {
 | 
				
			||||||
 | 
					            "type": "frser-sqlite-datasource",
 | 
				
			||||||
 | 
					            "uid": "bed26262-6b98-4dfc-a95d-f8bd39b5d09c"
 | 
				
			||||||
 | 
					          },
 | 
				
			||||||
 | 
					          "queryText": "SELECT\n  unixepoch() as time,\n  c.compte,\n  c.last_pts as \"\"\nFROM \n  comptes c;\n",
 | 
				
			||||||
 | 
					          "queryType": "time series",
 | 
				
			||||||
 | 
					          "rawQueryText": "SELECT\n  unixepoch() as time,\n  c.compte,\n  c.last_pts as \"\"\nFROM \n  comptes c;\n",
 | 
				
			||||||
 | 
					          "refId": "A",
 | 
				
			||||||
 | 
					          "timeColumns": [
 | 
				
			||||||
 | 
					            "time",
 | 
				
			||||||
 | 
					            "ts"
 | 
				
			||||||
 | 
					          ]
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					      "title": "Account points",
 | 
				
			||||||
 | 
					      "type": "bargauge"
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      "datasource": {
 | 
				
			||||||
 | 
					        "type": "frser-sqlite-datasource",
 | 
				
			||||||
 | 
					        "uid": "bed26262-6b98-4dfc-a95d-f8bd39b5d09c"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "fieldConfig": {
 | 
				
			||||||
 | 
					        "defaults": {
 | 
				
			||||||
 | 
					          "color": {
 | 
				
			||||||
 | 
					            "mode": "thresholds"
 | 
				
			||||||
 | 
					          },
 | 
				
			||||||
 | 
					          "mappings": [],
 | 
				
			||||||
 | 
					          "max": 300,
 | 
				
			||||||
 | 
					          "thresholds": {
 | 
				
			||||||
 | 
					            "mode": "absolute",
 | 
				
			||||||
 | 
					            "steps": [
 | 
				
			||||||
 | 
					              {
 | 
				
			||||||
 | 
					                "color": "dark-red",
 | 
				
			||||||
 | 
					                "value": null
 | 
				
			||||||
 | 
					              },
 | 
				
			||||||
 | 
					              {
 | 
				
			||||||
 | 
					                "color": "dark-green",
 | 
				
			||||||
 | 
					                "value": 200
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					            ]
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        "overrides": []
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "gridPos": {
 | 
				
			||||||
 | 
					        "h": 11,
 | 
				
			||||||
 | 
					        "w": 24,
 | 
				
			||||||
 | 
					        "x": 0,
 | 
				
			||||||
 | 
					        "y": 11
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "id": 4,
 | 
				
			||||||
 | 
					      "options": {
 | 
				
			||||||
 | 
					        "displayMode": "gradient",
 | 
				
			||||||
 | 
					        "minVizHeight": 10,
 | 
				
			||||||
 | 
					        "minVizWidth": 0,
 | 
				
			||||||
 | 
					        "orientation": "auto",
 | 
				
			||||||
 | 
					        "reduceOptions": {
 | 
				
			||||||
 | 
					          "calcs": [
 | 
				
			||||||
 | 
					            "lastNotNull"
 | 
				
			||||||
 | 
					          ],
 | 
				
			||||||
 | 
					          "fields": "",
 | 
				
			||||||
 | 
					          "values": false
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        "showUnfilled": true,
 | 
				
			||||||
 | 
					        "valueMode": "color"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "pluginVersion": "10.0.3",
 | 
				
			||||||
 | 
					      "targets": [
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          "datasource": {
 | 
				
			||||||
 | 
					            "type": "frser-sqlite-datasource",
 | 
				
			||||||
 | 
					            "uid": "bed26262-6b98-4dfc-a95d-f8bd39b5d09c"
 | 
				
			||||||
 | 
					          },
 | 
				
			||||||
 | 
					          "queryText": "SELECT\n  unixepoch() as time,\n  c.compte as metric,\n  c.last_pts - d2.points as ''\nFROM \n  comptes c \nLEFT OUTER JOIN \n  daily d1 \nON \n  c.compte = d1.compte \nAND \n  d1.date = date()  \n  LEFT OUTER JOIN daily d2 ON c.compte = d2.compte  AND  d2.date = DATE('now','-1 day')\nORDER BY d1.points DESC",
 | 
				
			||||||
 | 
					          "queryType": "time series",
 | 
				
			||||||
 | 
					          "rawQueryText": "SELECT\n  unixepoch() as time,\n  c.compte as metric,\n  c.last_pts - d2.points as ''\nFROM \n  comptes c \nLEFT OUTER JOIN \n  daily d1 \nON \n  c.compte = d1.compte \nAND \n  d1.date = date()  \n  LEFT OUTER JOIN daily d2 ON c.compte = d2.compte  AND  d2.date = DATE('now','-1 day')\nORDER BY d1.points DESC",
 | 
				
			||||||
 | 
					          "refId": "A",
 | 
				
			||||||
 | 
					          "timeColumns": [
 | 
				
			||||||
 | 
					            "time",
 | 
				
			||||||
 | 
					            "ts"
 | 
				
			||||||
 | 
					          ]
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					      "title": "Daily progress",
 | 
				
			||||||
 | 
					      "type": "bargauge"
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  ],
 | 
				
			||||||
 | 
					  "refresh": "",
 | 
				
			||||||
 | 
					  "schemaVersion": 38,
 | 
				
			||||||
 | 
					  "style": "dark",
 | 
				
			||||||
 | 
					  "tags": [],
 | 
				
			||||||
 | 
					  "templating": {
 | 
				
			||||||
 | 
					    "list": []
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "time": {
 | 
				
			||||||
 | 
					    "from": "now-6h",
 | 
				
			||||||
 | 
					    "to": "now"
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "timepicker": {},
 | 
				
			||||||
 | 
					  "timezone": "",
 | 
				
			||||||
 | 
					  "title": "Stats",
 | 
				
			||||||
 | 
					  "uid": "e70d4980-36d1-4107-90b0-d9164ae8ead4",
 | 
				
			||||||
 | 
					  "version": 14,
 | 
				
			||||||
 | 
					  "weekStart": ""
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										1
									
								
								modules/grafana-config/aa
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								modules/grafana-config/aa
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					{"id":1,"uid":"bed26262-6b98-4dfc-a95d-f8bd39b5d09c","orgId":1,"name":"SQLite","type":"frser-sqlite-datasource","typeName":"SQLite","typeLogoUrl":"public/plugins/frser-sqlite-datasource/img/logo.svg","access":"proxy","url":"","user":"","database":"","basicAuth":false,"isDefault":true,"jsonData":{"attachLimit":0,"path":"/app/MsRewards-Reborn/MsRewards.db","pathPefix":"file:"},"readOnly":false}
 | 
				
			||||||
@@ -548,10 +548,10 @@ root_url = %(protocol)s://localhost:3000/grafana/
 | 
				
			|||||||
#################################### Anonymous Auth ######################
 | 
					#################################### Anonymous Auth ######################
 | 
				
			||||||
[auth.anonymous]
 | 
					[auth.anonymous]
 | 
				
			||||||
# enable anonymous access
 | 
					# enable anonymous access
 | 
				
			||||||
;enabled = false
 | 
					enabled = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# specify organization name that should be used for unauthenticated users
 | 
					# specify organization name that should be used for unauthenticated users
 | 
				
			||||||
;org_name = Main Org.
 | 
					org_name = Main Org.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# specify role for unauthenticated users
 | 
					# specify role for unauthenticated users
 | 
				
			||||||
;org_role = Viewer
 | 
					;org_role = Viewer
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user