Skip to content

Commit

Permalink
Merge pull request #11 from tiennou/develop
Browse files Browse the repository at this point in the history
Lots of cleanup
  • Loading branch information
pieterbrandsen authored Sep 28, 2024
2 parents 1a9933a + 4646d86 commit c5c661e
Show file tree
Hide file tree
Showing 43 changed files with 1,364 additions and 1,017 deletions.
25 changes: 25 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# The port where the Screeps server is listen at
SERVER_PORT=21025

# External port where Grafana listens to
GRAFANA_PORT=3000

# The port where the Push Status API will listen to
# Optional, if unset, the port won't be opened
PUSH_STATUS_PORT=

# A prefix to use when pushing keys to Graphite
PREFIX=

# Admin user for Grafana
ADMIN_USER=admin
ADMIN_PASSWORD=password

# The external hostname for the server Grafana runs on
HOSTNAME=localhost

# Email address Grafana uses for emails
EMAIL_ADDRESS=[email protected]

# Whether anonymous access to Grafana is allowed
ANONYMOUS_AUTH_ENABLED=false
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ module.exports = {
"no-underscore-dangle":"off",
"no-param-reassign": ["error", { "props": false }],
"no-restricted-syntax": "off",
"no-continue": "off",
}
}
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Files
docker-compose.yml
.env
users.json

# Folders
node_modules
Expand Down
59 changes: 22 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,27 @@

## Setup

1. Update all .example files and/or folders to match your needs. This step is not required if you are using the default setup.
2. Add your own Grafana variables in `grafanaConfig/.env.grafana`. This file will be updated after a volume reset.
1. Copy `.env.example` to `.env` and edit to match your needs.
2. Copy `users.example.json` to `users.json` and edit it according to [User Setup](#User-Setup).
3. The configuration files for both Grafana and Graphite are in `config/grafana` and `config/graphite` respectively.
4. If you have a dashboard you want to auto-add, you can drop their JSON files into `config/grafana/provisioning/dashboards`
and they'll be auto-added to the instance.

## Usage

* `npm run start`: start the containers
* `npm run logs`: check the container's logs
* `npm run stop`: stop the containers
* `npm run reset`: remove the containers
* `npm run reset:hard`: remove the containers and their volumes
* `npm run rebuild`: rebuild the pushStats container and restart it; needed if you make changes to its code.

See the scripts section in the package.json file.

Go to [localhost:3000](http://localhost:3000) (if you used port 3000) and login with `admin` and `password` (or your custom set login info).

Its possible to use https for your grafana instance, check out this [tutorial](https://www.turbogeek.co.uk/grafana-how-to-configure-ssl-https-in-grafana/) for example on how to do this, enough info online about it. I dont support this (yet)


### User Setup

Expand Down Expand Up @@ -59,6 +78,7 @@ If the private server is not hosted on localhost, add the host to the user:
"shards": ["screeps"],
"password": "password",
"host": "192.168.1.10",
"port": 21025,
}
```

Expand All @@ -74,38 +94,3 @@ If the segment of the stats is not memory, add it to the user:
"segment": 0,
}
```

Update all .example files and/or folders to match your needs. This step is not required if you are using the default setup.

### Run Commands

#### Config

* `--force`: force the non .example config files to be overwritten.
* `--debug`: listen to setup Docker logs
* `--username`: overwrite the username for the Grafana admin user
* `--password`: overwrite the password for the Grafana admin user
* `--enableAnonymousAccess`: enable anonymous access to Grafana

#### Network

* `--grafanaDomain`: Overwrite grafana.ini domain
* `--grafanaPort`: port for Grafana to run on
* `--relayPort`: port for relay-ng to run on (default: 2003)
* `--pushStatusPort`: port for the stats-getter push API (default: disabled)

#### Exporting

* `--deleteLogs`: deletes the logs folder
* `--removeWhisper`: Deletes the carbon whisper folder
* `--removeVolumes`: Remove all volumes, including the grafana database.

## Usage

* `npm run setup`: to execute setup only
* `npm run start`: to configure and start it
* For other run commands like eslint, check out package.json scripts object.

Go to [localhost:3000](http://localhost:3000) (if you used port 3000) and login with `admin` and `password` (or your custom set login info).

Its possible to use https for your grafana instance, check out this [tutorial](https://www.turbogeek.co.uk/grafana-how-to-configure-ssl-https-in-grafana/) for example on how to do this, enough info online about it. I dont support this (yet)
64 changes: 0 additions & 64 deletions bin/server.js

This file was deleted.

File renamed without changes.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ apiVersion: 1

providers:
# <string> an unique provider name. Required
- name: 'telemetry'
- name: 'serviceInfo'
# <int> Org id. Default to 1
orgId: 1
# <string> name of the dashboard folder.
folder: 'Telemetry'
folder: ''
# <string> folder UID. will be automatically generated if not specified
folderUid: ''
# <string> provider type. Default to 'file'
type: file
# <bool> disable dashboard deletion
disableDeletion: true
disableDeletion: false
# <int> how often Grafana will scan for changed dashboards
updateIntervalSeconds: 60
updateIntervalSeconds: 10
# <bool> allow updating provisioned dashboards from the UI
allowUiUpdates: false
allowUiUpdates: true
options:
# <string, required> path to dashboard files on disk. Required when using the 'file' type
path: /etc/grafana/dashboards
path: /etc/grafana/provisioning/dashboards
# <bool> use folder names from filesystem to create folders in Grafana
foldersFromFilesStructure: false
foldersFromFilesStructure: true
Loading

0 comments on commit c5c661e

Please sign in to comment.