diff --git a/Gemfile b/Gemfile index cf119cc1..45530c42 100644 --- a/Gemfile +++ b/Gemfile @@ -110,7 +110,7 @@ gem 'simple_enum' gem 'record_tag_helper' # Database -gem 'mysql2' +gem 'pg' group :development do gem 'rails-erd' diff --git a/Gemfile.lock b/Gemfile.lock index 6bf850ee..b61c515c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -197,7 +197,6 @@ GEM multi_xml (0.7.1) bigdecimal (~> 3.1) mutex_m (0.2.0) - mysql2 (0.5.6) net-http (0.4.1) uri net-imap (0.4.11) @@ -251,6 +250,7 @@ GEM parser (3.3.1.0) ast (~> 2.4.1) racc + pg (1.5.6) poltergeist (1.18.1) capybara (>= 2.1, < 4) cliver (~> 0.3.1) @@ -495,10 +495,10 @@ DEPENDENCIES letter_opener listen minitest (= 5.15.0) - mysql2 omniauth-rails_csrf_protection omniauth-zeuswpi paper_trail + pg poltergeist puma rails (~> 6.1) diff --git a/config/database.yml b/config/database.yml index 48e222fd..697b91ed 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,21 +1,20 @@ default: &default - adapter: mysql2 + adapter: postgresql pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> host: 127.0.0.1 - port: 3306 - database: gandalf - username: gandalf + username: postgres password: password - encoding: utf8mb4 - collation: utf8mb4_unicode_ci + encoding: utf8 + port: 5432 development: <<: *default + database: gandalf test: <<: *default database: gandalf-test - port: 3307 + port: 5433 production: <<: *default diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 5dd5b027..f3d533cc 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -2,17 +2,15 @@ version: '3.3' services: db: - image: mariadb:10.8 - volumes: - - db_data:/var/lib/mysql - command: ['--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci'] + image: postgres:16 environment: - MYSQL_ROOT_PASSWORD: strong-password - MYSQL_DATABASE: gandalf - MYSQL_USER: gandalf - MYSQL_PASSWORD: password + POSTGRES_DB: gandalf + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + volumes: + - gandalf_data:/var/lib/postgresql/data ports: - - "3306:3306" + - "5432:5432" web: build: . @@ -23,7 +21,7 @@ services: volumes: - storage:/app/storage environment: - DATABASE_URL: mysql2://gandalf:password@db/gandalf + DATABASE_URL: postgresql://postgres:password@db/gandalf RAILS_LOG_TO_STDOUT: 1 SECRET_AUTH_USERNAME: admin SECRET_AUTH_PASSWORD: admin-password @@ -37,7 +35,7 @@ services: volumes: - storage:/app/storage environment: - DATABASE_URL: mysql2://gandalf:password@db/gandalf + DATABASE_URL: postgresql://postgres:password@db/gandalf REDIS_URL: redis://redis:6379 entrypoint: bundle exec sidekiq @@ -49,6 +47,6 @@ services: - "6379:6379" volumes: - db_data: + gandalf_data: redis_data: storage: diff --git a/docker-compose.yml b/docker-compose.yml index b1a6c3e0..0e82e694 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,30 +2,26 @@ version: '3.3' services: db: - image: mariadb:10.8 - volumes: - - db_data:/var/lib/mysql - command: ['--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci'] + image: postgres:16 environment: - MYSQL_ROOT_PASSWORD: strong-password - MYSQL_DATABASE: gandalf - MYSQL_USER: gandalf - MYSQL_PASSWORD: password + POSTGRES_DB: gandalf + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + volumes: + - gandalf_data:/var/lib/postgresql/data ports: - - "3306:3306" + - "5432:5432" db-test: - image: mariadb:10.8 - volumes: - - db-test_data:/var/lib/mysql - command: ['--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci'] + image: postgres:16 environment: - MYSQL_ROOT_PASSWORD: strong-password - MYSQL_DATABASE: gandalf-test - MYSQL_USER: gandalf - MYSQL_PASSWORD: password + POSTGRES_DB: gandalf-test + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + volumes: + - gandalf_test_data:/var/lib/postgresql/data ports: - - "3307:3306" + - "5433:5432" redis: image: redis:7-alpine @@ -35,6 +31,6 @@ services: - "6379:6379" volumes: - db_data: - db-test_data: + gandalf_data: + gandalf_test_data: redis_data: