diff --git a/.app_version b/.app_version index 26acbf08..aa22d3ce 100644 --- a/.app_version +++ b/.app_version @@ -1 +1 @@ -0.12.2 +0.12.3 diff --git a/CHANGELOG.md b/CHANGELOG.md index a718c86b..1f8d07a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,30 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Default exporting format is now GeoJSON instead of Owntracks-like JSON. This will allow you to use the exported data in other applications that support GeoJSON format. +## [0.12.3] — 2024-09-02 + +### Added + +- Resource limits to docke-compose.yml file to prevent server overload. Feel free to adjust the limits to your needs. + +```yml +deploy: + resources: + limits: + cpus: '0.50' # Limit CPU usage to 50% of one core + memory: '2G' # Limit memory usage to 2GB +``` + +### Fixed + +- Importing geodata from Immich will now not throw an error in the end of the process + +### Changed + +- A notification about an existing import with the same name will now show the import name +- Export file now also will contain `raw_dat` field for each point. This field contains the original data that was imported to the application. + + ## [0.12.2] — 2024-08-28 ### Added diff --git a/Gemfile.lock b/Gemfile.lock index 279e4099..b1e5dda4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -75,8 +75,8 @@ GEM minitest (>= 5.1) mutex_m tzinfo (~> 2.0) - addressable (2.8.6) - public_suffix (>= 2.0.2, < 6.0) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) ast (2.4.2) attr_extras (7.1.0) base64 (0.2.0) @@ -86,7 +86,7 @@ GEM msgpack (~> 1.2) builder (3.3.0) byebug (11.1.3) - chartkick (5.0.7) + chartkick (5.1.0) coderay (1.1.3) concurrent-ruby (1.3.4) connection_pool (2.4.1) @@ -96,7 +96,7 @@ GEM rexml crass (1.0.6) csv (3.3.0) - data_migrate (9.4.0) + data_migrate (9.4.2) activerecord (>= 6.1) railties (>= 6.1) date (3.3.4) @@ -156,7 +156,7 @@ GEM rdoc (>= 4.0.0) reline (>= 0.4.2) json (2.7.2) - json-schema (4.3.0) + json-schema (4.3.1) addressable (>= 2.8) kaminari (1.2.2) activesupport (>= 4.1.0) @@ -238,10 +238,10 @@ GEM pry (>= 0.13.0) psych (5.1.2) stringio - public_suffix (5.0.5) + public_suffix (6.0.1) puma (6.4.2) nio4r (~> 2.0) - pundit (2.3.2) + pundit (2.4.0) activesupport (>= 3.0.0) raabro (1.4.0) racc (1.8.1) @@ -320,14 +320,14 @@ GEM rswag-api (2.14.0) activesupport (>= 5.2, < 8.0) railties (>= 5.2, < 8.0) - rswag-specs (2.13.0) - activesupport (>= 3.1, < 7.2) + rswag-specs (2.14.0) + activesupport (>= 5.2, < 8.0) json-schema (>= 2.2, < 5.0) - railties (>= 3.1, < 7.2) + railties (>= 5.2, < 8.0) rspec-core (>= 2.14) - rswag-ui (2.13.0) - actionpack (>= 3.1, < 7.2) - railties (>= 3.1, < 7.2) + rswag-ui (2.14.0) + actionpack (>= 5.2, < 8.0) + railties (>= 5.2, < 8.0) rubocop (1.64.1) json (~> 2.3) language_server-protocol (>= 3.17.0) @@ -395,7 +395,7 @@ GEM railties (>= 7.0.0) tailwindcss-rails (2.7.3-x86_64-linux) railties (>= 7.0.0) - thor (1.3.1) + thor (1.3.2) timeout (0.4.1) turbo-rails (2.0.6) actionpack (>= 6.0.0) @@ -414,7 +414,7 @@ GEM websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.17) + zeitwerk (2.6.18) PLATFORMS aarch64-linux diff --git a/app/serializers/export_serializer.rb b/app/serializers/export_serializer.rb index a5d94744..15f5f948 100644 --- a/app/serializers/export_serializer.rb +++ b/app/serializers/export_serializer.rb @@ -39,7 +39,8 @@ class ExportSerializer tst: point.timestamp.to_i, inrids: point.inrids, inregions: point.in_regions, - topic: point.topic + topic: point.topic, + raw_data: point.raw_data } end diff --git a/app/services/immich/import_geodata.rb b/app/services/immich/import_geodata.rb index 5aeb92b6..d87f8978 100644 --- a/app/services/immich/import_geodata.rb +++ b/app/services/immich/import_geodata.rb @@ -13,12 +13,12 @@ class Immich::ImportGeodata raise ArgumentError, 'Immich API key is missing' if immich_api_key.blank? raise ArgumentError, 'Immich URL is missing' if user.settings['immich_url'].blank? - immich_data = retrieve_immich_data + immich_data = retrieve_immich_data immich_data_json = parse_immich_data(immich_data) file_name = file_name(immich_data_json) import = user.imports.find_or_initialize_by(name: file_name, source: :immich_api) - create_import_failed_notification and return unless import.new_record? + create_import_failed_notification(import.name) and return unless import.new_record? import.raw_data = immich_data_json import.save! @@ -84,12 +84,12 @@ class Immich::ImportGeodata Rails.logger.debug 'No data found' end - def create_import_failed_notification + def create_import_failed_notification(import_name) Notifications::Create.new( user:, kind: :info, title: 'Import was not created', - content: 'Import with the same name already exists. If you want to proceed, delete the existing import and try again.' + content: "Import with the same name (#{import_name}) already exists. If you want to proceed, delete the existing import and try again." ).call end diff --git a/app/services/immich/import_parser.rb b/app/services/immich/import_parser.rb index 8037d7a4..2ef62cb9 100644 --- a/app/services/immich/import_parser.rb +++ b/app/services/immich/import_parser.rb @@ -11,6 +11,8 @@ class Immich::ImportParser def call json.each { |point| create_point(point) } + + { raw_points: 0, points: 0, doubles: 0, processed: 0 } end def create_point(point) diff --git a/docker-compose.yml b/docker-compose.yml index 895c0c9f..469549c2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -57,6 +57,11 @@ services: depends_on: - dawarich_db - dawarich_redis + deploy: + resources: + limits: + cpus: '0.50' # Limit CPU usage to 50% of one core + memory: '2G' # Limit memory usage to 2GB dawarich_sidekiq: image: freikin/dawarich:latest container_name: dawarich_sidekiq @@ -90,6 +95,11 @@ services: - dawarich_db - dawarich_redis - dawarich_app + deploy: + resources: + limits: + cpus: '0.50' # Limit CPU usage to 50% of one core + memory: '2G' # Limit memory usage to 2GB volumes: db_data: diff --git a/spec/serializers/export_serializer_spec.rb b/spec/serializers/export_serializer_spec.rb index 17efbfb3..e77acff5 100644 --- a/spec/serializers/export_serializer_spec.rb +++ b/spec/serializers/export_serializer_spec.rb @@ -30,7 +30,8 @@ RSpec.describe ExportSerializer do tst: points.first.timestamp.to_i, inrids: points.first.inrids, inregions: points.first.in_regions, - topic: points.first.topic + topic: points.first.topic, + raw_data: points.first.raw_data }, { lat: points.second.latitude, @@ -50,7 +51,8 @@ RSpec.describe ExportSerializer do tst: points.second.timestamp.to_i, inrids: points.second.inrids, inregions: points.second.in_regions, - topic: points.second.topic + topic: points.second.topic, + raw_data: points.second.raw_data } ] }