Skip to content

Commit

Permalink
Start Server
Browse files Browse the repository at this point in the history
  • Loading branch information
lecaoquochung committed Oct 13, 2020
1 parent ff4120e commit e085722
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
13 changes: 2 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- run:
name: Generate the Scala application bundle
command: |
sbt clean dist
sudo sbt clean dist
- persist_to_workspace:
root: .
paths:
Expand Down Expand Up @@ -56,11 +56,9 @@ jobs:
volumes:
- $PWD/docker/postgres/initdb:/docker-entrypoint-initdb.d
- image: redis:3.2.10

environment:
- DATABASE_URL=postgres://qa:qaPassword@localhost:5432/qa
- TEST_DATABASE_URL=postgres://test:testPassword@localhost:5432/test

steps:
- attach_workspace:
at: .
Expand All @@ -77,17 +75,10 @@ jobs:
- run:
name: Validate QA test data
command: |
pwd;
export PGPASSWORD='qaPassword'; psql -h localhost -p 5432 -U qa qa < sql/qa.sql
psql -h localhost -p 5432 -U qa -c "CREATE USER test WITH PASSWORD 'testPassword'";
psql -h localhost -p 5432 -U qa -c "CREATE DATABASE test;"
psql -h localhost -p 5432 -U qa -c "GRANT ALL PRIVILEGES ON DATABASE test to test;"
export PGPASSWORD='testPassword'; psql -h localhost -p 5432 -U test test < sql/test.sql
echo "127.0.0.1 qa.api.test api.test" | sudo tee -a /etc/hosts;
./.circleci/test_db.sh
- run:
name: Start Server
command: |
ping -c 4 api.test
./.circleci/qa.sh
when: always
- run:
Expand Down
11 changes: 9 additions & 2 deletions .circleci/qa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@ screen -d -m -S api sbt \
"run 80"

# Wait for the server to start up
curl --retry 60 \
curl --retry 120 \
--retry-connrefused \
--retry-max-time 60 \
--retry-max-time 120 \
--retry-delay 1 \
http://127.0.0.1

# Wait for the server to start up
curl --retry 120 \
--retry-connrefused \
--retry-max-time 120 \
--retry-delay 1 \
http://api.test

Expand Down
Empty file added .circleci/test_artifact.sh
Empty file.
Empty file modified .circleci/test_db.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sample-play-scala",
"version": "1.0.1-hosts-2",
"version": "1.0.1-server-4",
"license": "MIT",
"description": "sample play scala",
"dependencies": {
Expand Down

0 comments on commit e085722

Please sign in to comment.