Skip to content

Commit

Permalink
Merge branch 'main' into 40-prettier-eslint-and-editorconfig
Browse files Browse the repository at this point in the history
Signed-off-by: Hasan Eroglu <[email protected]>
  • Loading branch information
hasanheroglu committed Sep 27, 2024
2 parents fc49b85 + 66ee75b commit a71f560
Show file tree
Hide file tree
Showing 53 changed files with 7,663 additions and 1,671 deletions.
23 changes: 20 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,27 @@ TRAEFIK_DASHBOARD_PORT_OUT=8080
HOSTNAME="localhost"
BROKER_URI="test.mosquitto.org"

TRAEFIK_DASHBOARD_USER=
TRAEFIK_DASHBOARD_PASS=
# OAUTH & GITHUB FORWARD AUTH
OAUTH_SECRET=
GITHUB_AUTH_URL=https://github.com/login/oauth/authorize
GITHUB_TOKEN_URL=https://github.com/login/oauth/access_token
GITHUB_USER_URL=https://api.github.com/user
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
WHITELISTED_EMAILS=

# SERVICE PORTS
FORWARD_AUTH_PORT=4181
PROMETHEUS_PORT=9090
GRAFANA_PORT=3000
CADVISOR_PORT=8080
PORTAINER_PORT=9000
PORTAINER_PORT=9000

LOKI_HOSTNAME="http://loki"
LOKI_PORT=3100

# Healthcheck Parameters
HC_INTERVAL=40s
HC_TIMEOUT=30s
HC_RETRIES=3
HC_START_PERIOD=60s
23 changes: 10 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ The Test Thing is a total toy device that users can try different types of prope

### Smart Home Mashup

See the mashup's [readme](./mashups//smart-home/README.md).
See the mashup's [readme](./mashups/smart-home/README.md).

## How to Run

Expand All @@ -101,7 +101,7 @@ See the mashup's [readme](./mashups//smart-home/README.md).
You can start the devices inside a container, for that running `docker-compose -f docker-compose-infra.yml -f docker-compose-things.yml up` at the root directory builds and runs the containers. For custom configuration, take a look at the `Dockerfile` of each device or [docker-compose-things.yml](./docker-compose-things.yml).

[docker-compose-things.yml](./docker-compose-things.yml) consists of the docker configuration of the things.
[docker-compose-infra.yml](./docker-compose-infra.yml) consists of the docker configuration of additional tools such as traefik, prometheus, grafana and cadvisor.
[docker-compose-infra.yml](./docker-compose-infra.yml) consists of the docker configuration of additional tools such as traefik, prometheus, grafana, cadvisor and portainer.

After the run, as default, the devices are accessible at:

Expand All @@ -117,19 +117,17 @@ After the run, as default, the devices are accessible at:
| modbus-elevator | `modbus+tcp://localhost:3179/1` |
| http-data-schema-thing | `http://localhost/http-data-schema-thing` |

To be able to access additional tools, the user must have a basic username and password pair. The services are accessible at:
To be able to access additional tools, the user must login through GitHub. For GitHub authentication to work, environment variables `OAUTH_SECRET` and, `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` must be set with the configuration of GitHub OAuth application. Only whitelisted emails can access some of the services. Whitelisted emails can be set using the environment variable `WHITELISTED_EMAILS`. These services are accessible at:

- Traefik dashboard -> dashboard.localhost
- Prometheus -> prometheus.localhost
- Grafana -> grafana.localhost
- cAdvisor -> cadvisor.localhost

Hostname and ports can be changed from `.env` file in the root directory. Therefore the links for devices would change accordingly.
A username and password should be generated for running the services. To do so:
Grafana and Portainer UIs are public access but they run their own authentication and authorization. These services are accessible at:
- Grafana -> grafana.localhost
- Portainer -> portainer.localhost

1. Choose a username, e.g. `myuser`, and run the following command in the command line: `echo $(htpasswd -nB USERNAMECHOICE) | sed -e s/\\$/\\$\\$/g`
2. Enter the username and the generated password (hashed) in the `.env` file under `TRAEFIK_DASHBOARD_USER` and `TRAEFIK_DASHBOARD_PASS`, respectively.
3. Use the username and the password you have types (not the hashed one) when logging in at any service but Portainer.
Hostname and ports can be changed from `.env` file in the root directory. Therefore the links for devices would change accordingly.

### Running separately

Expand All @@ -139,11 +137,10 @@ For Node.js-based devices, we use npm workspaces and running `npm install` at th

### Saving Grafana Dashboards

Grafana dashboard json files are stored in [./conf/grafana/dashboards](./conf//grafana//dashboards/).
Grafana dashboard json files are stored in [./conf/grafana/dashboards](./conf/grafana/dashboards/).
To save your newly created dashboard locally and push it into the remote repository:

- Export the dashboard as JSON file using Share > Export.
- Save the exported JSON file to [./conf/grafana/dashboards](./conf//grafana//dashboards/).
- Export the dashboard as JSON file using Share > Export.
- Save the exported JSON file to [./conf/grafana/dashboards](./conf/grafana/dashboards/).

If your dashboard uses another datasource than our default `prometheus-datasource`, new datasource also must be provisioned in [./conf/grafana/datasources](./conf/grafana/provisioning/datasources/).
For more information check Grafana's provisioning [documentation](https://grafana.com/docs/grafana/latest/administration/provisioning/).
142 changes: 0 additions & 142 deletions conf/grafana/dashboards/dashboard.json

This file was deleted.

Loading

0 comments on commit a71f560

Please sign in to comment.