github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/tools/dev/loki-boltdb-storage-s3/README.md (about)

     1  # Loki Docker-Compose
     2  
     3  This folder contains the necessary to run the Loki distributed setup locally on docker-compose.
     4  
     5  It 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  
     7  To start the stack simply run:
     8  
     9  ```bash
    10  ./tools/dev/loki-boltdb-storage-s3/compose-up.sh
    11  ```
    12  
    13  You 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  
    15  To 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  
    25  The configuration of the stack is in the [`config/`](./config/) folder.
    26  The 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  
    28  Logs from all containers are ingested via the [loki docker driver](https://grafana.com/docs/loki/latest/clients/docker-driver/).
    29  
    30  ## Remote Debugging
    31  
    32  You 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.
    33  You'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  
    37  For example, if command line tooling is your thing, you can debug `ingester-1` with dlv by simply running:
    38  
    39  ```bash
    40  dlv connect 127.0.0.1:18002
    41  ```
    42  
    43  ### vs-code
    44  
    45  If 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  
    69  Then you can debug `ingester-1` with the `Launch Loki remote` configuration within the debugging tab.