mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
Switch SolidQueue to PostgreSQL
This commit is contained in:
parent
b6d21975b8
commit
f85eef199f
6 changed files with 63 additions and 23 deletions
|
|
@ -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/)
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
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
|
# 0.27.3 - 2025-06-05
|
||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
|
|
|
||||||
|
|
@ -12,16 +12,16 @@ default: &default
|
||||||
sqlite_default: &sqlite_default
|
sqlite_default: &sqlite_default
|
||||||
adapter: sqlite3
|
adapter: sqlite3
|
||||||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 10 } %>
|
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 10 } %>
|
||||||
retries: 100
|
timeout: 5000
|
||||||
default_transaction_mode: IMMEDIATE
|
|
||||||
|
|
||||||
development:
|
development:
|
||||||
primary:
|
primary:
|
||||||
<<: *default
|
<<: *default
|
||||||
database: <%= ENV['DATABASE_NAME'] || 'dawarich_development' %>
|
database: <%= ENV['DATABASE_NAME'] || 'dawarich_development' %>
|
||||||
queue:
|
queue:
|
||||||
<<: *sqlite_default
|
<<: *default
|
||||||
database: <%= ENV['QUEUE_DATABASE_PATH'] || 'db/queue.sqlite3' %>
|
database: <%= ENV['QUEUE_DATABASE_NAME'] || 'dawarich_development_queue' %>
|
||||||
|
password: <%= ENV['QUEUE_DATABASE_PASSWORD'] %>
|
||||||
migrations_paths: db/queue_migrate
|
migrations_paths: db/queue_migrate
|
||||||
cache:
|
cache:
|
||||||
<<: *sqlite_default
|
<<: *sqlite_default
|
||||||
|
|
@ -36,14 +36,21 @@ test:
|
||||||
primary:
|
primary:
|
||||||
<<: *default
|
<<: *default
|
||||||
database: <%= ENV['DATABASE_NAME'] || 'dawarich_test' %>
|
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:
|
production:
|
||||||
primary:
|
primary:
|
||||||
<<: *default
|
<<: *default
|
||||||
database: <%= ENV['DATABASE_NAME'] || 'dawarich_production' %>
|
database: <%= ENV['DATABASE_NAME'] || 'dawarich_production' %>
|
||||||
queue:
|
queue:
|
||||||
<<: *sqlite_default
|
<<: *default
|
||||||
database: <%= ENV['QUEUE_DATABASE_PATH'] || 'db/queue.sqlite3' %>
|
database: <%= ENV['QUEUE_DATABASE_NAME'] || 'dawarich_production_queue' %>
|
||||||
|
password: <%= ENV['QUEUE_DATABASE_PASSWORD'] %>
|
||||||
migrations_paths: db/queue_migrate
|
migrations_paths: db/queue_migrate
|
||||||
cable:
|
cable:
|
||||||
<<: *sqlite_default
|
<<: *sqlite_default
|
||||||
|
|
@ -59,14 +66,15 @@ staging:
|
||||||
<<: *default
|
<<: *default
|
||||||
database: <%= ENV['DATABASE_NAME'] || 'dawarich_staging' %>
|
database: <%= ENV['DATABASE_NAME'] || 'dawarich_staging' %>
|
||||||
password: <%= ENV['DATABASE_PASSWORD'] %>
|
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:
|
cache:
|
||||||
<<: *sqlite_default
|
<<: *sqlite_default
|
||||||
database: <%= ENV['CACHE_DATABASE_PATH'] || 'db/cache.sqlite3' %>
|
database: <%= ENV['CACHE_DATABASE_PATH'] || 'db/cache.sqlite3' %>
|
||||||
migrations_paths: db/cache_migrate
|
migrations_paths: db/cache_migrate
|
||||||
queue:
|
|
||||||
<<: *sqlite_default
|
|
||||||
database: <%= ENV['QUEUE_DATABASE_PATH'] || 'db/queue.sqlite3' %>
|
|
||||||
migrations_paths: db/queue_migrate
|
|
||||||
cable:
|
cable:
|
||||||
<<: *sqlite_default
|
<<: *sqlite_default
|
||||||
database: <%= ENV['CABLE_DATABASE_PATH'] || 'db/cable.sqlite3' %>
|
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.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[8.0].define(version: 1) do
|
ActiveRecord::Schema[8.0].define(version: 1) do
|
||||||
|
enable_extension "pg_catalog.plpgsql"
|
||||||
|
|
||||||
create_table "solid_queue_blocked_executions", force: :cascade do |t|
|
create_table "solid_queue_blocked_executions", force: :cascade do |t|
|
||||||
t.bigint "job_id", null: false
|
t.bigint "job_id", null: false
|
||||||
t.string "queue_name", null: false
|
t.string "queue_name", null: false
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,10 @@ services:
|
||||||
DATABASE_USERNAME: postgres
|
DATABASE_USERNAME: postgres
|
||||||
DATABASE_PASSWORD: password
|
DATABASE_PASSWORD: password
|
||||||
DATABASE_NAME: dawarich_development
|
DATABASE_NAME: dawarich_development
|
||||||
# SQLite database paths for secondary databases
|
# PostgreSQL database name for solid_queue
|
||||||
QUEUE_DATABASE_PATH: /dawarich_db_data/dawarich_development_queue.sqlite3
|
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
|
CACHE_DATABASE_PATH: /dawarich_db_data/dawarich_development_cache.sqlite3
|
||||||
CABLE_DATABASE_PATH: /dawarich_db_data/dawarich_development_cable.sqlite3
|
CABLE_DATABASE_PATH: /dawarich_db_data/dawarich_development_cable.sqlite3
|
||||||
MIN_MINUTES_SPENT_IN_CITY: 60
|
MIN_MINUTES_SPENT_IN_CITY: 60
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,11 @@ export DATABASE_USERNAME
|
||||||
export DATABASE_PASSWORD
|
export DATABASE_PASSWORD
|
||||||
export DATABASE_NAME
|
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
|
# Remove pre-existing puma/passenger server.pid
|
||||||
rm -f $APP_PATH/tmp/pids/server.pid
|
rm -f $APP_PATH/tmp/pids/server.pid
|
||||||
|
|
||||||
|
|
@ -51,7 +56,7 @@ create_database() {
|
||||||
echo "✅ PostgreSQL database $db_name is ready!"
|
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"
|
SQLITE_DB_DIR="/dawarich_db_data"
|
||||||
mkdir -p $SQLITE_DB_DIR
|
mkdir -p $SQLITE_DB_DIR
|
||||||
echo "Created SQLite database directory at $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 primary PostgreSQL database
|
||||||
create_database "$DATABASE_NAME" "$DATABASE_PASSWORD"
|
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
|
# Setup SQLite databases for cache and cable
|
||||||
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 Cache database with SQLite
|
# Setup Cache database with SQLite
|
||||||
CACHE_DATABASE_PATH=${CACHE_DATABASE_PATH:-"$SQLITE_DB_DIR/${DATABASE_NAME}_cache.sqlite3"}
|
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
|
# Step 2: Run migrations for all databases
|
||||||
echo "Running 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..."
|
echo "Running primary database migrations..."
|
||||||
bundle exec rails db:migrate
|
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
|
# Run SQLite database migrations
|
||||||
echo "Running cache database migrations..."
|
echo "Running cache database migrations..."
|
||||||
bundle exec rails db:migrate:cache
|
bundle exec rails db:migrate:cache
|
||||||
|
|
||||||
echo "Running queue database migrations..."
|
|
||||||
bundle exec rails db:migrate:queue
|
|
||||||
|
|
||||||
# Run cable migrations for production/staging
|
# Run cable migrations for production/staging
|
||||||
if [ "$RAILS_ENV" = "production" ] || [ "$RAILS_ENV" = "staging" ]; then
|
if [ "$RAILS_ENV" = "production" ] || [ "$RAILS_ENV" = "staging" ]; then
|
||||||
echo "Running cable database migrations..."
|
echo "Running cable database migrations..."
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue