Skip to content

Commit 1f62c10

Browse files
authored
fix specs in docker clobbering dev database. (#1602)
* fix specs in docker clobbering dev database. turns out DATABASE_URL clobbers everything. Fixes #1600 * circle fix
1 parent 59bc807 commit 1f62c10

File tree

6 files changed

+32
-23
lines changed

6 files changed

+32
-23
lines changed

.circleci/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ jobs:
3636
parallelism: 4
3737
environment:
3838
RAILS_VERSION: << parameters.rails_version >>
39-
POSTGRES_DB: circle_test
40-
POSTGRES_HOST: 127.0.0.1
41-
POSTGRES_USER: postgres
42-
TEST_DB: circle_test
39+
DATABASE_NAME: circle_test
40+
DATABASE_HOST: 127.0.0.1
41+
DATABASE_USER: postgres
42+
DATABASE_TEST_NAME: circle_test
4343
BUNDLE_PATH: vendor/bundle
4444
COVERALLS_PARALLEL: true
4545
BUNDLE_JOBS: 4

.env

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CHROME_HOSTNAME=chrome
2-
DB_ADAPTER=postgresql
3-
POSTGRES_DB=hyku
4-
POSTGRES_HOST=db
5-
POSTGRES_PASSWORD=DatabaseFTW
6-
POSTGRES_USER=postgres
7-
TEST_DB=hyku_test
2+
DATABASE_ADAPTER=postgresql
3+
DATABASE_NAME=hyku
4+
DATABASE_HOST=db
5+
DATABASE_PASSWORD=DatabaseFTW
6+
DATABASE_USER=postgres
7+
DATBASE_TEST_NAME=hyku_test

config/database.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Hi - please dont edit this file directly, instead make changes in your .env file
22

33
login: &login
4-
adapter: <%= ENV['DB_ADAPTER'] || 'postgresql' %>
5-
host: <%= ENV['POSTGRES_HOST'] %>
6-
username: <%= ENV['POSTGRES_USER'] %>
7-
password: <%= ENV['POSTGRES_PASSWORD'] %>
8-
database: <%= ENV['POSTGRES_DB'] || 'hyku' %>
9-
pool: 5
4+
adapter: <%= ENV['DATABASE_ADAPTER'] || 'postgresql' %>
5+
host: <%= ENV['DATABASE_HOST'] %>
6+
username: <%= ENV['DATABASE_USER'] %>
7+
password: <%= ENV['DATABASE_PASSWORD'] %>
8+
database: <%= ENV['DATABASE_NAME'] || 'hyku' %>
9+
pool: 50
1010
timeout: 5000
1111

1212

@@ -15,7 +15,7 @@ development:
1515

1616
test:
1717
<<: *login
18-
database: <%= ENV['TEST_DB'] || 'hyku_test' %>
18+
database: <%= ENV['DATABASE_TEST_NAME'] || 'hyku_test' %>
1919

2020
staging:
2121
<<: *login

docker-compose.production.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ services:
100100
image: postgres:11.1
101101
env_file:
102102
- .env
103+
environment:
104+
- POSTGRES_DB=${DATABASE_NAME}
105+
- POSTGRES_PASSWORD=${DATABASE_PASSWORD}
106+
- POSTGRES_USER=${DATABASE_USER}
103107
volumes:
104108
- db:/var/lib/postgresql/data
105109
networks:
@@ -110,7 +114,6 @@ services:
110114
env_file:
111115
- .env
112116
environment:
113-
- DATABASE_URL=postgresql://postgres@db/postgres
114117
- FEDORA_URL=http://fcrepo:8080/fcrepo/rest
115118
- IN_DOCKER=true
116119
- LD_LIBRARY_PATH=/opt/fits/tools/mediainfo/linux

docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ networks:
1616
services:
1717
zoo1:
1818
image: zookeeper:3.4
19-
restart: always
2019
environment:
2120
- ZOO_MY_ID=1
2221
- ZOO_SERVERS=server.1=zoo1:2888:3888
@@ -62,6 +61,10 @@ services:
6261
image: postgres:11.1
6362
env_file:
6463
- .env
64+
environment:
65+
- POSTGRES_DB=${DATABASE_NAME}
66+
- POSTGRES_PASSWORD=${DATABASE_PASSWORD}
67+
- POSTGRES_USER=${DATABASE_USER}
6568
volumes:
6669
- db:/var/lib/postgresql/data
6770
networks:
@@ -81,7 +84,6 @@ services:
8184
env_file:
8285
- .env
8386
environment:
84-
- DATABASE_URL=postgresql://postgres@db/postgres
8587
- FEDORA_URL=http://fcrepo:8080/fcrepo/rest
8688
- IN_DOCKER=true
8789
- LD_LIBRARY_PATH=/opt/fits/tools/mediainfo/linux
@@ -141,15 +143,13 @@ services:
141143
initialize_app:
142144
extends:
143145
service: app
144-
restart: on-failure
145146
command: bundle exec rails zookeeper:upload
146147
depends_on:
147148
- zoo1
148149

149150
db_migrate:
150151
extends:
151152
service: app
152-
restart: on-failure
153153
command: bundle exec rails db:migrate
154154
depends_on:
155155
- db

ops/env.conf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
env DATABASE_URL;
1+
env DATABASE_ADAPTER;
2+
env DATABASE_HOST;
3+
env DATABASE_NAME;
4+
env DATABASE_PASSWORD;
5+
env DATABASE_USER;
6+
env DATBASE_TEST_NAME;
27
env FEDORA_URL;
8+
env GOOGLE_FONTS_KEY;
39
env LD_LIBRARY_PATH;
410
env PASSENGER_APP_ENV;
511
env RAILS_ENV;

0 commit comments

Comments
 (0)