mirror of
https://github.com/Freika/dawarich.git
synced 2025-12-30 09:49:40 -06:00
Switch SolidQueue to PostgreSQL
This commit is contained in:
@@ -1 +1 @@
|
||||
0.27.3
|
||||
0.27.4
|
||||
|
||||
24
CHANGELOG.md
24
CHANGELOG.md
@@ -4,6 +4,30 @@ 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.4 - 2025-06-06
|
||||
|
||||
## Changed
|
||||
|
||||
- SolidQueue is now using PostgreSQL instead of SQLite. Provide `QUEUE_DATABASE_NAME` and `QUEUE_DATABASE_PASSWORD` environment variables to configure it.
|
||||
|
||||
```diff
|
||||
...
|
||||
dawarich_app:
|
||||
image: freikin/dawarich:latest
|
||||
...
|
||||
restart: on-failure
|
||||
environment:
|
||||
...
|
||||
DATABASE_NAME: dawarich_development
|
||||
+ # PostgreSQL database name for solid_queue
|
||||
+ QUEUE_DATABASE_NAME: dawarich_development_queue
|
||||
+ QUEUE_DATABASE_PASSWORD: password
|
||||
# SQLite database paths for cache and cable databases
|
||||
- QUEUE_DATABASE_PATH: /dawarich_db_data/dawarich_development_queue.sqlite3
|
||||
CACHE_DATABASE_PATH: /dawarich_db_data/dawarich_development_cache.sqlite3
|
||||
...
|
||||
```
|
||||
|
||||
# 0.27.3 - 2025-06-05
|
||||
|
||||
## Changed
|
||||
|
||||
@@ -12,16 +12,16 @@ default: &default
|
||||
sqlite_default: &sqlite_default
|
||||
adapter: sqlite3
|
||||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 10 } %>
|
||||
retries: 100
|
||||
default_transaction_mode: IMMEDIATE
|
||||
timeout: 5000
|
||||
|
||||
development:
|
||||
primary:
|
||||
<<: *default
|
||||
database: <%= ENV['DATABASE_NAME'] || 'dawarich_development' %>
|
||||
queue:
|
||||
<<: *sqlite_default
|
||||
database: <%= ENV['QUEUE_DATABASE_PATH'] || 'db/queue.sqlite3' %>
|
||||
<<: *default
|
||||
database: <%= ENV['QUEUE_DATABASE_NAME'] || 'dawarich_development_queue' %>
|
||||
password: <%= ENV['QUEUE_DATABASE_PASSWORD'] %>
|
||||
migrations_paths: db/queue_migrate
|
||||
cache:
|
||||
<<: *sqlite_default
|
||||
@@ -36,14 +36,21 @@ test:
|
||||
primary:
|
||||
<<: *default
|
||||
database: <%= ENV['DATABASE_NAME'] || 'dawarich_test' %>
|
||||
password: <%= ENV['DATABASE_PASSWORD'] %>
|
||||
queue:
|
||||
<<: *default
|
||||
database: <%= ENV['QUEUE_DATABASE_NAME'] || 'dawarich_test_queue' %>
|
||||
password: <%= ENV['QUEUE_DATABASE_PASSWORD'] %>
|
||||
migrations_paths: db/queue_migrate
|
||||
|
||||
production:
|
||||
primary:
|
||||
<<: *default
|
||||
database: <%= ENV['DATABASE_NAME'] || 'dawarich_production' %>
|
||||
queue:
|
||||
<<: *sqlite_default
|
||||
database: <%= ENV['QUEUE_DATABASE_PATH'] || 'db/queue.sqlite3' %>
|
||||
<<: *default
|
||||
database: <%= ENV['QUEUE_DATABASE_NAME'] || 'dawarich_production_queue' %>
|
||||
password: <%= ENV['QUEUE_DATABASE_PASSWORD'] %>
|
||||
migrations_paths: db/queue_migrate
|
||||
cable:
|
||||
<<: *sqlite_default
|
||||
@@ -59,14 +66,15 @@ staging:
|
||||
<<: *default
|
||||
database: <%= ENV['DATABASE_NAME'] || 'dawarich_staging' %>
|
||||
password: <%= ENV['DATABASE_PASSWORD'] %>
|
||||
queue:
|
||||
<<: *default
|
||||
database: <%= ENV['QUEUE_DATABASE_NAME'] || 'dawarich_staging_queue' %>
|
||||
password: <%= ENV['QUEUE_DATABASE_PASSWORD'] %>
|
||||
migrations_paths: db/queue_migrate
|
||||
cache:
|
||||
<<: *sqlite_default
|
||||
database: <%= ENV['CACHE_DATABASE_PATH'] || 'db/cache.sqlite3' %>
|
||||
migrations_paths: db/cache_migrate
|
||||
queue:
|
||||
<<: *sqlite_default
|
||||
database: <%= ENV['QUEUE_DATABASE_PATH'] || 'db/queue.sqlite3' %>
|
||||
migrations_paths: db/queue_migrate
|
||||
cable:
|
||||
<<: *sqlite_default
|
||||
database: <%= ENV['CABLE_DATABASE_PATH'] || 'db/cable.sqlite3' %>
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.0].define(version: 1) do
|
||||
enable_extension "pg_catalog.plpgsql"
|
||||
|
||||
create_table "solid_queue_blocked_executions", force: :cascade do |t|
|
||||
t.bigint "job_id", null: false
|
||||
t.string "queue_name", null: false
|
||||
|
||||
@@ -47,8 +47,10 @@ services:
|
||||
DATABASE_USERNAME: postgres
|
||||
DATABASE_PASSWORD: password
|
||||
DATABASE_NAME: dawarich_development
|
||||
# SQLite database paths for secondary databases
|
||||
QUEUE_DATABASE_PATH: /dawarich_db_data/dawarich_development_queue.sqlite3
|
||||
# PostgreSQL database name for solid_queue
|
||||
QUEUE_DATABASE_NAME: dawarich_development_queue
|
||||
QUEUE_DATABASE_PASSWORD: password
|
||||
# SQLite database paths for cache and cable databases
|
||||
CACHE_DATABASE_PATH: /dawarich_db_data/dawarich_development_cache.sqlite3
|
||||
CABLE_DATABASE_PATH: /dawarich_db_data/dawarich_development_cable.sqlite3
|
||||
MIN_MINUTES_SPENT_IN_CITY: 60
|
||||
|
||||
@@ -31,6 +31,11 @@ export DATABASE_USERNAME
|
||||
export DATABASE_PASSWORD
|
||||
export DATABASE_NAME
|
||||
|
||||
# Set queue database name
|
||||
QUEUE_DATABASE_NAME=${QUEUE_DATABASE_NAME:-"${DATABASE_NAME}_queue"}
|
||||
export QUEUE_DATABASE_NAME
|
||||
export QUEUE_DATABASE_PASSWORD
|
||||
|
||||
# Remove pre-existing puma/passenger server.pid
|
||||
rm -f $APP_PATH/tmp/pids/server.pid
|
||||
|
||||
@@ -51,7 +56,7 @@ create_database() {
|
||||
echo "✅ PostgreSQL database $db_name is ready!"
|
||||
}
|
||||
|
||||
# Set up SQLite database directory in the volume
|
||||
# Set up SQLite database directory in the volume for cache and cable
|
||||
SQLITE_DB_DIR="/dawarich_db_data"
|
||||
mkdir -p $SQLITE_DB_DIR
|
||||
echo "Created SQLite database directory at $SQLITE_DB_DIR"
|
||||
@@ -62,12 +67,10 @@ echo "Setting up all required databases..."
|
||||
# Create primary PostgreSQL database
|
||||
create_database "$DATABASE_NAME" "$DATABASE_PASSWORD"
|
||||
|
||||
# Setup SQLite databases based on environment
|
||||
# Create PostgreSQL queue database for solid_queue
|
||||
create_database "$QUEUE_DATABASE_NAME" "$QUEUE_DATABASE_PASSWORD"
|
||||
|
||||
# Setup Queue database with SQLite
|
||||
QUEUE_DATABASE_PATH=${QUEUE_DATABASE_PATH:-"$SQLITE_DB_DIR/${DATABASE_NAME}_queue.sqlite3"}
|
||||
export QUEUE_DATABASE_PATH
|
||||
echo "✅ SQLite queue database configured at $QUEUE_DATABASE_PATH"
|
||||
# Setup SQLite databases for cache and cable
|
||||
|
||||
# Setup Cache database with SQLite
|
||||
CACHE_DATABASE_PATH=${CACHE_DATABASE_PATH:-"$SQLITE_DB_DIR/${DATABASE_NAME}_cache.sqlite3"}
|
||||
@@ -84,17 +87,18 @@ fi
|
||||
# Step 2: Run migrations for all databases
|
||||
echo "Running migrations for all databases..."
|
||||
|
||||
# Run primary database migrations first (needed before SQLite migrations)
|
||||
# Run primary database migrations first (needed before other migrations)
|
||||
echo "Running primary database migrations..."
|
||||
bundle exec rails db:migrate
|
||||
|
||||
# Run PostgreSQL queue database migrations
|
||||
echo "Running queue database migrations..."
|
||||
bundle exec rails db:migrate:queue
|
||||
|
||||
# Run SQLite database migrations
|
||||
echo "Running cache database migrations..."
|
||||
bundle exec rails db:migrate:cache
|
||||
|
||||
echo "Running queue database migrations..."
|
||||
bundle exec rails db:migrate:queue
|
||||
|
||||
# Run cable migrations for production/staging
|
||||
if [ "$RAILS_ENV" = "production" ] || [ "$RAILS_ENV" = "staging" ]; then
|
||||
echo "Running cable database migrations..."
|
||||
|
||||
Reference in New Issue
Block a user