Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
apk add --no-cache git make
go env
- name: Clone
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Restart_MQTT
# Restart MQTT after volumes have been checked out
uses: docker://docker
Expand All @@ -62,9 +62,9 @@ jobs:
apk add --no-cache docker docker-cli-buildx
docker login -u thingspect -p ${{ secrets.GHCR_PAT }} ghcr.io
git config --global --add safe.directory /__w/atlas/atlas
TAG=$(git rev-parse --short=8 HEAD)
TAG=$(git rev-parse --short=7 HEAD)
docker buildx create --use
#docker buildx build -f build/Dockerfile -t ghcr.io/thingspect/atlas:${TAG} --platform linux/amd64,linux/arm64 --push .
docker buildx build -f build/Dockerfile -t ghcr.io/thingspect/atlas:${TAG} --push .
#docker buildx build --progress plain -f build/Dockerfile -t ghcr.io/thingspect/atlas:${TAG} --platform linux/amd64,linux/arm64 --push .
docker buildx build --progress plain -f build/Dockerfile -t ghcr.io/thingspect/atlas:${TAG} --push .
docker buildx rm
docker logout ghcr.io
23 changes: 20 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,32 @@
# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
# Code coverage profiles and other test artifacts
*.out
coverage.*
*.coverprofile
profile.cov

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work
go.work.sum

# env file
.env

# Editor/IDE, AI not welcome
.idea/
.vscode/
.claude/
CLAUDE.md

### macOS ###
.DS_Store

### Thingspect ###
/api/protobuf/common
### Atlas ###
/bin
/proto/protobuf/api
/proto/protobuf/common
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,15 @@ install:
-ldflags="-w" ./$${x}; done

lint:
go install honnef.co/go/tools/cmd/staticcheck@latest
# staticcheck defaults are all,-ST1000,-ST1003,-ST1016,-ST1020,-ST1021,-ST1022
staticcheck -checks all ./...
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck -test ./...

go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
golangci-lint run -E bidichk,copyloopvar,durationcheck,err113,errname \
-E forcetypeassert,funcorder,godot,gosec,intrange,modernize,nlreturn \
-E perfsprint,prealloc,protogetter,testifylint,unconvert,unparam \
-E usestdlibvars,usetesting

go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck -test ./...

init_db:
echo FLUSHALL|nc -w 2 $(TEST_REDIS_HOST) 6379

Expand Down
23 changes: 6 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@

## Getting Started

Install any compliant package of
[Docker](https://docs.docker.com/get-started/overview/),
[Docker Compose](https://docs.docker.com/compose/), and
[Go](https://go.dev/dl/). Consider using
[Colima](https://github.com/abiosoft/colima):
Install any compliant package of [Docker](https://docs.docker.com/get-started/overview/), [Docker Compose](https://docs.docker.com/compose/), and [Go](https://go.dev/dl/). Consider using [Colima](https://github.com/abiosoft/colima):

```
brew install colima docker docker-compose docker-buildx
colima start --cpu 3 --memory 3 --disk 16 --mount-type virtiofs --mount ~/code/go:w
```

Run a build and tests:
Run the build and tests:

```
docker compose -f build/docker-compose.yml up -d
Expand All @@ -35,21 +31,15 @@ API_PWT_KEY=$(dd if=/dev/random bs=1 count=32|base64) API_API_HOST=127.0.0.1 atl
curl -v -X POST -d '{"email":"testadmin@thingspect.com", "orgName":"testorg", "password":"testpass"}' http://localhost:8000/v1/sessions/login
```

OpenAPI live docs are available at
[http://localhost:8000/](http://localhost:8000/).
OpenAPI live docs are available at [http://localhost:8000/](http://localhost:8000/).

## Deploying

[Docker Compose](https://docs.docker.com/compose/) files for the Atlas platform
and its dependencies are available in `build/deploy/`. These can be used for a
single-system deploy, or as templates for orchestration tooling such as
[Nomad](https://www.nomadproject.io/) or [Kubernetes](https://kubernetes.io/).
Keys should be provided where applicable.
[Docker Compose](https://docs.docker.com/compose/) files for the Atlas platform and its dependencies are available in `build/deploy/`. These can be used for a single-system deploy, or as templates for orchestration tooling such as [Nomad](https://www.nomadproject.io/) or [Kubernetes](https://kubernetes.io/). Keys should be provided where applicable.

## Use of Build Tags In Tests

All non-generated test files should have build tags, including `main_test.go`.
Due to limitations of developer tools and extensions, negated tags are used.
All non-generated test files should have build tags, including `main_test.go`. Due to limitations of developer tools and extensions, negated tags are used.

For example, to tag a file as a unit test:

Expand All @@ -63,8 +53,7 @@ To tag a file as an integration test:
// +build !unit
```

To find test files that are missing build tags, the following command can be
run:
To find test files that are missing build tags, the following command can be run:

```
find . -name '*_test.go' -type f|grep -v /mock_|xargs grep -L '//go:build'
Expand Down
6 changes: 3 additions & 3 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Manual build:
# docker login -u thingspect -p XXX ghcr.io
# TAG=$(git rev-parse --short=8 HEAD)
# TAG=$(git rev-parse --short=7 HEAD)
# docker buildx create --use
## docker buildx build -f build/Dockerfile -t ghcr.io/thingspect/atlas:${TAG} --platform linux/amd64,linux/arm64 --push .
# docker buildx build -f build/Dockerfile -t ghcr.io/thingspect/atlas:${TAG} --push .
## docker buildx build --progress plain -f build/Dockerfile -t ghcr.io/thingspect/atlas:${TAG} --platform linux/amd64,linux/arm64 --push .
# docker buildx build --progress plain -f build/Dockerfile -t ghcr.io/thingspect/atlas:${TAG} --push .
# docker buildx rm
# docker logout ghcr.io
FROM golang:1-alpine AS build
Expand Down
16 changes: 8 additions & 8 deletions build/deploy/atlas/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
atlas-api:
image: ghcr.io/thingspect/atlas:20fdf140
image: ghcr.io/thingspect/atlas:bf173430
command: atlas-api
restart: on-failure
ports:
Expand All @@ -22,7 +22,7 @@ services:
- API_LORA_DEV_PROF_ID=00000000-0000-0000-0000-000000000000

atlas-mqtt-ingestor:
image: ghcr.io/thingspect/atlas:20fdf140
image: ghcr.io/thingspect/atlas:bf173430
command: atlas-mqtt-ingestor
restart: on-failure
depends_on:
Expand All @@ -34,7 +34,7 @@ services:
- MQTT_INGEST_NSQ_PUB_ADDR=nsqd:4150

atlas-lora-ingestor:
image: ghcr.io/thingspect/atlas:20fdf140
image: ghcr.io/thingspect/atlas:bf173430
command: atlas-lora-ingestor
restart: on-failure
depends_on:
Expand All @@ -47,7 +47,7 @@ services:
- LORA_INGEST_NSQ_PUB_ADDR=nsqd:4150

atlas-decoder:
image: ghcr.io/thingspect/atlas:20fdf140
image: ghcr.io/thingspect/atlas:bf173430
command: atlas-decoder
restart: on-failure
depends_on:
Expand All @@ -60,7 +60,7 @@ services:
- DECODER_NSQ_LOOKUP_ADDRS=nsqlookupd:4161

atlas-validator:
image: ghcr.io/thingspect/atlas:20fdf140
image: ghcr.io/thingspect/atlas:bf173430
command: atlas-validator
restart: on-failure
depends_on:
Expand All @@ -74,7 +74,7 @@ services:
- VALIDATOR_NSQ_LOOKUP_ADDRS=nsqlookupd:4161

atlas-accumulator:
image: ghcr.io/thingspect/atlas:20fdf140
image: ghcr.io/thingspect/atlas:bf173430
command: atlas-accumulator
restart: on-failure
environment:
Expand All @@ -85,7 +85,7 @@ services:
- ACCUMULATOR_NSQ_LOOKUP_ADDRS=nsqlookupd:4161

atlas-eventer:
image: ghcr.io/thingspect/atlas:20fdf140
image: ghcr.io/thingspect/atlas:bf173430
command: atlas-eventer
restart: on-failure
depends_on:
Expand All @@ -98,7 +98,7 @@ services:
- EVENTER_NSQ_LOOKUP_ADDRS=nsqlookupd:4161

atlas-alerter:
image: ghcr.io/thingspect/atlas:20fdf140
image: ghcr.io/thingspect/atlas:bf173430
command: atlas-alerter
restart: on-failure
environment:
Expand Down
29 changes: 14 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
module github.com/thingspect/atlas

go 1.26.1
go 1.26.4

require (
github.com/NYTimes/gziphandler v1.1.1
github.com/chirpstack/chirpstack/api/go/v4 v4.17.0
github.com/chirpstack/chirpstack/api/go/v4 v4.18.0
github.com/eclipse/paho.mqtt.golang v1.5.1
github.com/expr-lang/expr v1.17.8
github.com/google/uuid v1.6.0
github.com/gregdel/pushover v1.4.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0
github.com/jackc/pgx/v5 v5.8.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0
github.com/jackc/pgx/v5 v5.10.0
github.com/jellydator/ttlcache/v3 v3.4.0
github.com/maypok86/otter/v2 v2.3.0
github.com/mennanov/fmutils v0.3.6
github.com/nsqio/go-nsq v1.1.0
github.com/redis/go-redis/v9 v9.18.0
github.com/redis/go-redis/v9 v9.20.0
github.com/smira/go-statsd v1.3.4
github.com/stretchr/testify v1.11.1
github.com/thingspect/proto/go v1.1.16
github.com/thingspect/proto/go v1.1.17
go.uber.org/mock v0.6.0
golang.org/x/crypto v0.49.0
google.golang.org/grpc v1.79.3
golang.org/x/crypto v0.53.0
google.golang.org/grpc v1.81.1
google.golang.org/protobuf v1.36.11
)

require (
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/envoyproxy/protoc-gen-validate v1.3.3 // indirect
github.com/golang/snappy v1.0.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
Expand All @@ -38,11 +37,11 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/net v0.52.0 // indirect
golang.org/x/sync v0.20.0 // indirect
golang.org/x/sys v0.42.0 // indirect
golang.org/x/text v0.35.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260319201613-d00831a3d3e7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260319201613-d00831a3d3e7 // indirect
golang.org/x/net v0.55.0 // indirect
golang.org/x/sync v0.21.0 // indirect
golang.org/x/sys v0.46.0 // indirect
golang.org/x/text v0.38.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260608224507-4308a22a1bab // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260608224507-4308a22a1bab // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading