Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
NiNiyas committed Jul 6, 2022
0 parents commit 5ed2859
Show file tree
Hide file tree
Showing 41 changed files with 16,159 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
frontend/node_modules
tailon
scripts/
testdata/
config.toml
*.bat
*.log
79 changes: 79 additions & 0 deletions .github/workflows/ghcr-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build and Push to GHCR

on:
workflow_dispatch:
repository_dispatch:
types: [Build and Push to GHCR]
push:
branches:
- master

jobs:
build-and-push-to-ghcr:
runs-on: ubuntu-latest
steps:
- uses: benjlevesque/[email protected]
id: short-sha
with:
length: 7
- uses: actions/checkout@v2
- name: Log into GitHub Container Registry
run: echo "${{ secrets.GIT_TOKEN }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
version: latest
driver-opts: image=moby/buildkit:master

- name: Build and push
id: docker_build_amd64
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
tags: |
ghcr.io/niniyas/tailon:beta
ghcr.io/${{ secrets.GIT_USER }}/tailon:beta-${{ steps.short-sha.outputs.sha }}
platforms: linux/amd64,linux/arm64

- name: ntfy success notifications
uses: niniyas/ntfy-action@master
if: success()
with:
url: ${{ secrets.NTFY_URL }}
topic: ${{ secrets.NTFY_TOPIC }}
tags: github,action,+1,partying_face
priority: 4
details: 'Workflow has been completed successfully!'
headers: '${{ secrets.NTFY_HEADERS }}'

- name: ntfy failed notifications
uses: niniyas/ntfy-action@master
if: failure()
with:
url: ${{ secrets.NTFY_URL }}
topic: ${{ secrets.NTFY_TOPIC }}
tags: github,action,failed,rotating_light
priority: 5
details: 'Workflow has failed!'
headers: '${{ secrets.NTFY_HEADERS }}'

- name: ntfy cancelled notifications
uses: niniyas/ntfy-action@master
if: cancelled()
with:
url: ${{ secrets.NTFY_URL }}
topic: ${{ secrets.NTFY_TOPIC }}
tags: github,action,cancelled,skull
details: 'Workflow has been cancelled!'
headers: '${{ secrets.NTFY_HEADERS }}'
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Project
node_modules/
/tailon
/gin-bin
.pytest_cache
testdata/
### Editors ###
*~
\#*\#
.\#*
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]

### Go ###
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

*.log
*.bat

dist/
8 changes: 8 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
builds:
- binary: tailon
goos:
- linux
goarch:
- amd64
- arm64
- arm
71 changes: 71 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Changelog

## [1.0.0] - 2022-07-06
First of all, I am not familiar with GO or JavaScript. I learned them while I was trying to make this better. \
So you may find some codes here and there that were not meant to be and I apologize for that.

## UI
- A bunch of CSS tweaks
- Wrapped lines mode will have alternative colors between lines.
- Configuration dialog will now be hidden when clicking elsewhere.
- The logs will now fit most of the screens properly.
- Added the option to change background color and font color. Thanks to [nurzico/tailon](https://github.com/nurzico/tailon).
- Added labels for log levels. Thanks to [fquinto/tailon](https://github.com/fquinto/tailon) for the code. I added the rest of them.
- Added labels for all the HTTP methods.
- Added the ability to clear search field with escape button. Thanks to [bformet/tailon](https://github.com/bformet/tailon/commit/03d08ab3b36c9b982c09754d93ecfb8fdbd54284)
- Favicon is now displaying properly.
- Added a separate configuration for UI changes.
- Added the option for changing font type.
- Download file option now opens in a new window.
- Changed toolbar icons. They were from:
- [Eraser](https://www.svgrepo.com/svg/72555/eraser)
- [Settings](https://www.svgrepo.com/svg/10074/settings)
- [Download](https://www.svgrepo.com/svg/14689/download)
- [UI Tools](https://www.reshot.com/free-svg-icons/item/tool-YANDWEVLTJ/)
- Added a range slider to change font size. It is from [W3Schools](https://www.w3schools.com/howto/howto_js_rangeslider.asp).

## CLI
- Added command line `lines-to-tail` and `lines-of-history`. Thanks to [ebbeknudsen/tailon](https://github.com/ebbeknudsen/tailon/commit/944862f466790dfe67715c8c82f6edbd5605915a)
- Formatted help message.

## Config File
- Added the ability to load files from config.toml. Thanks to [joshuaboniface/tailon](https://github.com/joshuaboniface/tailon/commit/8d1a949e563a719938c1d74be693e49d57e246ed). \
You can view the example in [README](README.md#config-file) or [config.toml](config.toml). This code would only load multiple files from toml file but shows only the last one when using command line. I somehow managed to fix this. I am not sure how reliable it is. I just put one or two lines in 314-316 lines in main.go file. But in my testing it worked fine.

## Dependencies
- Updated frontend dependencies:
- autoprefixer: 8.6.1 -> 10.4.7
- clean-css: 4.1.11 -> 5.3.0
- clean-css-cli: 4.1.11 -> 5.6.0
- debounce: 1.1.0 -> 1.2.1
- node-sass: 4.11.0 -> 7.0.1
- npm: 6.13.4 -> 8.13.2
- postcss-cli: 5.0.0 -> 10.0.0
- sockjs-client: 1.3.0 -> 1.6.1
- uglify-js: 3.4.4 -> 3.16.2
- vue: 2.5.16 -> 2.7.2
- vue-loading-overlay: 2.1.0 -> 3.4.2
- vue-multiselect: 2.1.0 -> 2.1.6
- Added `@mdi/font` as a dependency.
- Updated updated materialdesignicons webfonts and css in `dist` folder from v5.8.55 -> v6.9.96.
- Updated sockjsv2 -> sockjsv3 in `server.go` file. Thanks to [GChuf/tailon](https://github.com/GChuf/tailon/commit/5684abaf7cae3722e1a659afcf0ff2ea8172a707).

## Development
- Added developement requirements and steps in [README](README.md). Huge thanks to [fquinto/tailon](https://github.com/fquinto/tailon) for including how to build in their README.
- Added `license`, `description`, `scripts`, `keywords`, `bugs` and `homepage` fields in `package.json` file.
- Added `npm run` commands to build frontend and tailon.
- `npm run build` will build dependencies, upgrade them, delete old .css and .js files and rebuilds them and exits.
- `npm run build-and-watch` will also build dependencies, upgrade them, delete old .css and .js files and rebuilds them and watches for changes in frontend files. This requires [entr](https://github.com/eradman/entr).
- `npm run build-tailon` will build tailon for your arch and exits.
- `npm run build-frontend-and-tailon` will build dependencies, upgrade them, delete old .css and .js files, rebuilds them and also build tailon and exits.

## Docker
- Added Dockerfile healthcheck.
- Removed `upx` dependency.
- Added multi-arch docker images, built with GitHub Actions.

## Miscellaneous
- `make all` command in frontend directory will beautify all the .js files and .css files that it creates.
- Favicon location was moved from `frontend/dist` directory to `frontend/dist/static/favicon` folder.
- Added `grep -v` command. Thanks to [alexeykobzev/tailon](https://github.com/alexeykobzev/tailon/commit/034b17b66c08d8ab3430b6e1521821969ddb7d99).
- `make README.md` command in root folder is broken. I have commented it out.
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM golang:alpine as build

WORKDIR /tailon

ADD . .

RUN apk add --upgrade binutils

RUN cd /tailon && \
go get && \
go build && \
strip tailon

RUN apk del binutils

FROM alpine:latest

RUN apk add gawk grep sed

COPY --from=build /tailon/tailon /usr/local/bin/tailon

CMD ["--help"]
ENTRYPOINT ["/usr/local/bin/tailon"]
EXPOSE 8080

HEALTHCHECK --interval=30s --timeout=60s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8080 || exit 1
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
BUILD ?= prod

dev:
go build -tags dev
$(MAKE) frontend BUILD=dev

test:
go test -v
#cd tests && pytest -v

frontend:
cd frontend && $(MAKE) clean ; $(MAKE) BUILD=$(BUILD)

frontend-watch:
cd frontend && $(MAKE) watch BUILD=$(BUILD)

docker-build:
docker buildx build --push --tag ghcr.io/niniyas/tailon:beta --platform linux/arm64,linux/amd64,linux/armv7 .

#README.md:
#sudo chmod +x build_readme.sh
#./build_readme.sh

.PHONY: test frontend frontend-watch docker-build README.md
Loading

0 comments on commit 5ed2859

Please sign in to comment.