Compare commits

...

26 Commits

Author SHA1 Message Date
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
Amir Raminfar
5b5b741b68 Release 3.12.9 2022-07-20 14:55:01 -07:00
Amir Raminfar
18c88d0e85 Removes UXP 2022-07-20 14:45:09 -07:00
Amir Raminfar
1603a19538 Release 3.12.8 2022-07-20 12:33:39 -07:00
Amir Raminfar
5cffa287d5 Adds a simple healthcheck every 2s (#1814)
* Adds a simple healthcheck every 5s

* Fixes bugs for healthcheck
2022-07-20 11:56:42 -07:00
kodiakhq[bot]
93f57b6e90 Merge pull request #1815 from amir20/dependabot/github_actions/docker/build-push-action-3.1.0
Bump docker/build-push-action from 3.0.0 to 3.1.0
2022-07-20 09:27:42 +00:00
kodiakhq[bot]
2346f6a0eb Merge pull request #1816 from amir20/dependabot/go_modules/github.com/spf13/afero-1.9.2
Bump github.com/spf13/afero from 1.9.0 to 1.9.2
2022-07-20 09:27:29 +00:00
dependabot[bot]
f95317ac1d Bump github.com/spf13/afero from 1.9.0 to 1.9.2
Bumps [github.com/spf13/afero](https://github.com/spf13/afero) from 1.9.0 to 1.9.2.
- [Release notes](https://github.com/spf13/afero/releases)
- [Commits](https://github.com/spf13/afero/compare/v1.9.0...v1.9.2)

---
updated-dependencies:
- dependency-name: github.com/spf13/afero
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-20 09:22:47 +00:00
dependabot[bot]
157a612f34 Bump docker/build-push-action from 3.0.0 to 3.1.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3.0.0 to 3.1.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v3.0.0...v3.1.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-20 09:22:16 +00:00
kodiakhq[bot]
42c890ad50 Merge pull request #1813 from amir20/dependabot/go_modules/github.com/sirupsen/logrus-1.9.0
Bump github.com/sirupsen/logrus from 1.8.1 to 1.9.0
2022-07-19 09:14:04 +00:00
dependabot[bot]
48638a18f2 Bump github.com/sirupsen/logrus from 1.8.1 to 1.9.0
Bumps [github.com/sirupsen/logrus](https://github.com/sirupsen/logrus) from 1.8.1 to 1.9.0.
- [Release notes](https://github.com/sirupsen/logrus/releases)
- [Changelog](https://github.com/sirupsen/logrus/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sirupsen/logrus/compare/v1.8.1...v1.9.0)

---
updated-dependencies:
- dependency-name: github.com/sirupsen/logrus
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-19 09:09:54 +00:00
Amir Raminfar
fae0640bba Updates modules 2022-07-18 08:55:19 -07:00
Amir Raminfar
23b37bb912 Uses UPX to shrink binary (#1809)
* Tries to use UPX

* Uses harshavardhanj/upx instead
2022-07-17 10:22:23 -07:00
kodiakhq[bot]
07135fea91 Merge pull request #1808 from amir20/dependabot/go_modules/github.com/spf13/afero-1.9.0
Bump github.com/spf13/afero from 1.8.2 to 1.9.0
2022-07-15 09:14:16 +00:00
dependabot[bot]
1a3c394fe4 Bump github.com/spf13/afero from 1.8.2 to 1.9.0
Bumps [github.com/spf13/afero](https://github.com/spf13/afero) from 1.8.2 to 1.9.0.
- [Release notes](https://github.com/spf13/afero/releases)
- [Commits](https://github.com/spf13/afero/compare/v1.8.2...v1.9.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/afero
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-15 09:10:20 +00:00
Amir Raminfar
38ec37ed19 Updates modules 2022-07-14 11:14:12 -07:00
kodiakhq[bot]
738ae98f2f Merge pull request #1806 from amir20/dependabot/docker/golang-1.18.4-alpine
Bump golang from 1.18.3-alpine to 1.18.4-alpine
2022-07-13 09:12:37 +00:00
dependabot[bot]
99d1e83882 Bump golang from 1.18.3-alpine to 1.18.4-alpine
Bumps golang from 1.18.3-alpine to 1.18.4-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-07-13 09:08:26 +00:00
Amir Raminfar
d71be7e239 Updates modules 2022-07-08 10:52:36 -07:00
kodiakhq[bot]
c0b9325efb Merge pull request #1791 from amir20/dependabot/go_modules/github.com/stretchr/testify-1.8.0
Bump github.com/stretchr/testify from 1.7.5 to 1.8.0
2022-06-30 09:15:40 +00:00
dependabot[bot]
538fe6f158 Bump github.com/stretchr/testify from 1.7.5 to 1.8.0
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.5 to 1.8.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.5...v1.8.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-30 09:12:01 +00:00
Amir Raminfar
965d1a52b1 Updates cypress 2022-06-29 13:30:40 -07:00
22 changed files with 764 additions and 705 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.0.0
uses: docker/build-push-action@v3.1.0
with:
push: true
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8

View File

@@ -27,7 +27,7 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v3.0.0
uses: docker/build-push-action@v3.1.0
with:
push: true
platforms: linux/amd64

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,5 +1,5 @@
# 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
@@ -19,7 +19,7 @@ COPY assets ./assets
# Install dependencies
RUN pnpm install -r --offline --prod --ignore-scripts && pnpm build
FROM golang:1.18.3-alpine AS builder
FROM --platform=$BUILDPLATFORM golang:1.18.4-alpine AS builder
RUN apk add --no-cache git ca-certificates && mkdir /dozzle
@@ -34,15 +34,18 @@ COPY --from=node /build/dist ./dist
# Copy all other files
COPY analytics ./analytics
COPY healthcheck ./healthcheck
COPY docker ./docker
COPY web ./web
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
@@ -51,6 +54,8 @@ 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

@@ -3,8 +3,12 @@
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'
export {}
declare module '@vue/runtime-core' {
export interface GlobalComponents {
CarbonCaretDown: typeof import('~icons/carbon/caret-down')['default']
CilColumns: typeof import('~icons/cil/columns')['default']
CilFindInPage: typeof import('~icons/cil/find-in-page')['default']
ContainerStat: typeof import('./components/ContainerStat.vue')['default']
ContainerTitle: typeof import('./components/ContainerTitle.vue')['default']
@@ -17,7 +21,15 @@ declare module '@vue/runtime-core' {
LogViewer: typeof import('./components/LogViewer.vue')['default']
LogViewerWithSource: typeof import('./components/LogViewerWithSource.vue')['default']
MdiDotsVertical: typeof import('~icons/mdi/dots-vertical')['default']
MdiLightChevronDoubleDown: typeof import('~icons/mdi-light/chevron-double-down')['default']
MdiLightChevronLeft: typeof import('~icons/mdi-light/chevron-left')['default']
MdiLightChevronRight: typeof import('~icons/mdi-light/chevron-right')['default']
MdiLightCog: typeof import('~icons/mdi-light/cog')['default']
MdiLightMagnify: typeof import('~icons/mdi-light/magnify')['default']
MobileMenu: typeof import('./components/MobileMenu.vue')['default']
OcticonContainer24: typeof import('~icons/octicon/container24')['default']
OcticonDownload24: typeof import('~icons/octicon/download24')['default']
OcticonTrash24: typeof import('~icons/octicon/trash24')['default']
PastTime: typeof import('./components/PastTime.vue')['default']
RelativeTime: typeof import('./components/RelativeTime.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
@@ -28,5 +40,3 @@ declare module '@vue/runtime-core' {
SideMenu: typeof import('./components/SideMenu.vue')['default']
}
}
export {}

View File

@@ -28,6 +28,7 @@ type dockerProxy interface {
Events(context.Context, types.EventsOptions) (<-chan events.Message, <-chan error)
ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
ContainerStats(ctx context.Context, containerID string, stream bool) (types.ContainerStats, error)
Ping(ctx context.Context) (types.Ping, error)
}
// Client is a proxy around the docker client
@@ -38,6 +39,7 @@ type Client interface {
Events(context.Context) (<-chan ContainerEvent, <-chan error)
ContainerLogsBetweenDates(context.Context, string, time.Time, time.Time) (io.ReadCloser, error)
ContainerStats(context.Context, string, chan<- ContainerStat) error
Ping(context.Context) (types.Ping, error)
}
// NewClientWithFilters creates a new instance of Client with docker filters
@@ -241,3 +243,7 @@ func (d *dockerClient) ContainerLogsBetweenDates(ctx context.Context, id string,
return newLogReader(reader, containerJSON.Config.Tty), nil
}
func (d *dockerClient) Ping(ctx context.Context) (types.Ping, error) {
return d.cli.Ping(ctx)
}

View File

@@ -1,4 +1,4 @@
FROM cypress/included:10.0.3
FROM cypress/included:10.3.0
RUN apt install curl && curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm
@@ -7,5 +7,5 @@ WORKDIR /e2e
COPY pnpm-lock.yaml ./
RUN pnpm fetch
COPY package.json ./
COPY package.json tsconfig.json ./
RUN pnpm install -r --offline

View File

@@ -3,4 +3,10 @@ import { defineConfig } from "cypress";
export default defineConfig({
fixturesFolder: false,
projectId: "8cua4m",
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});

View File

@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}

View File

@@ -1,5 +1,6 @@
/// <reference types="cypress" />
// ***********************************************
// This example commands.js shows you how to
// This example commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
@@ -23,10 +24,17 @@
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
// import { addMatchImageSnapshotCommand } from "cypress-image-snapshot/command";
// addMatchImageSnapshotCommand();
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }
Cypress.Commands.add("removeDates", () => {
cy.window().then((win) => win.document.querySelectorAll("time").forEach((el) => el.remove()));

View File

@@ -1,5 +1,5 @@
// ***********************************************************
// This example support/index.js is processed and
// This example support/e2e.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
@@ -14,7 +14,7 @@
// ***********************************************************
// Import commands.js using ES2015 syntax:
import "./commands";
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')
// require('./commands')

14
e2e/cypress/tsconfig.json Normal file
View File

@@ -0,0 +1,14 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"noEmit": true,
// be explicit about types included
// to avoid clashing with Jest types
"types": ["cypress"]
},
"include": [
"../node_modules/cypress",
"./**/*.ts",
"./**/*.js"
]
}

View File

@@ -4,7 +4,7 @@
"scripts": {},
"license": "ISC",
"dependencies": {
"cypress": "^10.2.0",
"cypress": "^10.3.0",
"cypress-image-snapshot": "^4.0.1",
"typescript": "^4.7.4"
}

16
e2e/pnpm-lock.yaml generated
View File

@@ -1,13 +1,13 @@
lockfileVersion: 5.4
specifiers:
cypress: ^10.2.0
cypress: ^10.3.0
cypress-image-snapshot: ^4.0.1
typescript: ^4.7.4
dependencies:
cypress: 10.2.0
cypress-image-snapshot: 4.0.1_cypress@10.2.0
cypress: 10.3.0
cypress-image-snapshot: 4.0.1_cypress@10.3.0
typescript: 4.7.4
packages:
@@ -354,14 +354,14 @@ packages:
which: 2.0.2
dev: false
/cypress-image-snapshot/4.0.1_cypress@10.2.0:
/cypress-image-snapshot/4.0.1_cypress@10.3.0:
resolution: {integrity: sha512-PBpnhX/XItlx3/DAk5ozsXQHUi72exybBNH5Mpqj1DVmjq+S5Jd9WE5CRa4q5q0zuMZb2V2VpXHth6MjFpgj9Q==}
engines: {node: '>=8'}
peerDependencies:
cypress: ^4.5.0
dependencies:
chalk: 2.4.2
cypress: 10.2.0
cypress: 10.3.0
fs-extra: 7.0.1
glob: 7.2.0
jest-image-snapshot: 4.2.0
@@ -371,8 +371,8 @@ packages:
- jest
dev: false
/cypress/10.2.0:
resolution: {integrity: sha512-+i9lY5ENlfi2mJwsggzR+XASOIgMd7S/Gd3/13NCpv596n3YSplMAueBTIxNLcxDpTcIksp+9pM3UaDrJDpFqA==}
/cypress/10.3.0:
resolution: {integrity: sha512-txkQWKzvBVnWdCuKs5Xc08gjpO89W2Dom2wpZgT9zWZT5jXxqPIxqP/NC1YArtkpmp3fN5HW8aDjYBizHLUFvg==}
engines: {node: '>=12.0.0'}
hasBin: true
requiresBuild: true
@@ -1288,7 +1288,7 @@ packages:
dev: false
/supports-color/2.0.0:
resolution: {integrity: sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=}
resolution: {integrity: sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==}
engines: {node: '>=0.8.0'}
dev: false

8
e2e/tsconfig.json Normal file
View File

@@ -0,0 +1,8 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress", "node"]
},
"include": ["**/*.ts"]
}

8
go.mod
View File

@@ -18,12 +18,12 @@ require (
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/sirupsen/logrus v1.8.1
github.com/spf13/afero v1.8.2
github.com/sirupsen/logrus v1.9.0
github.com/spf13/afero v1.9.2
github.com/stretchr/objx v0.4.0 // indirect
github.com/stretchr/testify v1.7.5
github.com/stretchr/testify v1.8.0
golang.org/x/net v0.0.0-20211104170005-ce137452f963 // indirect
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b // indirect
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

16
go.sum
View File

@@ -179,10 +179,10 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo=
github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spf13/afero v1.9.2 h1:j49Hj62F0n+DaZ1dDCvhABaPNSGNkt32oRFxI33IEMw=
github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4=
@@ -192,8 +192,8 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.5 h1:s5PTfem8p8EbKQOctVV53k6jCJt3UX4IEJzwh+C324Q=
github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
@@ -333,8 +333,8 @@ golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b h1:1VkfZQv42XQlA/jchYumAnv1UPo6RgF9rJFkTgZIxO4=
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

32
healthcheck/http.go Normal file
View File

@@ -0,0 +1,32 @@
package healthcheck
import (
"fmt"
log "github.com/sirupsen/logrus"
"net/http"
"os"
"strings"
)
func HttpRequest(addr string, base string) error {
if strings.HasPrefix(addr, ":") {
addr = "localhost" + addr
}
url := fmt.Sprintf("http://%s%s/healthcheck", addr, base)
log.Info("Checking health of " + url)
resp, err := http.Get(url)
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCode == 200 {
os.Exit(0)
}
os.Exit(1)
return nil
}

11
main.go
View File

@@ -15,6 +15,7 @@ import (
"github.com/alexflint/go-arg"
"github.com/amir20/dozzle/analytics"
"github.com/amir20/dozzle/docker"
"github.com/amir20/dozzle/healthcheck"
"github.com/amir20/dozzle/web"
log "github.com/sirupsen/logrus"
@@ -35,6 +36,10 @@ type args struct {
WaitForDockerSeconds int `arg:"--wait-for-docker-seconds,env:DOZZLE_WAIT_FOR_DOCKER_SECONDS" help:"wait for docker to be available for at most this many seconds before starting the server."`
FilterStrings []string `arg:"env:DOZZLE_FILTER,--filter,separate" help:"filters docker containers using Docker syntax."`
Filter map[string][]string `arg:"-"`
Healthcheck *HealthcheckCmd `arg:"subcommand:healthcheck" help:"checks if the server is running."`
}
type HealthcheckCmd struct {
}
func (args) Version() string {
@@ -68,6 +73,12 @@ func main() {
DisableLevelTruncation: true,
})
if args.Healthcheck != nil {
if err := healthcheck.HttpRequest(args.Addr, args.Base); err != nil {
log.Fatal(err)
}
}
log.Infof("Dozzle version %s", version)
dockerClient := docker.NewClientWithFilters(args.Filter)
for i := 1; ; i++ {

View File

@@ -1,6 +1,6 @@
{
"name": "dozzle",
"version": "3.12.7",
"version": "3.12.10",
"description": "Realtime log viewer for docker containers. ",
"homepage": "https://github.com/amir20/dozzle#readme",
"bugs": {
@@ -24,40 +24,40 @@
"dependencies": {
"@iconify-json/carbon": "^1.1.6",
"@iconify-json/cil": "^1.1.2",
"@iconify-json/mdi": "^1.1.24",
"@iconify-json/mdi": "^1.1.29",
"@iconify-json/mdi-light": "^1.1.2",
"@iconify-json/octicon": "^1.1.12",
"@iconify-json/octicon": "^1.1.13",
"@oruga-ui/oruga-next": "^0.5.4",
"@oruga-ui/theme-bulma": "^0.2.6",
"@vitejs/plugin-vue": "3.0.0-beta.0",
"@vitejs/plugin-vue": "3.0.1",
"@vue/compiler-sfc": "^3.2.37",
"@vueuse/core": "^8.7.5",
"@vueuse/router": "^8.7.5",
"@vueuse/core": "^8.9.4",
"@vueuse/router": "^8.9.4",
"ansi-to-html": "^0.7.2",
"bulma": "^0.9.4",
"date-fns": "^2.28.0",
"fuzzysort": "^2.0.1",
"hotkeys-js": "^3.9.4",
"lodash.debounce": "^4.0.8",
"pinia": "^2.0.14",
"pinia": "^2.0.16",
"sass": "^1.53.0",
"semver": "^7.3.7",
"splitpanes": "^3.1.1",
"typescript": "^4.7.4",
"unplugin-auto-import": "^0.9.1",
"unplugin-icons": "^0.14.6",
"unplugin-vue-components": "^0.20.1",
"vite": "3.0.0-beta.4",
"unplugin-auto-import": "^0.9.3",
"unplugin-icons": "^0.14.7",
"unplugin-vue-components": "^0.21.1",
"vite": "3.0.2",
"vue": "^3.2.37",
"vue-router": "^4.0.16"
"vue-router": "^4.1.2"
},
"devDependencies": {
"@pinia/testing": "^0.0.12",
"@types/jest": "^28.1.3",
"@types/jest": "^28.1.6",
"@types/lodash.debounce": "^4.0.7",
"@types/node": "^18.0.0",
"@types/node": "^18.0.6",
"@types/semver": "^7.3.10",
"@vue/test-utils": "^2.0.0",
"@vue/test-utils": "^2.0.2",
"c8": "^7.11.3",
"eventsourcemock": "^2.0.0",
"husky": "^8.0.1",
@@ -66,9 +66,9 @@
"lint-staged": "^13.0.3",
"npm-run-all": "^4.1.5",
"prettier": "^2.7.1",
"release-it": "^15.1.0",
"ts-node": "^10.8.1",
"vitest": "^0.16.0"
"release-it": "^15.1.2",
"ts-node": "^10.9.1",
"vitest": "^0.18.1"
},
"lint-staged": {
"*.{js,vue,css}": [

1228
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -61,6 +61,7 @@ func createRouter(h *handler) *mux.Router {
s.HandleFunc("/api/validateCredentials", h.validateCredentials)
s.Handle("/logout", authorizationRequired(h.clearSession))
s.Handle("/version", authorizationRequired(h.version))
s.HandleFunc("/healthcheck", h.healthcheck)
if log.IsLevelEnabled(log.DebugLevel) {
s.PathPrefix("/debug/pprof/").Handler(http.DefaultServeMux)
@@ -131,3 +132,14 @@ func (h *handler) version(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Type", "text/html")
fmt.Fprintf(w, "<pre>%v</pre>", h.config.Version)
}
func (h *handler) healthcheck(w http.ResponseWriter, r *http.Request) {
log.Trace("Executing healthcheck request")
if ping, err := h.client.Ping(r.Context()); err != nil {
log.Error(err)
http.Error(w, err.Error(), http.StatusInternalServerError)
} else {
fmt.Fprintf(w, "OK API Version %v", ping.APIVersion)
}
}