Compare commits

..

No commits in common. "main" and "v0.0.10" have entirely different histories.

6 changed files with 16 additions and 14 deletions

View File

@ -5,7 +5,7 @@
tasks:
- name: Copy build to remote
ansible.builtin.copy:
src: ../ev
src: ../build/ev
dest: /usr/local/bin/ev
owner: root
group: root

View File

@ -9,8 +9,12 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
fetch-tags: true
- run: apt-get update && apt-get -y install ansible
- name: Set up Go
@ -18,17 +22,15 @@ jobs:
with:
go-version: 1.21.1
- name: Install
run: go install -ldflags "-s -w" go.sour.is/tools/cmd/ev@main
- run: mv $(go env GOPATH)/bin/ev ev
- name: Build
run: go build -ldflags "-s -w" -o ./build/ev ./cmd/ev
- name: Compress
uses: https://git.sour.is/actions/ghaction-upx@v2.4.0
with:
version: latest
files: |
./ev
./build/ev
args: -fq
- name: Deploy

1
.gitignore vendored
View File

@ -1,2 +1 @@
tools
sour.is-tools

View File

@ -1,6 +1,6 @@
export PATH:=$(shell go env GOPATH)/bin:$(PATH)
export EV_DATA=mem:
export EV_HTTP=:8085
export EV_HTTP=:8080
export WEBFINGER_DOMAINS=localhost
.DEFAULT_GOAL := air
@ -15,7 +15,7 @@ endif
air .
run:
go build -buildvcs=true -o sour.is-tools ./cmd/ev && ./sour.is-tools
go build . && ./tools
test:
go test -cover -race ./...

View File

@ -435,8 +435,8 @@ func (s *service) postResult(w http.ResponseWriter, r *http.Request, reqID strin
err := s.state.Use(ctx, func(ctx context.Context, state *state) error {
var ok bool
if _, ok = state.peers[peerID]; !ok {
log.Printf("peer not found: req=%s peer=%s\n", reqID, peerID)
return fmt.Errorf("peer not found: req=%s peer=%s", reqID, peerID)
log.Printf("peer not found: %s\n", peerID)
return fmt.Errorf("peer not found: %s", peerID)
}
return nil
@ -450,8 +450,8 @@ func (s *service) postResult(w http.ResponseWriter, r *http.Request, reqID strin
peerResults := &PeerResults{}
peerResults.SetStreamID(aggPeer(peerID))
err = s.es.Load(ctx, peerResults)
if err != nil && !errors.Is(err, ev.ErrNotFound) {
span.RecordError(fmt.Errorf("peer not found: req=%s peer=%s %w", reqID, peerID, err))
if err != nil {
span.RecordError(fmt.Errorf("peer not found: %w", err))
w.WriteHeader(http.StatusNotFound)
return
}

View File

@ -1,3 +1,4 @@
// <script src="https://unpkg.com/htmx.org@1.9.2" integrity="sha384-L6OqL9pRWyyFU3+/bjdSri+iIphTN/bvYyM37tICVyOJkWZLpP2vGn6VUEXgzg6h" crossorigin="anonymous"></script>
package main
import (