From b86aa06bbbd3e4c60374b3bcd80afeccbc56aa1a Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Thu, 5 Jun 2025 00:55:45 +0200 Subject: [PATCH 1/4] Fix rails env call --- config/puma.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/config/puma.rb b/config/puma.rb index 9157f6ba..d0e2b212 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -44,7 +44,13 @@ preload_app! plugin :tmp_restart # If env var is set or we're in development, solid_queue will run in puma -plugin :solid_queue if ENV['SOLID_QUEUE_IN_PUMA'] || Rails.env.development? +if ENV['SOLID_QUEUE_IN_PUMA'] || ENV.fetch('RAILS_ENV', 'development') == 'development' + begin + plugin :solid_queue + rescue => e + puts "Failed to load solid_queue plugin: #{e.message}" + end +end # Prometheus exporter if ENV['PROMETHEUS_EXPORTER_ENABLED'].to_s == 'true' From 585ed66a9082c645a90c450315f2c19c772fabc4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Jun 2025 05:31:57 +0000 Subject: [PATCH 2/4] Bump rack from 3.1.15 to 3.1.16 in the bundler group Bumps the bundler group with 1 update: [rack](https://github.com/rack/rack). Updates `rack` from 3.1.15 to 3.1.16 - [Release notes](https://github.com/rack/rack/releases) - [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md) - [Commits](https://github.com/rack/rack/compare/v3.1.15...v3.1.16) --- updated-dependencies: - dependency-name: rack dependency-version: 3.1.16 dependency-type: indirect dependency-group: bundler ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index bee7db1e..d3f394e2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -302,7 +302,7 @@ GEM activesupport (>= 3.0.0) raabro (1.4.0) racc (1.8.1) - rack (3.1.15) + rack (3.1.16) rack-session (2.1.1) base64 (>= 0.1.0) rack (>= 3.0.0) From 3d2666c4ee71d75ef6f4ccaee3d4b4f5c62dc912 Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Thu, 5 Jun 2025 21:10:40 +0200 Subject: [PATCH 3/4] Fix a few issues and implement location iq support --- .app_version | 2 +- CHANGELOG.md | 36 +++++++++++++++++++-------- app/controllers/imports_controller.rb | 2 +- app/jobs/application_job.rb | 2 -- config/database.yml | 3 ++- config/initializers/01_constants.rb | 2 ++ config/initializers/geocoder.rb | 3 +++ docker/Dockerfile.dev | 2 ++ lib/tasks/import.rake | 2 +- spec/requests/imports_spec.rb | 1 + 10 files changed, 39 insertions(+), 16 deletions(-) diff --git a/.app_version b/.app_version index 3edc695d..b38e1e76 100644 --- a/.app_version +++ b/.app_version @@ -1 +1 @@ -0.27.2 +0.27.3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b489bcb..234b872c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +# 0.27.3 - 2025-06-05 + +## Changed + +- Added `PGSSENCMODE=disable` to the development environment to resolve sqlite3 error. #1326 #1331 + +## Fixed + +- Fixed rake tasks to be run with `bundle exec`. #1320 +- Fixed import name not being set when updating an import. #1269 + +## Added + +- LocationIQ can now be used as a geocoding service. Set `LOCATIONIQ_API_KEY` to configure it. #1334 + + # 0.27.2 - 2025-06-02 You can now safely remove Redis and Sidekiq from your `docker-compose.yml` file, both containers, related volumes, environment variables and container dependencies. @@ -256,7 +272,7 @@ Also, after updating to this version, Dawarich will start a huge background job - Fixed a bug with an attempt to write points with same lonlat and timestamp from iOS app. #1170 - Importing GeoJSON files now saves velocity if it was stored in either `velocity` or `speed` property. -- `rake points:migrate_to_lonlat` should work properly now. #1083 #1161 +- `bundle exec rake points:migrate_to_lonlat` should work properly now. #1083 #1161 - PostGIS extension is now being enabled only if it's not already enabled. #1186 - Fixed a bug where visits were returning into Suggested state after being confirmed or declined. #848 - If no points are found for a month during stats calculation, stats are now being deleted instead of being left empty. #1066 #406 @@ -303,7 +319,7 @@ If you have encountered problems with moving to a PostGIS image while still on P ## Fixed -- `rake points:migrate_to_lonlat` task now works properly. +- `bundle exec rake points:migrate_to_lonlat` task now works properly. # 0.25.8 - 2025-04-24 @@ -358,7 +374,7 @@ This is optional feature and is not required for the app to work. ## Changed -- `rake points:migrate_to_lonlat` task now also tries to extract latitude and longitude from `raw_data` column before using `longitude` and `latitude` columns to fill `lonlat` column. +- `bundle exec rake points:migrate_to_lonlat` task now also tries to extract latitude and longitude from `raw_data` column before using `longitude` and `latitude` columns to fill `lonlat` column. - Docker entrypoints are now using `DATABASE_NAME` environment variable to check if Postgres is existing/available. - Sidekiq web UI is now protected by basic auth. Use `SIDEKIQ_USERNAME` and `SIDEKIQ_PASSWORD` environment variables to set the credentials. @@ -415,12 +431,12 @@ volumes: ``` -In this release we're changing the way import files are being stored. Previously, they were being stored in the `raw_data` column of the `imports` table. Now, they are being attached to the import record. All new imports will be using the new storage, to migrate existing imports, you can use the `rake imports:migrate_to_new_storage` task. Run it in the container shell. +In this release we're changing the way import files are being stored. Previously, they were being stored in the `raw_data` column of the `imports` table. Now, they are being attached to the import record. All new imports will be using the new storage, to migrate existing imports, you can use the `bundle exec rake imports:migrate_to_new_storage` task. Run it in the container shell. This is an optional task, that will not affect your points or other data. Big imports might take a while to migrate, so be patient. -Also, you can now migrate existing exports to the new storage using the `rake exports:migrate_to_new_storage` task (in the container shell) or just delete them. +Also, you can now migrate existing exports to the new storage using the `bundle exec rake exports:migrate_to_new_storage` task (in the container shell) or just delete them. If your hardware doesn't have enough memory to migrate the imports, you can delete your imports and re-import them. @@ -441,7 +457,7 @@ If your hardware doesn't have enough memory to migrate the imports, you can dele ## Fixed - Moving points on the map now works correctly. #957 -- `rake points:migrate_to_lonlat` task now also reindexes the points table. +- `bundle exec rake points:migrate_to_lonlat` task now also reindexes the points table. - Fixed filling `lonlat` column for old places after reverse geocoding. - Deleting an import now correctly recalculates stats. - Datetime across the app is now being displayed in human readable format, i.e 26 Dec 2024, 13:49. Hover over the datetime to see the ISO 8601 timestamp. @@ -451,7 +467,7 @@ If your hardware doesn't have enough memory to migrate the imports, you can dele ## Fixed -- Fixed missing `rake points:migrate_to_lonlat` task. +- Fixed missing `bundle exec rake points:migrate_to_lonlat` task. # 0.25.2 - 2025-03-21 @@ -462,9 +478,9 @@ If your hardware doesn't have enough memory to migrate the imports, you can dele ## Added -- `rake data_cleanup:remove_duplicate_points` task added to remove duplicate points from the database and export them to a CSV file. -- `rake points:migrate_to_lonlat` task added for convenient manual migration of points to the new `lonlat` column. -- `rake users:activate` task added to activate all users. +- `bundle exec rake data_cleanup:remove_duplicate_points` task added to remove duplicate points from the database and export them to a CSV file. +- `bundle exec rake points:migrate_to_lonlat` task added for convenient manual migration of points to the new `lonlat` column. +- `bundle exec rake users:activate` task added to activate all users. ## Changed diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb index 0e28d3b4..2ac0b6ef 100644 --- a/app/controllers/imports_controller.rb +++ b/app/controllers/imports_controller.rb @@ -83,7 +83,7 @@ class ImportsController < ApplicationController end def import_params - params.require(:import).permit(:source, files: []) + params.require(:import).permit(:name, :source, files: []) end def create_import_from_signed_id(signed_id) diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index ddeab5d8..bef39599 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -4,8 +4,6 @@ class ApplicationJob < ActiveJob::Base # Automatically retry jobs that encountered a deadlock # retry_on ActiveRecord::Deadlocked - retry_on Exception, wait: :polynomially_longer, attempts: 25 - # Most jobs are safe to ignore if the underlying records are no longer available # discard_on ActiveJob::DeserializationError end diff --git a/config/database.yml b/config/database.yml index 75004309..26448dc5 100644 --- a/config/database.yml +++ b/config/database.yml @@ -12,7 +12,8 @@ default: &default sqlite_default: &sqlite_default adapter: sqlite3 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 10 } %> - timeout: 5000 + retries: 100 + default_transaction_mode: IMMEDIATE development: primary: diff --git a/config/initializers/01_constants.rb b/config/initializers/01_constants.rb index 30584e9d..494f1116 100644 --- a/config/initializers/01_constants.rb +++ b/config/initializers/01_constants.rb @@ -23,6 +23,8 @@ NOMINATIM_API_HOST = ENV.fetch('NOMINATIM_API_HOST', nil) NOMINATIM_API_KEY = ENV.fetch('NOMINATIM_API_KEY', nil) NOMINATIM_API_USE_HTTPS = ENV.fetch('NOMINATIM_API_USE_HTTPS', 'true') == 'true' +LOCATIONIQ_API_KEY = ENV.fetch('LOCATIONIQ_API_KEY', nil) + GEOAPIFY_API_KEY = ENV.fetch('GEOAPIFY_API_KEY', nil) STORE_GEODATA = ENV.fetch('STORE_GEODATA', 'true') == 'true' # /Reverse geocoding settings diff --git a/config/initializers/geocoder.rb b/config/initializers/geocoder.rb index e813b8e4..adbf4c52 100644 --- a/config/initializers/geocoder.rb +++ b/config/initializers/geocoder.rb @@ -23,6 +23,9 @@ elsif NOMINATIM_API_HOST.present? settings[:lookup] = :nominatim settings[:nominatim] = { use_https: NOMINATIM_API_USE_HTTPS, host: NOMINATIM_API_HOST } settings[:api_key] = NOMINATIM_API_KEY if NOMINATIM_API_KEY.present? +elsif LOCATIONIQ_API_KEY.present? + settings[:lookup] = :location_iq + settings[:api_key] = LOCATIONIQ_API_KEY end Geocoder.configure(settings) diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev index eaadf2f5..d3c7f1cd 100644 --- a/docker/Dockerfile.dev +++ b/docker/Dockerfile.dev @@ -9,6 +9,8 @@ ENV RAILS_ENV=development ENV SELF_HOSTED=true ENV SIDEKIQ_USERNAME=sidekiq ENV SIDEKIQ_PASSWORD=password +# Resolving sqlite3 error +ENV PGSSENCMODE=disable RUN apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ wget \ diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index 14f30548..511d5f68 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -1,7 +1,7 @@ # frozen_string_literal: true namespace :import do - # Usage: rake import:big_file['/path/to/file.json','user@email.com'] + # Usage: bundle exec rake import:big_file['/path/to/file.json','user@email.com'] desc 'Accepts a file path and user email and imports the data into the database' task :big_file, %i[file_path user_email] => :environment do |_, args| diff --git a/spec/requests/imports_spec.rb b/spec/requests/imports_spec.rb index 502bcca4..8bb53480 100644 --- a/spec/requests/imports_spec.rb +++ b/spec/requests/imports_spec.rb @@ -177,6 +177,7 @@ RSpec.describe 'Imports', type: :request do it 'updates the import' do patch import_path(import), params: { import: { name: 'New Name' } } + expect(import.reload.name).to eq('New Name') expect(response).to redirect_to(imports_path) end end From b6d21975b8e620ce2ea30a856d0a0598c9290486 Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Thu, 5 Jun 2025 21:12:28 +0200 Subject: [PATCH 4/4] Fix readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b3d125db..694561d9 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ You can track your location with the following apps: - πŸ›°οΈ [OwnTracks](https://dawarich.app/docs/tutorials/track-your-location#owntracks) - πŸ—ΊοΈ [GPSLogger](https://dawarich.app/docs/tutorials/track-your-location#gps-logger) - πŸ“± [PhoneTrack](https://dawarich.app/docs/tutorials/track-your-location#phonetrack) -- 🏑 [Home Assistant](https://dawarich.app/docs/tutorials/track-your-location#homeassistant) +- 🏑 [Home Assistant](https://dawarich.app/docs/tutorials/track-your-location#home-assistant) Simply install one of the supported apps on your device and configure it to send location updates to your Dawarich instance.