Skip to content

Commit c6ba487

Browse files
authored
Merge pull request #1290 from Freika/dev
0.27.0
2 parents 9f14835 + 0604270 commit c6ba487

37 files changed

+652
-85
lines changed

.app_version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.26.7
1+
0.27.0

.github/workflows/build_and_push.yml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,46 @@ jobs:
5151
- name: Set Docker tags
5252
id: docker_meta
5353
run: |
54-
VERSION=${GITHUB_REF#refs/tags/}
54+
# Debug output
55+
echo "GITHUB_REF: $GITHUB_REF"
56+
echo "GITHUB_REF_NAME: $GITHUB_REF_NAME"
57+
58+
# Extract version from GITHUB_REF or use GITHUB_REF_NAME
59+
if [[ $GITHUB_REF == refs/tags/* ]]; then
60+
VERSION=${GITHUB_REF#refs/tags/}
61+
else
62+
VERSION=$GITHUB_REF_NAME
63+
fi
64+
65+
# Additional safety check - if VERSION is empty, use a default
66+
if [ -z "$VERSION" ]; then
67+
VERSION="rc"
68+
fi
69+
70+
echo "Using VERSION: $VERSION"
71+
5572
TAGS="freikin/dawarich:${VERSION}"
5673
74+
# Set platforms based on release type
75+
PLATFORMS="linux/amd64,linux/arm64,linux/arm/v8,linux/arm/v7,linux/arm/v6"
76+
5777
# Add :rc tag for pre-releases
5878
if [ "${{ github.event.release.prerelease }}" = "true" ]; then
5979
TAGS="${TAGS},freikin/dawarich:rc"
80+
# For RC builds, only use amd64
81+
PLATFORMS="linux/amd64"
6082
fi
6183
6284
# Add :latest tag only if release is not a pre-release
6385
if [ "${{ github.event.release.prerelease }}" != "true" ]; then
6486
TAGS="${TAGS},freikin/dawarich:latest"
6587
fi
6688
89+
echo "Final TAGS: $TAGS"
90+
echo "PLATFORMS: $PLATFORMS"
91+
6792
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
93+
echo "platforms=${PLATFORMS}" >> $GITHUB_OUTPUT
6894
6995
- name: Build and push
7096
uses: docker/build-push-action@v5
@@ -74,6 +100,6 @@ jobs:
74100
push: true
75101
tags: ${{ steps.docker_meta.outputs.tags }}
76102
labels: ${{ steps.meta.outputs.labels }}
77-
platforms: linux/amd64,linux/arm64,linux/arm/v8,linux/arm/v7,linux/arm/v6
103+
platforms: ${{ steps.docker_meta.outputs.platforms }}
78104
cache-from: type=local,src=/tmp/.buildx-cache
79105
cache-to: type=local,dest=/tmp/.buildx-cache

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,7 @@
7272
/config/credentials/staging.yml.enc
7373

7474
Makefile
75+
76+
/db/*.sqlite3
77+
/db/*.sqlite3-shm
78+
/db/*.sqlite3-wal

CHANGELOG.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,54 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
# 0.27.0 - 2025-05-31
78

8-
# 0.26.7 - 2025-05-26
9+
⚠️ This release includes a breaking change. ⚠️
10+
11+
Starting 0.27.0, Dawarich is using SolidQueue and SolidCache to run background jobs and cache data. Before updating, make sure your Sidekiq queues (https://your_dawarich_app/sidekiq) are empty.
12+
13+
Moving to SolidQueue and SolidCache will require creating new SQLite databases, which will be created automatically when you start the app. They will be stored in the `dawarich_db_data` volume.
14+
15+
Background jobs interface is now available at `/jobs` page.
16+
17+
Please, update your `docker-compose.yml` and add the following:
18+
19+
```diff
20+
dawarich_app:
21+
image: freikin/dawarich:latest
22+
container_name: dawarich_app
23+
volumes:
24+
- dawarich_public:/var/app/public
25+
- dawarich_watched:/var/app/tmp/imports/watched
26+
- dawarich_storage:/var/app/storage
27+
+ - dawarich_db_data:/dawarich_db_data
28+
...
29+
environment:
30+
...
31+
DATABASE_NAME: dawarich_development
32+
# SQLite database paths for secondary databases
33+
+ QUEUE_DATABASE_PATH: /dawarich_db_data/dawarich_development_queue.sqlite3
34+
+ CACHE_DATABASE_PATH: /dawarich_db_data/dawarich_development_cache.sqlite3
35+
+ CABLE_DATABASE_PATH: /dawarich_db_data/dawarich_development_cable.sqlite3
36+
```
37+
38+
39+
## Fixed
40+
41+
- Enable caching in development for the docker image to improve performance.
42+
43+
## Changed
44+
45+
- SolidCache is now being used for caching instead of Redis.
46+
- SolidQueue is now being used for background jobs instead of Sidekiq.
47+
- SolidCable is now being used as ActionCable adapter.
48+
- Background jobs are now being run as Puma plugin instead of separate Docker container.
49+
- The `rc` docker image is now being built for amd64 architecture only to speed up the build process.
50+
- Deleting an import with many points now works significantly faster.
51+
52+
53+
54+
# 0.26.7 - 2025-05-29
955

1056
## Fixed
1157

Gemfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ gem 'httparty'
2020
gem 'importmap-rails'
2121
gem 'kaminari'
2222
gem 'lograge'
23+
gem 'mission_control-jobs'
2324
gem 'oj'
2425
gem 'pg'
2526
gem 'prometheus_exporter'
@@ -35,13 +36,17 @@ gem 'rswag-api'
3536
gem 'rswag-ui'
3637
gem 'sentry-ruby'
3738
gem 'sentry-rails'
39+
gem 'sqlite3', '~> 2.6'
3840
gem 'stackprof'
3941
gem 'sidekiq'
4042
gem 'sidekiq-cron'
4143
gem 'sidekiq-limit_fetch'
4244
gem 'sprockets-rails'
4345
gem 'stimulus-rails'
4446
gem 'strong_migrations'
47+
gem 'solid_cable', '~> 3.0'
48+
gem 'solid_cache', '1.0.7'
49+
gem 'solid_queue', '~> 1.1'
4550
gem 'tailwindcss-rails'
4651
gem 'turbo-rails'
4752
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]

Gemfile.lock

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,17 @@ GEM
232232
mini_mime (1.1.5)
233233
mini_portile2 (2.8.9)
234234
minitest (5.25.5)
235-
msgpack (1.8.0)
235+
mission_control-jobs (1.0.2)
236+
actioncable (>= 7.1)
237+
actionpack (>= 7.1)
238+
activejob (>= 7.1)
239+
activerecord (>= 7.1)
240+
importmap-rails (>= 1.2.1)
241+
irb (~> 1.13)
242+
railties (>= 7.1)
243+
stimulus-rails
244+
turbo-rails
245+
msgpack (1.7.3)
236246
multi_json (1.15.0)
237247
multi_xml (0.7.1)
238248
bigdecimal (~> 3.1)
@@ -442,13 +452,35 @@ GEM
442452
simplecov_json_formatter (~> 0.1)
443453
simplecov-html (0.13.1)
444454
simplecov_json_formatter (0.1.4)
455+
solid_cable (3.0.8)
456+
actioncable (>= 7.2)
457+
activejob (>= 7.2)
458+
activerecord (>= 7.2)
459+
railties (>= 7.2)
460+
solid_cache (1.0.7)
461+
activejob (>= 7.2)
462+
activerecord (>= 7.2)
463+
railties (>= 7.2)
464+
solid_queue (1.1.5)
465+
activejob (>= 7.1)
466+
activerecord (>= 7.1)
467+
concurrent-ruby (>= 1.3.1)
468+
fugit (~> 1.11.0)
469+
railties (>= 7.1)
470+
thor (~> 1.3.1)
445471
sprockets (4.2.1)
446472
concurrent-ruby (~> 1.0)
447473
rack (>= 2.2.4, < 4)
448474
sprockets-rails (3.5.2)
449475
actionpack (>= 6.1)
450476
activesupport (>= 6.1)
451477
sprockets (>= 3.0.0)
478+
sqlite3 (2.6.0-aarch64-linux-gnu)
479+
sqlite3 (2.6.0-arm-linux-gnu)
480+
sqlite3 (2.6.0-arm64-darwin)
481+
sqlite3 (2.6.0-x86-linux-gnu)
482+
sqlite3 (2.6.0-x86_64-darwin)
483+
sqlite3 (2.6.0-x86_64-linux-gnu)
452484
stackprof (0.2.27)
453485
stimulus-rails (1.3.4)
454486
railties (>= 6.0.0)
@@ -532,6 +564,7 @@ DEPENDENCIES
532564
jwt
533565
kaminari
534566
lograge
567+
mission_control-jobs
535568
oj
536569
pg
537570
prometheus_exporter
@@ -558,7 +591,11 @@ DEPENDENCIES
558591
sidekiq-cron
559592
sidekiq-limit_fetch
560593
simplecov
594+
solid_cable (~> 3.0)
595+
solid_cache (= 1.0.7)
596+
solid_queue (~> 1.1)
561597
sprockets-rails
598+
sqlite3 (~> 2.6)
562599
stackprof
563600
stimulus-rails
564601
strong_migrations

Procfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
web: bundle exec puma -C config/puma.rb
2-
worker: bundle exec sidekiq -C config/sidekiq.yml
2+
worker: bundle exec bin/jobs

app/jobs/application_job.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
# frozen_string_literal: true
2+
13
class ApplicationJob < ActiveJob::Base
24
# Automatically retry jobs that encountered a deadlock
35
# retry_on ActiveRecord::Deadlocked
46

7+
retry_on Exception, wait: :polynomially_longer, attempts: 25
8+
59
# Most jobs are safe to ignore if the underlying records are no longer available
610
# discard_on ActiveJob::DeserializationError
711
end

app/jobs/jobs/clean_finished_job.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# frozen_string_literal: true
2+
3+
class Jobs::CleanFinishedJob < ApplicationJob
4+
queue_as :default
5+
6+
def perform
7+
SolidQueue::Job.clear_finished_in_batches
8+
end
9+
end

app/services/imports/destroy.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ def initialize(user, import)
99
end
1010

1111
def call
12-
@import.destroy!
12+
ActiveRecord::Base.transaction do
13+
@import.points.delete_all
14+
@import.destroy!
15+
end
1316

1417
Stats::BulkCalculator.new(@user.id).call
1518
end

app/services/jobs/create.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def call
2121
raise InvalidJobName, 'Invalid job name'
2222
end
2323

24+
# TODO: bulk enqueue reverse geocoding with ActiveJob
2425
points.find_each(&:async_reverse_geocode)
2526
end
2627
end

bin/jobs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env ruby
2+
3+
require_relative "../config/environment"
4+
require "solid_queue/cli"
5+
6+
SolidQueue::Cli.start(ARGV)

config/cable.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
1+
# Async adapter only works within the same process, so for manually triggering cable updates from a console,
2+
# and seeing results in the browser, you must do so from the web console (running inside the dev process),
3+
# not a terminal started via bin/rails console! Add "console" to any action or any ERB template view
4+
# to make the web console appear.
5+
6+
default: &default
7+
adapter: solid_cable
8+
connects_to:
9+
database:
10+
writing: cable
11+
polling_interval: 0.1.seconds
12+
message_retention: 1.day
13+
114
development:
2-
adapter: redis
3-
url: <%= ENV['REDIS_URL'] %>
15+
<<: *default
416

517
test:
618
adapter: test
719

820
production:
9-
adapter: redis
10-
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
11-
channel_prefix: dawarich_production
21+
<<: *default

config/cache.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
default: &default
2+
store_options:
3+
# Cap age of oldest cache entry to fulfill retention policies
4+
max_age: <%= 60.days.to_i %>
5+
max_size: <%= 256.megabytes %>
6+
namespace: <%= Rails.env %>
7+
8+
development:
9+
<<: *default
10+
11+
test:
12+
<<: *default
13+
14+
production:
15+
<<: *default

config/database.yml

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,64 @@ default: &default
99
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 10 } %>
1010
timeout: 5000
1111

12+
sqlite_default: &sqlite_default
13+
adapter: sqlite3
14+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 10 } %>
15+
timeout: 5000
16+
1217
development:
13-
<<: *default
14-
database: <%= ENV['DATABASE_NAME'] || 'dawarich_development' %>
18+
primary:
19+
<<: *default
20+
database: <%= ENV['DATABASE_NAME'] || 'dawarich_development' %>
21+
queue:
22+
<<: *sqlite_default
23+
database: <%= ENV['QUEUE_DATABASE_PATH'] || 'db/queue.sqlite3' %>
24+
migrations_paths: db/queue_migrate
25+
cache:
26+
<<: *sqlite_default
27+
database: <%= ENV['CACHE_DATABASE_PATH'] || 'db/cache.sqlite3' %>
28+
migrations_paths: db/cache_migrate
29+
cable:
30+
<<: *sqlite_default
31+
database: <%= ENV['CABLE_DATABASE_PATH'] || 'db/cable.sqlite3' %>
32+
migrations_paths: db/cable_migrate
1533

1634
test:
17-
<<: *default
18-
database: <%= ENV['DATABASE_NAME'] || 'dawarich_test' %>
35+
primary:
36+
<<: *default
37+
database: <%= ENV['DATABASE_NAME'] || 'dawarich_test' %>
1938

2039
production:
21-
<<: *default
22-
database: <%= ENV['DATABASE_NAME'] || 'dawarich_production' %>
40+
primary:
41+
<<: *default
42+
database: <%= ENV['DATABASE_NAME'] || 'dawarich_production' %>
43+
queue:
44+
<<: *sqlite_default
45+
database: <%= ENV['QUEUE_DATABASE_PATH'] || 'db/queue.sqlite3' %>
46+
migrations_paths: db/queue_migrate
47+
cable:
48+
<<: *sqlite_default
49+
database: <%= ENV['CABLE_DATABASE_PATH'] || 'db/cable.sqlite3' %>
50+
migrations_paths: db/cable_migrate
51+
cache:
52+
<<: *sqlite_default
53+
database: <%= ENV['CACHE_DATABASE_PATH'] %>
54+
migrations_paths: db/cache_migrate
2355

2456
staging:
25-
<<: *default
26-
database: <%= ENV['DATABASE_NAME'] || 'dawarich_staging' %>
57+
primary:
58+
<<: *default
59+
database: <%= ENV['DATABASE_NAME'] || 'dawarich_staging' %>
60+
password: <%= ENV['DATABASE_PASSWORD'] %>
61+
cache:
62+
<<: *sqlite_default
63+
database: <%= ENV['CACHE_DATABASE_PATH'] || 'db/cache.sqlite3' %>
64+
migrations_paths: db/cache_migrate
65+
queue:
66+
<<: *sqlite_default
67+
database: <%= ENV['QUEUE_DATABASE_PATH'] || 'db/queue.sqlite3' %>
68+
migrations_paths: db/queue_migrate
69+
cable:
70+
<<: *sqlite_default
71+
database: <%= ENV['CABLE_DATABASE_PATH'] || 'db/cable.sqlite3' %>
72+
migrations_paths: db/cable_migrate

0 commit comments

Comments
 (0)