Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Godification #62

Merged
merged 30 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e39b020
init go
mishankov Nov 11, 2024
0158eeb
getting config
mishankov Nov 11, 2024
df44571
remove test config
mishankov Nov 12, 2024
7e44c10
NO TEST CONFIG EVER AGAIN
mishankov Nov 12, 2024
7e2e0de
sources handle
mishankov Nov 12, 2024
5b7a8fd
serve static files
mishankov Nov 12, 2024
a5a81ca
update ci
mishankov Nov 12, 2024
bd5936f
fix prettiter to check only js
mishankov Nov 12, 2024
618d537
only build js in ci
mishankov Nov 12, 2024
42029e1
fix go matrix
mishankov Nov 12, 2024
b42b2f5
add chi and stuff
mishankov Nov 13, 2024
9b4090a
websockets init
mishankov Nov 13, 2024
17fa4f6
tail from local file
mishankov Nov 13, 2024
71afd03
just better
mishankov Nov 13, 2024
8aaa7c7
more errors
mishankov Nov 13, 2024
60c27d4
add local docker
mishankov Nov 14, 2024
f7aef48
add some configuation
mishankov Nov 14, 2024
7d228d7
ignore readme for prettier
mishankov Nov 14, 2024
d9d1073
ssh:docker works for some reason
mishankov Nov 15, 2024
0e2b63e
Merge branch 'godification' of https://github.com/mishankov/web-tail …
mishankov Nov 15, 2024
a41a23c
add some todos
mishankov Nov 15, 2024
b6db8e3
add remote file and ssh key
mishankov Nov 15, 2024
9c65739
remove server js first iteration
mishankov Nov 15, 2024
4bc2292
Update Dockerfile
mishankov Nov 15, 2024
c5ecf10
Update docker-publish.yml
mishankov Nov 15, 2024
3e48e14
Create executables.yml
mishankov Nov 15, 2024
f35b298
Create new_ci.yml
mishankov Nov 15, 2024
70f73f9
use single CI
mishankov Nov 15, 2024
14631d8
apdate versions in CI
mishankov Nov 15, 2024
81804d8
vix versions in CI
mishankov Nov 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* text=auto
* text eol=lf
91 changes: 42 additions & 49 deletions .github/workflows/docker-publish.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
name: Docker

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: CI

on:
push:
branches: ["main"]
# Publish semver tags as releases.
branches: [main]
tags: ["v*.*.*"]
pull_request:
branches: ["main"]
branches: [main]

env:
# Use docker.io for Docker Hub if empty
Expand All @@ -20,83 +14,82 @@ env:
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
build-frontend:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Use Node.js 16.x
uses: actions/setup-node@v4
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16.x
cache: "npm"

- run: npm ci
- run: npm run lint
- run: npm run build --if-present
node-version: 20.x
- run: npm install
- run: npm run build:js

- name: Upload Linux executable
uses: actions/upload-artifact@v4
with:
name: web-tail-linux
path: dist/web-tail-linux
name: public
path: dist
retention-days: 5

- name: Upload macOS executable
uses: actions/upload-artifact@v4
build-backend:
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [ubuntu, windows, macos]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
name: web-tail-macos
path: dist/web-tail-macos
retention-days: 5
go-version: 1.23
- run: go build -o ./build/ -v ./server

- name: Upload windows executable
- name: Upload Linux executable
uses: actions/upload-artifact@v4
with:
name: web-tail-win
path: dist/web-tail-win.exe
name: web-tail-${{ matrix.os }}
path: build
retention-days: 5

# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
# - name: Install cosign
# if: github.event_name != 'pull_request'
# uses: sigstore/cosign-installer@7e0881f8fe90b25e305bbf0309761e9314607e25
# with:
# cosign-release: "v1.9.0"
docker:
needs: [build-backend, build-frontend]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
uses: docker/setup-buildx-action@v3

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log in to the Container registry
uses: docker/login-action@7ca345011ac4304463197fac0e56eab1bc7e6af0
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@0de3687b53cd804b63dd87819f7bda043569ce4a
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
uses: docker/build-push-action@5e99dacf67635c4f273e532b9266ddb609b3025a
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

32 changes: 0 additions & 32 deletions .github/workflows/node.js.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
*.log
web-tail-*/
src/common/wasm/target/*
web-tail.config.toml

.DS_Store
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
dist
web-tail-*/
.github/*
server/*
pkg/*
README.md
22 changes: 16 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
FROM node:16
FROM golang:1.23 AS buildgo
WORKDIR /app
COPY . .
RUN CGO_ENABLED=0 go build -o ./build/server ./server

WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY dist ./dist

FROM node:22 AS buildjs
WORKDIR /app
COPY . .
RUN npm ci
RUN npm run build:js


FROM alpine:3
WORKDIR /app
COPY --from=buildgo /app/build/server /app/server
COPY --from=buildjs /app/dist /app/dist
EXPOSE 4444
CMD [ "npm", "run", "start" ]
ENTRYPOINT ["/app/server"]
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Web tail

[![CI](https://github.com/mishankov/web-tail/actions/workflows/ci.yml/badge.svg)](https://github.com/mishankov/web-tail/actions/workflows/ci.yml)
[![CodeFactor](https://www.codefactor.io/repository/github/mishankov/web-tail/badge)](https://www.codefactor.io/repository/github/mishankov/web-tail)

Web application to view lines from file on local system or on remote server built with [Svelte](https://github.com/sveltejs/svelte)
Expand All @@ -10,6 +11,8 @@ Web application to view lines from file on local system or on remote server buil

Download and unpack `web-tail-x.x.x-[platform].zip` from [latest release](https://github.com/mishankov/web-tail/releases/latest)

Docker image is also available [here](https://github.com/mishankov/web-tail/pkgs/container/web-tail)

## Configuration

In unpacked folder edit `web-tail.config.toml` file
Expand Down Expand Up @@ -60,3 +63,8 @@ Options from left to right:
- `Aa` toggle. If enabled makes search case sensitive
- `Reverse` toggle. If enabled latest lines shown on top
- Max lines field. How much lines will be shown


## Development

Set environment variable `ASSETS=dist/public` before doing `go run ./server` to user preemtively compiled assets
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/client/pages/Logs.svelte → client/pages/Logs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
logs.update((buff) => {
return new CircularBuffer<string>($logWindow);
});
socket = new WebSocket(`ws://${location.host}/${source}/${$logWindow}`);
socket = new WebSocket(`ws://${location.host}/logstream/${source}/${$logWindow}`);

socket.addEventListener("open", function (event) {
console.log("Socket opened", source);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module web-tail

go 1.23.0

require github.com/BurntSushi/toml v1.4.0

require github.com/go-chi/chi/v5 v5.1.0

require (
github.com/gorilla/websocket v1.5.3
github.com/mishankov/go-utlz v0.0.3
github.com/nxadm/tail v1.4.11
golang.org/x/crypto v0.29.0
)

require (
github.com/fsnotify/fsnotify v1.6.0 // indirect
golang.org/x/sys v0.27.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
)
21 changes: 21 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw=
github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/mishankov/go-utlz v0.0.3 h1:iSrGlCeJ8La5M9oFuELQ1AIA6W/nWxilfA7bjiP2hoE=
github.com/mishankov/go-utlz v0.0.3/go.mod h1:ioIgxxn/MMg+7AWli68mApcJXXpaDQ6790Hu0tQFV6E=
github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY=
github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc=
golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU=
golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
Loading