Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GraceDB Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michael William Coughlin
GraceDB Server
Commits
3e3b7665
Verified
Commit
3e3b7665
authored
6 years ago
by
Tanner Prestegard
Browse files
Options
Downloads
Patches
Plain Diff
Use same DB name, username, and password for replica DB
parent
8585c185
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
config/settings/container/production.py
+5
-17
5 additions, 17 deletions
config/settings/container/production.py
with
5 additions
and
17 deletions
config/settings/container/production.py
+
5
−
17
View file @
3e3b7665
...
...
@@ -28,27 +28,15 @@ if PRIORITY_SERVER:
else
:
# If not a priority server, we use the read-only replica database
# for reads and master for writes.
# Get information from environment variables
replica_db_name
=
os
.
environ
.
get
(
'
DJANGO_REPLICA_DB_NAME
'
,
None
)
if
replica_db_name
is
None
:
raise
ImproperlyConfigured
(
'
Could not get replica database name from
'
'
envvars.
'
)
replica_db_user
=
os
.
environ
.
get
(
'
DJANGO_REPLICA_DB_USER
'
,
None
)
if
replica_db_user
is
None
:
raise
ImproperlyConfigured
(
'
Could not get replica database user
'
'
from envvars.
'
)
replica_db_password
=
os
.
environ
.
get
(
'
DJANGO_REPLICA_DB_PASSWORD
'
,
None
)
if
replica_db_password
is
None
:
raise
ImproperlyConfigured
(
'
Could not get replica database password
'
'
from envvars.
'
)
# The username, password, and database name are all replicated
# from the production database
# Set up dict and add to DATABASES setting
read_replica
=
{
'
NAME
'
:
replica_db_name
,
'
NAME
'
:
DATABASES
[
'
default
'
][
'
NAME
'
]
,
'
ENGINE
'
:
'
django.db.backends.mysql
'
,
'
USER
'
:
replica_db_user
,
'
PASSWORD
'
:
replica_db_password
,
'
USER
'
:
DATABASES
[
'
default
'
][
'
USER
'
]
,
'
PASSWORD
'
:
DATABASES
[
'
default
'
][
'
PASSWORD
'
]
,
'
HOST
'
:
os
.
environ
.
get
(
'
DJANGO_REPLICA_DB_HOST
'
,
''
),
'
PORT
'
:
os
.
environ
.
get
(
'
DJANGO_REPLICA_DB_PORT
'
,
''
),
'
OPTIONS
'
:
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment