Skip to content

Commit e748bc6

Browse files
authored
ci: configure Travis CI for branch 'dev'
1 parent 109720a commit e748bc6

File tree

8 files changed

+77
-73
lines changed

8 files changed

+77
-73
lines changed

.travis.yml

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
1-
sudo: required
2-
3-
dist: xenial
4-
5-
service:
6-
- docker
7-
1+
os:
2+
- linux
3+
dist: bionic
4+
language: python
5+
services:
6+
- docker
7+
install:
8+
# omit automatic installation of dependencies in virtualenv
9+
- pip --version
810
stages:
9-
- if: branch = master
10-
name: master build
11-
- if: branch = dev
12-
name: dev build
13-
- name: branch build
14-
11+
- name: test
12+
- name: publish
13+
# do not execute if PR branch
14+
if: type != pull_request
15+
branches:
16+
only:
17+
- dev
1518
jobs:
1619
include:
17-
- stage: master build
20+
- stage: test
21+
name: Build, deploy and test application
1822
script:
19-
- version=0.1
20-
- docker build -t weselixir/elixir-wes-app:"$version" -t weselixir/elixir-wes-app:master .
21-
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
22-
- if [ "$TRAVIS_PULL_REQUEST" = false ]; then docker push "$DOCKER_REPO_NAME":"$version"; fi
23-
- stage: dev build
23+
# build and deploy application
24+
- "docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml up --build -d"
25+
# test if endpoint 'GET /runs' is accessible
26+
- "test $(curl -sL -w '%{http_code}' -X GET --header 'Accept: application/json' 'http://localhost:7777/ga4gh/wes/v1/runs' -o /dev/null) == '200'"
27+
- stage: publish
28+
name: Push image to registry
29+
env:
30+
- secure: "woVF7L1vADo4OqyKm7Kq8PC95Ej4L1q3R4Gf0Uh9p1tA81JMfD/3HDS5dG3OQvjoftcA7PqpFTrZq6GL1hR/bQqoQypHVNziH9PnDZFJPvxIYa8BUV7lknva4aSB6lcj4jmukHAnGNrusgSNXqcmFO0ziX4nyCNwcmXNGfRMKB3D25t0MAALtpSBYFovN1+7yijlklyjPCPUaEJ8Sj/HpohJ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mfNfTg0eSmsHPs//oPsXb4NZU/f4oeXJvvVmG1PTx7mOwGnSokZT8iI+rk3ULCyf+lz0JNQy7Jx5mb+kEqI="
2432
script:
25-
- docker build -t weselixir/elixir-wes-app:dev -t weselixir/elixir-wes-app:build-"$TRAVIS_BUILD_NUMBER" .
26-
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
27-
- if [ "$TRAVIS_PULL_REQUEST" = false ]; then docker push "$DOCKER_REPO_NAME":build-"$TRAVIS_BUILD_NUMBER"; fi
28-
- stage: branch build
29-
script:
30-
- docker build -t weselixir/elixir-wes-app-branched:build-"$TRAVIS_BUILD_NUMBER" .
31-
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
33+
# build and tag app image
34+
- docker build -t "$DOCKER_REPO_NAME":"$DOCKER_REPO_TAG" .
35+
# log in
36+
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
37+
# push image
38+
- docker push "$DOCKER_REPO_NAME":"$DOCKER_REPO_TAG"

docker-compose.dev.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
version: '3.6'
22
services:
33

4-
celery-worker-wes-elixir:
5-
environment:
6-
- WES_CONFIG=/app/wes_elixir/config/override/app_config.dev.yaml
7-
84
wes-elixir:
95
environment:
106
- WES_CONFIG=/app/wes_elixir/config/override/app_config.dev.yaml
117
ports:
128
- "7777:8080"
139

14-
rabbit-wes-elixir:
10+
wes-elixir-worker:
11+
environment:
12+
- WES_CONFIG=/app/wes_elixir/config/override/app_config.dev.yaml
13+
14+
rabbit:
1515
ports:
1616
- "5672:5672"
1717

18-
mongo-wes-elixir:
18+
mongo:
1919
ports:
2020
- "27017:27017"
2121

22-
flower-wes-elixir:
22+
flower:
2323
ports:
2424
- "5555:5555"

docker-compose.prod.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
version: '3.6'
22
services:
33

4-
celery-worker-wes-elixir:
5-
environment:
6-
- WES_CONFIG=/app/wes_elixir/config/override/app_config.prod.yaml
7-
84
wes-elixir:
95
environment:
106
- WES_CONFIG=/app/wes_elixir/config/override/app_config.prod.yaml
117
ports:
128
- "80:8080"
139

14-
rabbit-wes-elixir:
10+
wes-elixir-worker:
11+
environment:
12+
- WES_CONFIG=/app/wes_elixir/config/override/app_config.prod.yaml
13+
14+
rabbit:
1515
ports:
1616
- "5672:5672"
1717

18-
mongo-wes-elixir:
18+
mongo:
1919
ports:
2020
- "27017:27017"

docker-compose.yaml

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,46 @@
11
version: '3.6'
22
services:
33

4-
celery-worker-wes-elixir:
5-
image: wes-elixir:latest
4+
wes-elixir:
5+
image: elixircloud/wes-elixir:latest
66
build:
77
context: .
88
dockerfile: Dockerfile
99
restart: unless-stopped
1010
links:
11-
- mongo-wes-elixir
12-
- rabbit-wes-elixir
13-
command: bash -c "cd /app/wes_elixir; celery worker -A celery_worker -E --loglevel=info"
11+
- mongo
12+
command: bash -c "cd /app/wes_elixir; gunicorn -c config.py wsgi:app"
1413
volumes:
15-
- ../data/wes_elixir:/data
16-
- /wes/vol:/tmp
14+
- ../../data/wes_elixir:/data
1715

18-
wes-elixir:
19-
image: wes-elixir:latest
20-
build:
21-
context: .
22-
dockerfile: Dockerfile
16+
wes-elixir-worker:
17+
image: elixircloud/wes-elixir:latest
2318
restart: unless-stopped
19+
depends_on:
20+
- wes-elixir
2421
links:
25-
- mongo-wes-elixir
26-
command: bash -c "cd /app/wes_elixir; gunicorn -c config.py wsgi:app"
22+
- mongo
23+
- rabbit
24+
command: bash -c "cd /app/wes_elixir; celery worker -A celery_worker -E --loglevel=info"
2725
volumes:
28-
- ../data/wes_elixir:/data
26+
- ../../data/wes_elixir:/data
2927

30-
rabbit-wes-elixir:
28+
rabbit:
3129
image: "rabbitmq:3-management"
3230
hostname: "rabbit"
3331
restart: unless-stopped
3432
links:
35-
- mongo-wes-elixir
33+
- mongo
3634

37-
mongo-wes-elixir:
35+
mongo:
3836
image: mongo:3.2
3937
restart: unless-stopped
4038
volumes:
41-
- ../data/wes_elixir/db:/data/db
39+
- ../../data/wes_elixir/db:/data/db
4240

43-
flower-wes-elixir:
41+
flower:
4442
image: mher/flower:0.9
4543
restart: unless-stopped
4644
links:
47-
- celery-worker-wes-elixir
48-
command: flower --broker=amqp://guest:guest@rabbit-wes-elixir:5672// --port=5555
45+
- wes-elixir-worker
46+
command: flower --broker=amqp://guest:guest@rabbit:5672// --port=5555

wes_elixir/config/app_config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ api:
5959
swagger_ui: True
6060
swagger_json: True
6161
endpoint_params:
62-
default_page_size: 10
62+
default_page_size: 5
6363
timeout_cancel_run: 60
6464
timeout_run_workflow: Null
6565

wes_elixir/config/override/app_config.dev.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
# Security settings
44
security:
5-
authorization_required: True
5+
authorization_required: False
66

77
# Database settings
88
database:
9-
host: 'mongo-wes-elixir'
9+
host: 'mongo'
1010
name: wes-elixir-db-dev
1111

1212
# Storage
@@ -16,7 +16,7 @@ storage:
1616

1717
# Celery task queue
1818
celery:
19-
broker_host: 'rabbit-wes-elixir'
19+
broker_host: 'rabbit'
2020

2121
# OpenAPI specs
2222

wes_elixir/config/override/app_config.prod.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ security:
1111

1212
# Database settings
1313
database:
14-
host: 'mongo-wes-elixir'
14+
host: 'mongo'
1515

1616
# Storage
1717
storage:
@@ -20,7 +20,7 @@ storage:
2020

2121
# Celery task queue
2222
celery:
23-
broker_host: 'rabbit-wes-elixir'
23+
broker_host: 'rabbit'
2424

2525
# OpenAPI specs
2626

wes_elixir/ga4gh/wes/endpoints/run_workflow.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import shutil
77
import string # noqa: F401
88
import subprocess
9-
import string # noqa: F401
109

1110
from celery import uuid
1211
from json import (decoder, loads)
@@ -173,7 +172,7 @@ def __create_run_environment(
173172
run_id_length = get_conf(config, 'database', 'run_id', 'length')
174173

175174
# Keep on trying until a unique run id was found and inserted
176-
# TODO: If no more possible IDs => inf loop; fix (raise customerror; 500
175+
# TODO: If no more possible IDs => inf loop; fix (raise custom error; 500
177176
# to user)
178177
while True:
179178

@@ -193,8 +192,8 @@ def __create_run_environment(
193192
# TODO: Think about permissions
194193
# TODO: Add working dir (currently one has to run the app from
195194
# outermost dir)
196-
os.mkdir(current_tmp_dir)
197-
os.mkdir(current_out_dir)
195+
os.makedirs(current_tmp_dir)
196+
os.makedirs(current_out_dir)
198197

199198
# Try new run id if directory already exists
200199
except FileExistsError:
@@ -383,7 +382,7 @@ def __process_workflow_attachments(data: Dict) -> Dict:
383382
data['internal']['param_file_path'] = os.path.join(
384383
workflow_dir,
385384
'.'.join([
386-
workflow_name_ext[0],
385+
str(workflow_name_ext[0]),
387386
'yml',
388387
]),
389388
)
@@ -413,7 +412,7 @@ def __process_workflow_attachments(data: Dict) -> Dict:
413412
workflow_dir,
414413
'repo',
415414
'.'.join([
416-
workflow_name_ext[0],
415+
str(workflow_name_ext[0]),
417416
ext,
418417
]),
419418
)

0 commit comments

Comments
 (0)