From fe152591ba22c5970c23559d6e86367a0a8e5044 Mon Sep 17 00:00:00 2001 From: George Mihai Grigore Date: Sat, 26 Oct 2024 14:06:34 +0300 Subject: [PATCH] Add docker persistent database storage --- .rubocop_todo.yml | 2 +- Gemfile.lock | 14 +++++++------- config/scout_apm.yml | 2 +- docker-compose.yml | 9 +++++++-- spec/models/user_spec.rb | 2 +- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 8a840b6..8e0d4e9 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2024-10-23 16:09:59 UTC using RuboCop version 1.67.0. +# on 2024-10-26 10:38:12 UTC using RuboCop version 1.67.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new diff --git a/Gemfile.lock b/Gemfile.lock index 9df4a32..7ac86c0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -164,8 +164,8 @@ GEM execjs (2.10.0) factory_bot (6.5.0) activesupport (>= 5.0.0) - factory_bot_rails (6.4.3) - factory_bot (~> 6.4) + factory_bot_rails (6.4.4) + factory_bot (~> 6.5) railties (>= 5.0.0) faker (3.5.1) i18n (>= 1.8.11, < 2) @@ -210,7 +210,7 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (2.7.3) + json (2.7.4) kaminari (1.2.2) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.2) @@ -225,7 +225,7 @@ GEM kaminari-core (1.2.2) language_server-protocol (3.17.0.3) logger (1.6.1) - loofah (2.22.0) + loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -265,7 +265,7 @@ GEM parser (3.3.5.0) ast (~> 2.4.1) racc - pg (1.5.8) + pg (1.5.9) pghero (3.6.1) activerecord (>= 6.1) popper_js (2.11.8) @@ -381,7 +381,7 @@ GEM rubocop-performance (1.22.1) rubocop (>= 1.48.1, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rails (2.26.2) + rubocop-rails (2.27.0) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.52.0, < 2.0) @@ -393,7 +393,7 @@ GEM rubocop-performance (>= 1.22.1, < 2.0) rubocop-rails (>= 2.26.2, < 3.0) rubocop-rspec (>= 3.1.0, < 4.0) - rubocop-rspec (3.1.0) + rubocop-rspec (3.2.0) rubocop (~> 1.61) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) diff --git a/config/scout_apm.yml b/config/scout_apm.yml index 484c70c..7529f33 100644 --- a/config/scout_apm.yml +++ b/config/scout_apm.yml @@ -2,7 +2,7 @@ common: &defaults monitor: true log_level: debug key: <%= ENV.fetch("SCOUT_KEY", nil) %> - name: <%= ENV.fetch("SCOUT_NAME", nil) %> + name: <%= ENV.fetch("SCOUT_NAME", "DefaultTemplate") %> production: <<: *defaults diff --git a/docker-compose.yml b/docker-compose.yml index ff66b79..bab9283 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,7 +18,7 @@ services: - POSTGRES_HOST=db - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres - - DATABASE_URL=postgres://postgres:postgres@db:5432/myapp_development + - DATABASE_URL=postgres://postgres:postgres@db:5432/default_template_development - REDIS_URL=redis://redis:6379/0 volumes: - .:/rails @@ -50,11 +50,16 @@ services: environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres - POSTGRES_DB: myapp_development + POSTGRES_DB: default_template_development ports: - "5433:5432" + volumes: + - default_template_pgdata:/var/lib/postgresql/data redis: image: redis:6.2 ports: - "6380:6379" + +volumes: + default_template_pgdata: diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 6b86089..c0a309d 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" RSpec.describe User, type: :model do - subject(:user) { create(:user) } + let(:user) { create(:user) } describe "validations" do %i[first_name last_name email].each do |attribute|