• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..15-Oct-2021-

config/H15-Oct-2021-154152

.dockerignoreH A D15-Oct-20218 21

.gitignoreH A D15-Oct-202119 43

README.mdH A D15-Oct-20212.3 KiB7049

compose-down.shH A D15-Oct-2021132 62

compose-up.shH A D15-Oct-2021856 2514

dev.dockerfileH A D15-Oct-2021201 129

docker-compose.ymlH A D15-Oct-20217.2 KiB254240

README.md

1# Loki Docker-Compose
2
3This folder contains the necessary to run the Loki distributed setup locally on docker-compose.
4
5It runs the current code base in the repository this means you can debug new features and iterate very quickly by simply restarting the compose project.
6
7To start the stack simply run:
8
9```bash
10./tools/dev/loki-boltdb-storage-s3/compose-up.sh
11```
12
13You can then access grafana locally with http://localhost:3000 (default account admin/admin). The grafana container should already have the datasource to correctly query the frontend.
14
15To tear it down use:
16
17```bash
18./tools/dev/loki-boltdb-storage-s3/compose-down.sh
19```
20
21> On MacOS :apple: docker can get stuck when restarting the stack, you can restart docker to workaround the problem :shrug:
22
23## Configuration
24
25The configuration of the stack is in the [`config/`](./config/) folder.
26The stack currently runs boltdb-shipper storage on minio (via s3 compatible API). All containers data are stored under `.data-.*` if you need it for debugging purpose.
27
28Logs from all containers are ingested via the [loki docker driver](https://grafana.com/docs/loki/latest/clients/docker-driver/).
29
30## Remote Debugging
31
32You can also remote debug all Loki containers which are built in debug mode. Each container automatically runs [`dlv`](https://github.com/go-delve/delve) headless and then start Loki process.
33You'll need to grab the `dlv` port from the [docker-compose file](./docker-compose.yml) for the container you want to debug. (a different one is used per container.)
34
35### dlv
36
37For example, if command line tooling is your thing, you can debug `ingester-1` with dlv by simply running:
38
39```bash
40dlv connect 127.0.0.1:18002
41```
42
43### vs-code
44
45If you use vs-code, you can add this snippet bellow in your [`launch.json`](https://code.visualstudio.com/docs/editor/debugging) file:
46
47```json
48{
49    "name": "Launch Loki remote",
50    "type": "go",
51    "request": "attach",
52    "mode": "remote",
53    "substitutePath": [
54        {
55            "from": "${workspaceFolder}",
56            "to": "${workspaceFolder}",
57        },
58    ],
59    "port": 18002,
60    "host": "127.0.0.1",
61    "cwd": "${workspaceFolder}/tools/dev/loki-boltdb-storage-s3/loki",
62    "remotePath": "/loki/loki",
63    "showLog": true,
64    "trace": "log",
65    "logOutput": "rpc",
66},
67```
68
69Then you can debug `ingester-1` with the `Launch Loki remote` configuration within the debugging tab.
70