Compare commits

...

42 Commits

Author SHA1 Message Date
Amir Raminfar
cd9ddcf427 Release 3.13.1 2022-08-08 12:34:51 -07:00
Amir Raminfar
bbc7794006 Updates snapshots 2022-08-08 12:27:47 -07:00
Amir Raminfar
7dc37f130c Replaces last line return 2022-08-08 10:39:09 -07:00
Amir Raminfar
0711bc1c76 Fixes test 2022-08-08 09:37:24 -07:00
Amir Raminfar
0aa24386b2 Fixes line return bug and heartbeat to comment in SSE 2022-08-08 09:36:23 -07:00
kodiakhq[bot]
ca35b93671 Merge pull request #1843 from amir20/dependabot/github_actions/docker/build-push-action-3.1.1
Bump docker/build-push-action from 3.1.0 to 3.1.1
2022-08-08 09:24:57 +00:00
dependabot[bot]
a6220e4d38 Bump docker/build-push-action from 3.1.0 to 3.1.1
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3.1.0 to 3.1.1.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v3.1.0...v3.1.1)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-08 09:20:10 +00:00
Amir Raminfar
4ed64a7cce Release 3.13.0 2022-08-04 13:35:27 -07:00
Amir Raminfar
0f27e11084 Updates vue components with sass 2022-08-04 13:33:50 -07:00
Amir Raminfar
85eafc9c40 Tries to add 1 mircosecond to skip first log event (#1838) 2022-08-04 13:24:21 -07:00
Amir Raminfar
332cc384ea Adds a heartbeat for log stream (#1837) 2022-08-04 12:52:19 -07:00
kodiakhq[bot]
72fd31f85b Merge pull request #1833 from amir20/dependabot/docker/e2e/cypress/included-10.4.0
Bump cypress/included from 10.3.1 to 10.4.0 in /e2e
2022-08-03 09:39:07 +00:00
dependabot[bot]
a0ce370e9e Bump cypress/included from 10.3.1 to 10.4.0 in /e2e
Bumps cypress/included from 10.3.1 to 10.4.0.

---
updated-dependencies:
- dependency-name: cypress/included
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-03 09:34:35 +00:00
kodiakhq[bot]
e823904865 Merge pull request #1832 from amir20/dependabot/docker/golang-1.19.0-alpine
Bump golang from 1.18.5-alpine to 1.19.0-alpine
2022-08-03 09:13:08 +00:00
dependabot[bot]
22bbfe1592 Bump golang from 1.18.5-alpine to 1.19.0-alpine
Bumps golang from 1.18.5-alpine to 1.19.0-alpine.

---
updated-dependencies:
- dependency-name: golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-03 09:08:55 +00:00
kodiakhq[bot]
770e1818f0 Merge pull request #1830 from amir20/dependabot/docker/golang-1.18.5-alpine
Bump golang from 1.18.4-alpine to 1.18.5-alpine
2022-08-02 09:19:12 +00:00
dependabot[bot]
d6fab75f8f Bump golang from 1.18.4-alpine to 1.18.5-alpine
Bumps golang from 1.18.4-alpine to 1.18.5-alpine.

---
updated-dependencies:
- dependency-name: golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-02 09:15:41 +00:00
Amir Raminfar
17c18c156e Release 3.12.14 2022-08-01 15:32:41 -07:00
Amir Raminfar
5eca19840e Fixes cpu count using online cpus. Fixes #1829 2022-08-01 13:32:48 -07:00
Amir Raminfar
b1d7b8ba55 Updates modules 2022-07-31 19:01:21 -07:00
Amir Raminfar
e2ee430bbd Updates modules 2022-07-26 09:48:21 -07:00
Amir Raminfar
0755a71dc2 Adds healthcheck to readme 2022-07-25 09:21:20 -07:00
Amir Raminfar
60758db9c8 Updates modules 2022-07-25 09:10:38 -07:00
kodiakhq[bot]
7b96196904 Merge pull request #1826 from amir20/dependabot/docker/e2e/cypress/included-10.3.1
Bump cypress/included from 10.3.0 to 10.3.1 in /e2e
2022-07-25 09:55:01 +00:00
dependabot[bot]
efcfa0e375 Bump cypress/included from 10.3.0 to 10.3.1 in /e2e
Bumps cypress/included from 10.3.0 to 10.3.1.

---
updated-dependencies:
- dependency-name: cypress/included
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-25 09:50:54 +00:00
Amir Raminfar
66f9204ae6 Release 3.12.13 2022-07-24 18:40:17 -07:00
Amir Raminfar
73c023ce22 Disables healthcheck. Fixes #1819 (#1822) 2022-07-24 13:19:03 -07:00
Amir Raminfar
261517ac3f Updates modules 2022-07-22 08:28:19 -07:00
Amir Raminfar
2e0a546aa2 Release 3.12.12 2022-07-21 16:50:42 -07:00
Amir Raminfar
72ed7b50ba Adds platforms back for dev 2022-07-21 16:49:04 -07:00
Amir Raminfar
486bcec363 Revert "Updates with UPX with cross compile (#1817)"
This reverts commit 400cef767f.
2022-07-21 16:48:38 -07:00
Amir Raminfar
3db0ad42fe Removes python from Dockerfile 2022-07-21 14:57:17 -07:00
Amir Raminfar
c1a75e21ba Remove util linux 2022-07-21 14:56:10 -07:00
Amir Raminfar
96c5e24501 Removes make, ssh and g++ 2022-07-21 14:55:17 -07:00
Amir Raminfar
c1a16fd76e Removes git from Dockerfile 2022-07-21 14:53:15 -07:00
Amir Raminfar
42fab58c9f Release 3.12.11 2022-07-21 14:45:53 -07:00
Amir Raminfar
400cef767f Updates with UPX with cross compile (#1817)
* Revert "Removes UXP"

* Updates UPX again to be cross-compile
2022-07-21 09:53:55 -07:00
Amir Raminfar
84ae558467 Release 3.12.10 2022-07-20 15:57:05 -07:00
Amir Raminfar
0ebc9c562a Fixes deploy build 2022-07-20 15:56:23 -07:00
Amir Raminfar
f67664470f Adds COMPOSE_DOCKER_CLI_BUILD 2022-07-20 15:54:50 -07:00
Amir Raminfar
1f811da273 Fixes build file 2022-07-20 15:41:06 -07:00
Amir Raminfar
fdfc9fceba Uses cross compilation for faster builds 2022-07-20 15:36:48 -07:00
10 changed files with 382 additions and 403 deletions

View File

@@ -39,9 +39,9 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
- name: Build images
run: docker-compose -f e2e/docker-compose.yml build
run: COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose -f e2e/docker-compose.yml build
- name: Run tests
run: docker-compose -f e2e/docker-compose.yml up --build --force-recreate --exit-code-from cypress
run: COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose -f e2e/docker-compose.yml up --build --force-recreate --exit-code-from cypress
buildx:
needs: [go-test, npm-test, int-test]
name: Release
@@ -62,7 +62,7 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v3.1.0
uses: docker/build-push-action@v3.1.1
with:
push: true
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8

View File

@@ -27,10 +27,10 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v3.1.0
uses: docker/build-push-action@v3.1.1
with:
push: true
platforms: linux/amd64
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
tags: ${{ steps.meta.outputs.tags }}
build-args: TAG=${{ steps.meta.outputs.version }}
labels: ${{ steps.meta.outputs.labels }}

View File

@@ -43,8 +43,12 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.0.0
- name: Build images
run: docker-compose -f e2e/docker-compose.yml build
run: COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose -f e2e/docker-compose.yml build
- name: Set commit message for push
if: github.event_name == 'push'
run: |
@@ -58,4 +62,4 @@ jobs:
git log -1 --pretty=%B ${{github.event.pull_request.head.sha}} >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Run tests
run: docker-compose -f e2e/docker-compose.yml up --build --force-recreate --exit-code-from cypress
run: COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose -f e2e/docker-compose.yml up --build --force-recreate --exit-code-from cypress

View File

@@ -1,7 +1,7 @@
# Build assets
FROM node:18-alpine as node
FROM --platform=$BUILDPLATFORM node:18-alpine as node
RUN apk add --no-cache git openssh make g++ util-linux python3 && npm install -g pnpm
RUN npm install -g pnpm
WORKDIR /build
@@ -19,9 +19,9 @@ COPY assets ./assets
# Install dependencies
RUN pnpm install -r --offline --prod --ignore-scripts && pnpm build
FROM golang:1.18.4-alpine AS builder
FROM --platform=$BUILDPLATFORM golang:1.19.0-alpine AS builder
RUN apk add --no-cache git ca-certificates && mkdir /dozzle
RUN apk add --no-cache ca-certificates && mkdir /dozzle
WORKDIR /dozzle
@@ -41,9 +41,10 @@ COPY main.go ./
# Args
ARG TAG=dev
ARG TARGETOS TARGETARCH
# Build binary
RUN CGO_ENABLED=0 go build -ldflags "-s -w -X main.version=$TAG" -o dozzle
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -ldflags "-s -w -X main.version=$TAG" -o dozzle
FROM scratch
@@ -53,8 +54,6 @@ ENV PATH /bin
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /dozzle/dozzle /dozzle
HEALTHCHECK --start-period=4s --interval=2s CMD [ "/dozzle", "healthcheck" ]
EXPOSE 8080
ENTRYPOINT ["/dozzle"]

View File

@@ -58,6 +58,30 @@ Dozzle will be available at [http://localhost:8888/](http://localhost:8888/). Yo
ports:
- 9999:8080
### Enabling health check
Dozzle doesn't enable healthcheck by default as it adds extra CPU usage. `healthcheck` can be enabled manually.
version: "3"
services:
dozzle:
container_name: dozzle
image: amir20/dozzle:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
ports:
- 8080:8080
environment:
DOZZLE_LEVEL: trace
healthcheck:
test: [ "CMD", "/dozzle", "healthcheck" ]
interval: 3s
timeout: 30s
retries: 5
start_period: 30s
#### Security
You can control the device Dozzle binds to by passing `--addr` parameter. For example,

View File

@@ -138,14 +138,20 @@ func (d *dockerClient) ContainerStats(ctx context.Context, id string, stats chan
log.Errorf("decoder for stats api returned an unknown error %v", err)
}
ncpus := uint8(v.CPUStats.OnlineCPUs)
if ncpus == 0 {
ncpus = uint8(len(v.CPUStats.CPUUsage.PercpuUsage))
}
var (
cpuDelta = float64(v.CPUStats.CPUUsage.TotalUsage) - float64(v.PreCPUStats.CPUUsage.TotalUsage)
systemDelta = float64(v.CPUStats.SystemUsage) - float64(v.PreCPUStats.SystemUsage)
cpuPercent = int64((cpuDelta / systemDelta) * float64(len(v.CPUStats.CPUUsage.PercpuUsage)) * 100)
cpuPercent = int64((cpuDelta / systemDelta) * float64(ncpus) * 100)
memUsage = int64(v.MemoryStats.Usage - v.MemoryStats.Stats["cache"])
memPercent = int64(float64(memUsage) / float64(v.MemoryStats.Limit) * 100)
)
if cpuPercent > 0 || memUsage > 0 {
select {
case <-ctx.Done():
@@ -167,6 +173,12 @@ func (d *dockerClient) ContainerStats(ctx context.Context, id string, stats chan
func (d *dockerClient) ContainerLogs(ctx context.Context, id string, tailSize int, since string) (io.ReadCloser, error) {
log.WithField("id", id).WithField("since", since).Debug("streaming logs for container")
if since != "" {
if sinceTime, err := time.Parse(time.RFC3339Nano, since); err == nil {
since = sinceTime.Add(time.Microsecond).Format(time.RFC3339Nano)
}
}
options := types.ContainerLogsOptions{
ShowStdout: true,
ShowStderr: true,

View File

@@ -1,4 +1,4 @@
FROM cypress/included:10.3.0
FROM cypress/included:10.4.0
RUN apt install curl && curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm

View File

@@ -1,6 +1,6 @@
{
"name": "dozzle",
"version": "3.12.9",
"version": "3.13.1",
"description": "Realtime log viewer for docker containers. ",
"homepage": "https://github.com/amir20/dozzle#readme",
"bugs": {
@@ -22,43 +22,43 @@
"postinstall": "husky install"
},
"dependencies": {
"@iconify-json/carbon": "^1.1.6",
"@iconify-json/carbon": "^1.1.7",
"@iconify-json/cil": "^1.1.2",
"@iconify-json/mdi": "^1.1.29",
"@iconify-json/mdi-light": "^1.1.2",
"@iconify-json/octicon": "^1.1.13",
"@iconify-json/octicon": "^1.1.15",
"@oruga-ui/oruga-next": "^0.5.4",
"@oruga-ui/theme-bulma": "^0.2.6",
"@vitejs/plugin-vue": "3.0.1",
"@vue/compiler-sfc": "^3.2.37",
"@vueuse/core": "^8.9.4",
"@vueuse/router": "^8.9.4",
"@vueuse/core": "^9.1.0",
"@vueuse/router": "^9.1.0",
"ansi-to-html": "^0.7.2",
"bulma": "^0.9.4",
"date-fns": "^2.28.0",
"date-fns": "^2.29.1",
"fuzzysort": "^2.0.1",
"hotkeys-js": "^3.9.4",
"lodash.debounce": "^4.0.8",
"pinia": "^2.0.16",
"sass": "^1.53.0",
"pinia": "^2.0.17",
"sass": "^1.54.2",
"semver": "^7.3.7",
"splitpanes": "^3.1.1",
"typescript": "^4.7.4",
"unplugin-auto-import": "^0.9.3",
"unplugin-icons": "^0.14.7",
"unplugin-vue-components": "^0.21.1",
"vite": "3.0.2",
"unplugin-auto-import": "^0.10.3",
"unplugin-icons": "^0.14.8",
"unplugin-vue-components": "^0.22.0",
"vite": "3.0.4",
"vue": "^3.2.37",
"vue-router": "^4.1.2"
"vue-router": "^4.1.3"
},
"devDependencies": {
"@pinia/testing": "^0.0.12",
"@pinia/testing": "^0.0.13",
"@types/jest": "^28.1.6",
"@types/lodash.debounce": "^4.0.7",
"@types/node": "^18.0.6",
"@types/node": "^18.6.3",
"@types/semver": "^7.3.10",
"@vue/test-utils": "^2.0.2",
"c8": "^7.11.3",
"c8": "^7.12.0",
"eventsourcemock": "^2.0.0",
"husky": "^8.0.1",
"jest-serializer-vue": "^2.0.2",
@@ -66,9 +66,9 @@
"lint-staged": "^13.0.3",
"npm-run-all": "^4.1.5",
"prettier": "^2.7.1",
"release-it": "^15.1.2",
"release-it": "^15.2.0",
"ts-node": "^10.9.1",
"vitest": "^0.18.1"
"vitest": "^0.20.3"
},
"lint-staged": {
"*.{js,vue,css}": [

661
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -105,12 +105,27 @@ func (h *handler) streamLogs(w http.ResponseWriter, r *http.Request) {
}
defer reader.Close()
ticker := time.NewTicker(5 * time.Second)
defer ticker.Stop()
go func() {
for {
select {
case <-r.Context().Done():
return
case <-ticker.C:
fmt.Fprintf(w, ":ping \n\n")
f.Flush()
}
}
}()
buffered := bufio.NewReader(reader)
var readerError error
var message string
for {
message, readerError = buffered.ReadString('\n')
fmt.Fprintf(w, "data: %s\n", message)
fmt.Fprintf(w, "data: %s\n", strings.TrimRight(message, "\n"))
if index := strings.IndexAny(message, " "); index != -1 {
id := message[:index]
if _, err := time.Parse(time.RFC3339Nano, id); err == nil {