forked from fixin.me/fixin.me
Add database configurations steps
This commit is contained in:
parent
c4bba4d2e8
commit
e497d08f75
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
# Ignore master key for decrypting credentials and more.
|
# Ignore master key for decrypting credentials and more.
|
||||||
/config/application.rb
|
/config/application.rb
|
||||||
|
/config/database.yml
|
||||||
/config/initializers/secret_token.rb
|
/config/initializers/secret_token.rb
|
||||||
/config/master.key
|
/config/master.key
|
||||||
|
|
||||||
|
16
README.md
16
README.md
@ -15,12 +15,20 @@ Modify configuration settings below `SETUP` comment appropriately.
|
|||||||
|
|
||||||
## Database
|
## Database
|
||||||
|
|
||||||
Create database ...
|
cp -a config/database.yml.dist config/database.yml
|
||||||
|
|
||||||
Update database configuration in _config/database.yml_ if required.
|
Update database configuration.
|
||||||
|
|
||||||
Password is expected to be provided in `FIXINME_DATABASE_PASSWORD` environment
|
Create database user and grant privileges:
|
||||||
variable.
|
|
||||||
|
> mysql -p
|
||||||
|
mysql> create user fixinme@localhost identified by '<some password>';
|
||||||
|
mysql> grant all privileges on fixinme.* to fixinme@localhost;
|
||||||
|
mysql> flush privileges;
|
||||||
|
|
||||||
|
Run database creation task:
|
||||||
|
|
||||||
|
RAILS_ENV="production" bundle exec rake db:create
|
||||||
|
|
||||||
Run migrations ...
|
Run migrations ...
|
||||||
|
|
||||||
|
@ -1,20 +1,10 @@
|
|||||||
# MySQL. Versions 5.5.8 and up are supported.
|
# If you don't want to store sensitive information, like your database password,
|
||||||
|
# in your source code, provide the password or a full connection URL as an
|
||||||
|
# environment variable when you boot the app. For example:
|
||||||
#
|
#
|
||||||
# Install the MySQL driver
|
# DATABASE_PASSWORD="some-password"
|
||||||
# gem install mysql2
|
|
||||||
#
|
#
|
||||||
# Ensure the MySQL gem is defined in your Gemfile
|
# or
|
||||||
# gem "mysql2"
|
|
||||||
#
|
|
||||||
# And be sure to use new-style password hashing:
|
|
||||||
# https://dev.mysql.com/doc/refman/5.7/en/password-hashing.html
|
|
||||||
#
|
|
||||||
# As with config/credentials.yml, you never want to store sensitive information,
|
|
||||||
# like your database password, in your source code. If your source code is
|
|
||||||
# ever seen by anyone, they now have access to your database.
|
|
||||||
#
|
|
||||||
# Instead, provide the password or a full connection URL as an environment
|
|
||||||
# variable when you boot the app. For example:
|
|
||||||
#
|
#
|
||||||
# DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
|
# DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
|
||||||
#
|
#
|
||||||
@ -26,6 +16,11 @@
|
|||||||
# production:
|
# production:
|
||||||
# url: <%= ENV["MY_APP_DATABASE_URL"] %>
|
# url: <%= ENV["MY_APP_DATABASE_URL"] %>
|
||||||
#
|
#
|
||||||
|
# You can specify password environment variable in a similar way:
|
||||||
|
#
|
||||||
|
# production:
|
||||||
|
# password: <%= ENV["DATABASE_PASSWORD"] %>
|
||||||
|
#
|
||||||
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
||||||
# for a full overview on how database connection configuration can be specified.
|
# for a full overview on how database connection configuration can be specified.
|
||||||
default: &default
|
default: &default
|
||||||
@ -33,13 +28,15 @@ default: &default
|
|||||||
encoding: utf8mb4
|
encoding: utf8mb4
|
||||||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
||||||
username: fixinme
|
username: fixinme
|
||||||
password: <%= ENV["FIXINME_DATABASE_PASSWORD"] %>
|
password:
|
||||||
socket: /run/mysqld/mysqld.sock
|
socket: /run/mysqld/mysqld.sock
|
||||||
|
|
||||||
production:
|
production:
|
||||||
<<: *default
|
<<: *default
|
||||||
database: fixinme_production
|
database: fixinme_production
|
||||||
|
|
||||||
|
# Unless you're planning on developing the application, you can skip/remove
|
||||||
|
# configurations for development and test databases altogether.
|
||||||
development:
|
development:
|
||||||
<<: *default
|
<<: *default
|
||||||
database: fixinme_dev
|
database: fixinme_dev
|
Loading…
x
Reference in New Issue
Block a user