Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Music Practice Journal

A Rails application for tracking music practice, like a practice journal.

⚠️ This is a work in progress project used for testing Rails features and other tools 👷 🧪

Includes both a web UI and REST API for CRUD operations.

Domain Schema

Tech Stack

  • Ruby 3.3.10 | Rails 8.1 | PostgreSQL
  • Authentication: Devise + JWT
  • Authorization: Pundit
  • Asset Pipeline: Propshaft
  • Styling: Tailwind CSS 2.0
  • Background Jobs: Solid Queue with recurring task scheduler
  • Job Monitoring: Mission Control for Jobs
  • Testing: RSpec 6.0 + FactoryBot + Shoulda::Matchers
  • Linting: Rubocop (100 char line length)

Setup & Running

With Docker (Recommended)

docker-compose up

This starts:

  • PostgreSQL on port 5432
  • Rails APP on port 3000
  • Solid Queue job supervisor (processes background jobs)

Run tests:

docker-compose exec app bundle exec rspec

App Credentials

To view Rails credentials (e.g., Devise secret key, mission control jobs UI), run:

# Open a shell session in container
docker compose run --rm --service-ports app bash

bin/rails credentials:show
# For prod data, add `-e production`

Background Jobs: Solid Queue

This app uses Solid Queue for background job processing with recurring task scheduling.

Database Configuration

Solid Queue uses a separate PostgreSQL database to avoid cluttering the main app schema:

Setup Queue Database

# Create queue databases
bin/rails db:create:queue

# Load queue schema
bin/rails db:schema:load:queue

Running Jobs

Start the job supervisor to dispatch and process jobs:

# Using bin/dev (includes web server, CSS, and job supervisor)
bin/dev

# OR using bin/jobs script (job supervisor only)
bin/jobs

# OR using Rails directly
bin/rails solid_queue:start

Monitoring Jobs

Access the Mission Control dashboard (requires login):

  • URL: http://localhost:3000/jobs
  • Features: View job status, recurring tasks, failed jobs, process monitoring

Recurring Tasks

Configured in config/recurring.yml:

  • Daily Practice Reminders: Scheduled daily at 9am
    • Checks users who haven't practiced in 24 hours
    • Sends reminder emails to those users
    • Automatically retries on failure (exponential backoff)

App on Host + Dockerized Postgres (recommended dev loop)

Run the app natively on the host (fast reload, native debugging, host RuboCop/LSP) against Postgres in Docker. Requires: PostgreSQL (Solid Queue runs on it), Ruby via mise (mise install), and native-gem build deps (sudo apt-get install -y libpq-dev build-essential).

bundle install     # gems on the host (first time)
bin/dev-local      # brings up Postgres if needed, then runs the app on localhost:3000

First run, also prepare the databases:

docker compose up -d --wait db
bin/rails db:prepare

bin/dev-local starts the db service, runs bin/dev (web + Tailwind watch + Solid Queue), and stops db on exit. No env needed — database.yml defaults to localhost:5432 on the host (which the db service exposes); the container overrides POSTGRES_HOST to db. Other host commands (rspec, bin/rails, bin/jobs) work the same, no prefix. First run: chmod +x bin/dev-local.

Run tests on the host (no prefix — just make sure Postgres is up):

docker compose up -d db
bundle exec rspec

Fully Local (Requires Ruby 3.3.10 + a local PostgreSQL)

bin/setup              # Install dependencies & prepare database
bin/dev                # Start dev server with hot-reload (includes job supervisor)
bundle exec rspec      # Run tests
bundle exec rubocop    # Lint check

API & Web Routes

  • Web routes (/web): View interface for CRUD operations

    • GET /web/musics → list musics
    • GET /web/practice_sessions → list practice sessions
    • Full CRUD available for both resources
  • API routes (/api/v1): JSON endpoints (legacy)

    • POST /api/v1/register → create user (no auth required)
    • POST /api/v1/login → issue JWT token
    • CRUD resources: musics, practice_sessions (all require auth)
  • Jobs Dashboard (/jobs): Mission Control for Jobs (requires authentication)

    • View all queued, processing, and failed jobs
    • Monitor recurring task executions
    • Track job performance and retries

Dependencies

Docker Setup

  • Docker
  • Docker Compose

Local Setup

  • Ruby 3.3.10
  • PostgreSQL
  • Bundler

Development Scripts

  • bin/setup - Initialize development environment
  • bin/dev - Start dev server with hot-reload (includes job supervisor)
  • bin/dev-local - Like bin/dev, but on the host against Dockerized Postgres (localhost:5432)
  • bin/jobs - Start only the Solid Queue job supervisor
  • bin/rails - Run Rails commands
  • bin/rails db:schema:load:queue - Load queue database schema

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages