fix: added permission fix for container logs

This commit is contained in:
Fu Zi Xiang 2023-11-06 15:58:15 +08:00
parent a6f7198443
commit 87049aa498
No known key found for this signature in database
GPG Key ID: 7AE0884D237CEE16
2 changed files with 17 additions and 3 deletions

View File

@ -21,11 +21,17 @@ Exiting: error loading config file: config file ("filebeat.yml") can only be wri
- Solution: remove write permission on the file: `chmod -w docker/filebeat/filebeat.yml`
### No Logs
- Observation: There are no logs in OpenSearch Dashboard
- Possibe Diagnostic: No read permission for `*.log` files in `/var/lib/docker/containers`
- One Time Solution: give read permission to docker logs
```
$ docker logs appflowy-cloud-filebeat-1
...Non-zero metrics in the last 30s...
chmod -R a+r /var/lib/docker/containers
```
- Solution: give read permission to docker logs: `chmod -R a+r /var/lib/docker/containers`
- Permanent Solution: give read permission to docker logs every time there's a modification
In the project root directory: `sudo ./docker/filebeat/grant_container_logs_permissions.sh`
- Caveat: Only work on unix like operating system, requires `inotifywait`(`inotify-tools`) to be installed.
MacOS alternative: `fswatch`
## Credentials
- After deployment, when you go to localhost:5601, both username and password will be `admin`

View File

@ -0,0 +1,8 @@
#! /usr/bin/env bash
while true
do
inotifywait /var/lib/docker/containers
sleep 1
sudo chmod -R a+r /var/lib/docker/containers
done