Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
2b2bc77
Initialized C++ Worker
prabhuomkar Mar 31, 2025
d99d569
Added GitHub Actions
prabhuomkar Mar 31, 2025
093eff4
Some tests and benchmarks for places
prabhuomkar Apr 1, 2025
aa29b0c
Some cppcheck updates
prabhuomkar Apr 2, 2025
c679c3d
Places updated to handle new schema correctly
prabhuomkar Apr 2, 2025
00792c9
Added graceful shutdown and setting up for grpc client
prabhuomkar Apr 15, 2025
4931747
Simplified build process and added namespace
prabhuomkar Apr 15, 2025
8a1b917
Added grpc client to get worker config on startup
prabhuomkar Apr 15, 2025
662a651
Added all api client methods
prabhuomkar Apr 17, 2025
db0aac7
With places decoding
prabhuomkar Apr 17, 2025
b31a589
Worker pull mediaitems from API to process
prabhuomkar Apr 18, 2025
15cbf05
Update Makefile commands
prabhuomkar Apr 18, 2025
22c428f
Updated API and ready to switch to pgx
prabhuomkar Jun 3, 2025
d454559
WIP transition from gorm to pgx
prabhuomkar Jun 4, 2025
f7aec32
More tests and left with mediaitems
prabhuomkar Jun 4, 2025
ef34dd7
WIP needs linter and test fixes
prabhuomkar Jun 5, 2025
d5051a1
Linter fixes and pgx transition done, needs testing
prabhuomkar Jun 6, 2025
e2fe5a3
Updated docs
prabhuomkar Jun 8, 2025
7d00c7a
Updated dependencies and improved coverage
prabhuomkar Jun 8, 2025
cf8d063
Some WIP stuff with UI
prabhuomkar Aug 16, 2025
5aacee4
WIP with UI
prabhuomkar Sep 11, 2025
562dda9
metadata component
prabhuomkar Sep 11, 2025
768421e
metadata extraction code complete
prabhuomkar Sep 12, 2025
5f6a6ad
Updated docs
prabhuomkar Sep 12, 2025
3429650
Some linter simplification in API
prabhuomkar Sep 12, 2025
b8ebc3e
Some work on grpc service side
prabhuomkar Sep 13, 2025
79ff79d
Added megapixels
prabhuomkar Sep 13, 2025
195dd09
Some cleanup and queuing of mediaitems to be processed
prabhuomkar Sep 13, 2025
6793558
queue mediaitems to process from upload or job, return them for proce…
prabhuomkar Sep 14, 2025
f4d29f8
Simplified mediaitem to process query
prabhuomkar Sep 14, 2025
0fee6a1
Handle no rows to process
prabhuomkar Sep 14, 2025
cd4b684
Worker able to pull mediaitems for process
prabhuomkar Sep 14, 2025
27ab555
METADATA and PLACES components working with results syncing correctly
prabhuomkar Sep 14, 2025
7d3e29c
Updated workflows
prabhuomkar Sep 15, 2025
5cafaff
preview and thumbnail working with data sync correctly, need exceptio…
prabhuomkar Sep 15, 2025
026bfb7
Correct the api/pkg usage
prabhuomkar Sep 16, 2025
c2008b9
Handling exceptions from individual components
prabhuomkar Sep 16, 2025
3435155
Use correct enums for communication and passing tests
prabhuomkar Sep 16, 2025
bc66bde
Correct the job API to use enums
prabhuomkar Sep 16, 2025
bd12689
make API faster, fixes for albums, more tests working YAY!
prabhuomkar Sep 16, 2025
e8401bc
fixes for sharing, tests are working YAY!
prabhuomkar Sep 16, 2025
1f9e633
simplified filters with enums
prabhuomkar Sep 16, 2025
e4ede7e
more tests working, left with ML and Video support ONLY :)
prabhuomkar Sep 18, 2025
a5b2694
UI and Docs Update
prabhuomkar Sep 18, 2025
d53a085
Fixing UI colors
prabhuomkar Sep 18, 2025
fc9e4de
Some UI tweaks
prabhuomkar Sep 18, 2025
ec9b3e2
Make smriti simpler by making it similar to features of cloud photo s…
prabhuomkar Sep 19, 2025
1c5399f
Faces Model in ONNX using IResNet50 for recognition and SCRFD for det…
prabhuomkar Sep 21, 2025
930b45c
Simplify the inference code, need to divide into preprocess and postp…
prabhuomkar Sep 21, 2025
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
16 changes: 8 additions & 8 deletions .github/workflows/api.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Smriti API CI
on:
push:
branches:
branches:
- master
paths:
- api/**
Expand All @@ -23,17 +23,17 @@ jobs:
working-directory: ./api
steps:
- name: Git Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Setup Golang
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version: '^1.24'
go-version: "^1.25"
- name: Go Version
run: go version
- name: Run Lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v8
with:
version: v1.64.6
version: v2.4.0
working-directory: api
- name: Run Build
run: make build
Expand All @@ -55,7 +55,7 @@ jobs:
working-directory: ./api
steps:
- name: Git Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
Expand All @@ -75,4 +75,4 @@ jobs:
build-args: |
GITSHA=${{ github.sha }}
VERSION=${ github.ref_name }}
tags: smritihq/api:${{ github.ref_name }}
tags: smritihq/api:${{ github.ref_name }}
7 changes: 3 additions & 4 deletions .github/workflows/ml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
working-directory: ./ml
steps:
- name: Git Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Setup Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.12.x'
python-version: "3.12.x"
- name: Python Version
run: python -c "import sys; print(sys.version)"
- name: Install Dependencies
Expand All @@ -32,4 +32,3 @@ jobs:
with:
files: |
ml/models.zip

80 changes: 80 additions & 0 deletions .github/workflows/pyworker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Smriti PyWorker CI
on:
push:
branches:
- master
paths:
- pyworker/**
- .github/workflows/pyworker.yaml
pull_request:
branches:
- master
paths:
- pyworker/**
- .github/workflows/pyworker.yaml
release:
types: [published]
jobs:
ci:
name: Integration Check
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./pyworker
steps:
- name: Git Checkout
uses: actions/checkout@v5
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.12.x"
- name: Python Version
run: python -c "import sys; print(sys.version)"
- name: Install Dependencies
run: make install
- name: Run Lint
run: |
pip install pylint==3.3.4
make lint
- name: Run Test & Cover
run: |
sudo apt-get install -y libimage-exiftool-perl exiftool libraw-dev
make test-install
make cover
- name: Publish Coverage
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: worker
files: pyworker/coverage.xml
publish:
if: ${{ (github.event_name == 'release' && github.event.action == 'published') || github.ref == 'refs/heads/master' }}
needs: ci
name: Publish Docker Image
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./pyworker
steps:
- name: Git Checkout
uses: actions/checkout@v5
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker Build and Push
uses: docker/build-push-action@v6
with:
context: worker
file: ./pyworker/Dockerfile
push: true
platforms: linux/amd64,linux/arm64/v8
build-args: |
GITSHA=${{ github.sha }}
VERSION=${ github.ref_name }}
tags: smritihq/pyworker:${{ github.ref_name }}
30 changes: 14 additions & 16 deletions .github/workflows/worker.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Smriti Worker CI
on:
push:
branches:
branches:
- master
paths:
- worker/**
Expand All @@ -23,24 +23,22 @@ jobs:
working-directory: ./worker
steps:
- name: Git Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
uses: actions/checkout@v5
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
python-version: '3.12.x'
- name: Python Version
run: python -c "import sys; print(sys.version)"
- name: Install Dependencies
run: make install
cmake-version: "3.30.x"
- name: CMake Version
run: cmake --version
- name: Run Lint
run: |
pip install pylint==3.3.4
pip install cpplint
cpplint --version
make lint
- name: Run Build
run: make build-with-tests
- name: Run Test & Cover
run: |
sudo apt-get install -y libimage-exiftool-perl exiftool libraw-dev
make test-install
make cover
run: make test
- name: Publish Coverage
uses: codecov/codecov-action@v5
with:
Expand All @@ -57,7 +55,7 @@ jobs:
working-directory: ./worker
steps:
- name: Git Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
Expand All @@ -77,4 +75,4 @@ jobs:
build-args: |
GITSHA=${{ github.sha }}
VERSION=${ github.ref_name }}
tags: smritihq/worker:${{ github.ref_name }}
tags: smritihq/worker:${{ github.ref_name }}
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
storage/*
samples*
models.zip
models/*
models/*
.DS_Store
Thumbs.db
.vscode/
.idea/
22 changes: 20 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
setup: setup-api setup-worker setup-docs setup-tests
setup: setup-api setup-pyworker setup-docs setup-tests

setup-api:
@cd api; \
echo "[setup-api]: Verifying go modules..."; \
Expand All @@ -7,32 +8,49 @@ setup-api:
make lint; \
echo "[setup-api]: Running unit tests..."; \
make test

setup-worker:
@cd worker; \
echo "[setup-worker]: Installing requirements"; \
echo "[setup-worker]: Installing dependencies"; \
make install; \
make test-install; \
echo "[setup-worker]: Running linter..."; \
make lint; \
echo "[setup-worker]: Running unit tests..."; \
make test

setup-pyworker:
@cd pyworker; \
echo "[setup-pyworker]: Installing requirements"; \
make install; \
make test-install; \
echo "[setup-pyworker]: Running linter..."; \
make lint; \
echo "[setup-pyworker]: Running unit tests..."; \
make test

setup-docs:
@cd docs; \
echo "[setup-docs]: Installing dependencies"; \
npm install

setup-tests:
@cd tests; \
echo "[setup-tests]: Installing dependencies"; \
make setup

setup-models:
@echo "Setting up models..."; \
python3 scripts/setup_models.py

start: setup-models
@echo "Starting smriti services..."; \
docker compose up -d

stop:
@echo "Stopping smriti services..."; \
docker compose down

gen-test-data: start
@echo "Generating test data"; \
python3 scripts/generate_test_data.py
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Smarter Home for all your Photos and Videos

[![API](https://github.com/prabhuomkar/smriti/actions/workflows/api.yaml/badge.svg)](https://github.com/prabhuomkar/smriti/actions/workflows/api.yaml)
[![Worker](https://github.com/prabhuomkar/smriti/actions/workflows/worker.yaml/badge.svg)](https://github.com/prabhuomkar/smriti/actions/workflows/worker.yaml)
[![Worker](https://github.com/prabhuomkar/smriti/actions/workflows/pyworker.yaml/badge.svg)](https://github.com/prabhuomkar/smriti/actions/workflows/worker.yaml)
[![Coverage](https://codecov.io/gh/prabhuomkar/smriti/branch/master/graph/badge.svg?token=D32LxO5fIj)](https://codecov.io/gh/prabhuomkar/smriti)
[![License](https://img.shields.io/github/license/prabhuomkar/smriti)](LICENSE)
[![Twitter](https://img.shields.io/twitter/follow/smritihq?style=social)](https://twitter.com/smritihq)
Expand Down
49 changes: 34 additions & 15 deletions api/.golangci.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,41 @@
version: "2"
run:
timeout: 2m
tests: false
linters:
enable-all: true
default: all
disable:
- nlreturn
- nosprintfhostport
- wsl
- wrapcheck
- exhaustivestruct
- depguard
- exhaustruct
- gci
- dupl
- goerr113
- tagalign
- depguard
- interfacer
- protogetter
linters-settings:
lll:
line-length: 180
- tagalign
- wrapcheck
- wsl_v5
- noinlineerr
- wsl
- funlen
settings:
lll:
line-length: 180
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- gofumpt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
2 changes: 1 addition & 1 deletion api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.24-alpine AS builder
FROM golang:1.25-alpine AS builder
RUN apk update && apk add --no-cache git
WORKDIR /app
COPY go.mod go.sum ./
Expand Down
19 changes: 17 additions & 2 deletions api/Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
.PHONY: build
build:
@go build -o api --ldflags="-X 'api/internal/models.DefaultVersion=$(VERSION)' -X 'api/internal/models.DefaultGitSHA=$(shell git rev-parse HEAD)'"

.PHONY: migrate-up
migrate-up:
@migrate -path=pkg/database/migrations -database "${DATABASE_URL}" -verbose up

.PHONY: migrate-down
migrate-down:
@migrate -path=pkg/database/migrations -database "${DATABASE_URL}" -verbose down

.PHONY: run
run: build
@./api

.PHONY: test
test:
@go test ./...

.PHONY: cover
cover:
@go test $$(go list ./... | grep -v api/pkg/services) -race -coverprofile=coverage.txt -covermode=atomic ./...
@go test -race -coverprofile=coverage.txt -covermode=atomic -coverpkg=$($$(go list ./... | grep -v api/pkg/services) | tr ' ' ',') $$(go list ./... | grep -v api/pkg/services)
@go tool cover -func coverage.txt | grep total

.PHONY: cover-html
cover-html: cover
@go tool cover -html coverage.txt -o coverage.html

.PHONY: lint
lint:
@LOG_LEVEL=error golangci-lint run ./...

.PHONY: proto
proto:
@protoc --proto_path=../protos ../protos/*.proto --go_out=pkg/services --go-grpc_out=pkg/services --experimental_allow_proto3_optional
@protoc --proto_path=../protos ../protos/*.proto --go_out=pkg/services --go-grpc_out=pkg/services
Loading
Loading