From 584d08da7b78f586961fce1937b1857437abcc3f Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Sat, 31 May 2025 14:13:51 +0200 Subject: [PATCH] Update app version and CHANGELOG.md --- .app_version | 2 +- CHANGELOG.md | 24 +++++++++++++++++++- docker/web-entrypoint.sh | 47 ++++++++++++++++++++++++++++++++-------- 3 files changed, 62 insertions(+), 11 deletions(-) diff --git a/.app_version b/.app_version index f23e1f8a..1b58cc10 100644 --- a/.app_version +++ b/.app_version @@ -1 +1 @@ -0.26.8 +0.27.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bf98561..b8701cd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,34 @@ 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.26.8 - 2025-05-30 +# 0.27.0 - 2025-05-31 + +⚠️ This release includes a breaking change. ⚠️ + +This release introduces a new way to run background jobs and cache data. Before updating, make sure your Sidekiq queues (https://your_dawarich_app/sidekiq) are empty. + +Moving to SolidQueue and SolidCache will require creating new databases, which will be created automatically when you start the app. If that didn't happen, you can create them manually and set the following environment variables: + +- `QUEUE_DATABASE_NAME` - name of the queue database +- `QUEUE_DATABASE_PASSWORD` - password for the queue database +- `CACHE_DATABASE_NAME` - name of the cache database +- `CACHE_DATABASE_PASSWORD` - password for the cache database +- `CABLE_DATABASE_NAME` - name of the cable database +- `CABLE_DATABASE_PASSWORD` - password for the cable database + ## Fixed - Enable caching in development for the docker image to improve performance. +## Changed + +- SolidCache is now being used for caching instead of Redis. +- SolidQueue is now being used for background jobs instead of Sidekiq. +- SolidCable is now being used as ActionCable adapter. +- Background jobs are now being run as Puma plugin instead of separate Docker container. + + # 0.26.7 - 2025-05-29 diff --git a/docker/web-entrypoint.sh b/docker/web-entrypoint.sh index a4c275b7..48b3165b 100644 --- a/docker/web-entrypoint.sh +++ b/docker/web-entrypoint.sh @@ -27,16 +27,45 @@ fi # Remove pre-existing puma/passenger server.pid rm -f $APP_PATH/tmp/pids/server.pid -echo "Attempting to create database $DATABASE_NAME if it doesn't exist..." -PGPASSWORD=$DATABASE_PASSWORD createdb -h "$DATABASE_HOST" -p "$DATABASE_PORT" -U "$DATABASE_USERNAME" "$DATABASE_NAME" 2>/dev/null || echo "Note: Database may already exist or couldn't be created now" +# Function to check and create a database +create_database() { + local db_name=$1 + local db_password=$2 -# Wait for the database to become available -echo "⏳ Waiting for database to be ready..." -until PGPASSWORD=$DATABASE_PASSWORD psql -h "$DATABASE_HOST" -p "$DATABASE_PORT" -U "$DATABASE_USERNAME" -d "$DATABASE_NAME" -c '\q' 2>/dev/null; do - >&2 echo "Postgres is unavailable - retrying..." - sleep 2 -done -echo "✅ PostgreSQL is ready!" + echo "Attempting to create database $db_name if it doesn't exist..." + PGPASSWORD=$db_password createdb -h "$DATABASE_HOST" -p "$DATABASE_PORT" -U "$DATABASE_USERNAME" "$db_name" 2>/dev/null || echo "Note: Database $db_name may already exist or couldn't be created now" + + # Wait for the database to become available + echo "⏳ Waiting for database $db_name to be ready..." + until PGPASSWORD=$db_password psql -h "$DATABASE_HOST" -p "$DATABASE_PORT" -U "$DATABASE_USERNAME" -d "$db_name" -c '\q' 2>/dev/null; do + >&2 echo "Postgres database $db_name is unavailable - retrying..." + sleep 2 + done + echo "✅ PostgreSQL database $db_name is ready!" +} + +# Create and check primary database +create_database "$DATABASE_NAME" "$DATABASE_PASSWORD" + +# Handle additional databases based on environment +if [ "$RAILS_ENV" = "development" ] || [ "$RAILS_ENV" = "production" ] || [ "$RAILS_ENV" = "staging" ]; then + # Setup Queue database + QUEUE_DATABASE_NAME=${QUEUE_DATABASE_NAME:-${DATABASE_NAME}_queue} + QUEUE_DATABASE_PASSWORD=${QUEUE_DATABASE_PASSWORD:-$DATABASE_PASSWORD} + create_database "$QUEUE_DATABASE_NAME" "$QUEUE_DATABASE_PASSWORD" + + # Setup Cache database + CACHE_DATABASE_NAME=${CACHE_DATABASE_NAME:-${DATABASE_NAME}_cache} + CACHE_DATABASE_PASSWORD=${CACHE_DATABASE_PASSWORD:-$DATABASE_PASSWORD} + create_database "$CACHE_DATABASE_NAME" "$CACHE_DATABASE_PASSWORD" +fi + +# Setup Cable database (only for production and staging) +if [ "$RAILS_ENV" = "production" ] || [ "$RAILS_ENV" = "staging" ]; then + CABLE_DATABASE_NAME=${CABLE_DATABASE_NAME:-${DATABASE_NAME}_cable} + CABLE_DATABASE_PASSWORD=${CABLE_DATABASE_PASSWORD:-$DATABASE_PASSWORD} + create_database "$CABLE_DATABASE_NAME" "$CABLE_DATABASE_PASSWORD" +fi # Run database migrations echo "PostgreSQL is ready. Running database migrations..."