Skip to content

Commit

Permalink
We postgres now
Browse files Browse the repository at this point in the history
  • Loading branch information
TomNaessens committed May 19, 2024
1 parent 48cf437 commit f58048e
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 42 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ gem 'simple_enum'
gem 'record_tag_helper'

# Database
gem 'mysql2'
gem 'pg'

group :development do
gem 'rails-erd'
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
13 changes: 6 additions & 7 deletions config/database.yml
Original file line number Diff line number Diff line change
@@ -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
22 changes: 10 additions & 12 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: .
Expand All @@ -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
Expand All @@ -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

Expand All @@ -49,6 +47,6 @@ services:
- "6379:6379"

volumes:
db_data:
gandalf_data:
redis_data:
storage:
36 changes: 16 additions & 20 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -35,6 +31,6 @@ services:
- "6379:6379"

volumes:
db_data:
db-test_data:
gandalf_data:
gandalf_test_data:
redis_data:

0 comments on commit f58048e

Please sign in to comment.