Skip to content

Commit eeef7c3

Browse files
author
wimo7083
committed
2 parents 86793b8 + 3aa0ef0 commit eeef7c3

File tree

6 files changed

+16
-25
lines changed

6 files changed

+16
-25
lines changed

.travis.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
env:
22
global:
33
- SQLALCHEMY_DATABASE_URI="sqlite:///:memory:"
4+
- IMAGE_NAME=resources-api
45
language: python
56
sudo: required
67
dist: xenial
@@ -33,10 +34,10 @@ script:
3334
- 'make test'
3435
- 'make lint'
3536

37+
after_success:
38+
- bash bin/run.sh
39+
3640
after_script:
3741
- docker-compose run resources-api coverage xml
3842
- docker-compose -f docker-compose.yml down
3943
- if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then ./cc-test-reporter -r 147d129d98f3d606ce69bc151bbeded40dc684fe11e0f5a831f11f6b36680b22 after-build --exit-code $TRAVIS_TEST_RESULT; fi
40-
41-
after_success:
42-
- bash bin/run.sh

bin/build

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env bash
22

33
set -eu
4-
# import util functions
5-
source "${SCRIPTDIR}/../lib/util.sh"
4+
5+
echo "IMAGE_NAME $IMAGE_NAME"
6+
IMAGE_NAME="resources-api"
67

78
echo "Building Docker image..."
8-
runCommand "docker build -t $IMAGE_NAME -f Dockerfile ." || exit $?
9+
docker build -t $IMAGE_NAME -f Dockerfile . || exit $?

bin/publish

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
set -eu
88

9+
echo "IMAGE_NAME $IMAGE_NAME"
10+
911
DOCKER_REPO="operationcode/resources-api"
1012
IMAGE_NAME="resources-api"
1113

configs.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@ def get_sys_exec_root_or_drive():
2828
if not postgres_db:
2929
raise KeyError("Application requires 'POSTGRES_DB' to run")
3030

31+
postgres_host = os.environ.get('POSTGRES_HOST')
32+
if not postgres_host:
33+
raise KeyError("Application requires 'POSTGRES_HOST' to run")
34+
3135

3236
class Config:
3337
SQLALCHEMY_TRACK_MODIFICATIONS = False
34-
SQLALCHEMY_DATABASE_URI = f"postgresql://{postgres_user}:{postgres_password}@{postgres_db}:5432/{postgres_db}"
38+
SQLALCHEMY_DATABASE_URI = f"postgresql://{postgres_user}:{postgres_password}@{postgres_host}:5432/{postgres_db}"
3539

3640
# Can pass in changes to defaults, such as PaginatorConfig(per_page=40)
3741
RESOURCE_PAGINATOR = PaginatorConfig()

docker-compose.yml

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ services:
2323
- POSTGRES_USER=${POSTGRES_USER}
2424
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
2525
- POSTGRES_DB=${POSTGRES_DB}
26+
- POSTGRES_HOST=${POSTGRES_HOST}
2627
ports:
2728
- 5432:5432
2829
volumes:

lib/util.sh

-18
This file was deleted.

0 commit comments

Comments
 (0)