Skip to content

Commit

Permalink
Merge 93b579e into a9417be
Browse files Browse the repository at this point in the history
  • Loading branch information
sychan committed Oct 31, 2018
2 parents a9417be + 93b579e commit 5186404
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 25 deletions.
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ COPY --from=build /kb/deployment/lib/biokbase /kb/deployment/lib/biokbase
COPY --from=build /kb/deployment/services /kb/deployment/services
COPY --from=build /tmp/catalog/deployment/conf /kb/deployment/conf

SHELL ["/bin/bash", "-c"]
RUN source activate root && \
conda install -c anaconda semantic_version pymongo=2.8 && \
pip install docker && \
ln -s /usr/lib/python2.7/plat-*/_sysconfigdata_nd.py /usr/lib/python2.7/

LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.vcs-url="https://github.com/kbase/catalog.git" \
org.label-schema.vcs-ref=$VCS_REF \
Expand All @@ -29,4 +35,6 @@ ENTRYPOINT [ "/kb/deployment/bin/dockerize" ]
# Here are some default params passed to dockerize. They would typically
# be overidden by docker-compose at startup
CMD [ "-template", "/kb/deployment/conf/.templates/deploy.cfg.templ:/kb/deployment/conf/deploy.cfg", \
"-poll", \
"-stderr", "/kb/deployment/services/catalog/error.log", \
"/kb/deployment/services/catalog/start_service" ]
13 changes: 3 additions & 10 deletions lib/biokbase/catalog/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,8 @@ def __init__(self, config):
self.docker_registry_host = config['docker-registry-host']
print('Docker registry host config = '+ self.docker_registry_host)

self.docker_push_allow_insecure = None # none should just set this to default?
if 'docker-push-allow-insecure' in config:
print('Docker docker-push-allow-insecure = '+ config['docker-push-allow-insecure'])
if config['docker-push-allow-insecure'].strip() == "1": # pragma: no cover
self.docker_push_allow_insecure = True;
print('WARNING!! - Docker push is set to allow insecure connections. This should never be on in production.')

print('WARNING!! Docker docker-push-allow-insecure found in configuration. This is no longer supported - use --insecure-registry on dockerd')

if 'ref-data-base' not in config: # pragma: no cover
raise ValueError('"ref-data-base" config variable must be defined to start a CatalogController!')
Expand Down Expand Up @@ -181,7 +176,7 @@ def register_repo(self, params, username, token):
# first set the dev current_release timestamp

t = threading.Thread(target=_start_registration, args=(params,registration_id,timestamp,username,self.is_admin(username),token,self.db, self.temp_dir, self.docker_base_url,
self.docker_registry_host, self.docker_push_allow_insecure, self.nms_url, self.nms_token, module_details, self.ref_data_base, self.kbase_endpoint,
self.docker_registry_host, self.nms_url, self.nms_token, module_details, self.ref_data_base, self.kbase_endpoint,
prev_dev_version))
t.start()

Expand Down Expand Up @@ -1492,10 +1487,8 @@ def get_secure_config_params(self, username, params):

# NOT PART OF CLASS CATALOG!!
def _start_registration(params,registration_id, timestamp,username,is_admin,token, db, temp_dir, docker_base_url, docker_registry_host,
docker_push_allow_insecure,
nms_url, nms_admin_token, module_details, ref_data_base, kbase_endpoint, prev_dev_version):
registrar = Registrar(params, registration_id, timestamp, username, is_admin,token, db, temp_dir, docker_base_url, docker_registry_host,
docker_push_allow_insecure,
registrar = Registrar(params, registration_id, timestamp, username, is_admin,token, db, temp_dir, docker_base_url, docker_registry_host,
nms_url, nms_admin_token, module_details, ref_data_base, kbase_endpoint, prev_dev_version)
registrar.start_registration()

11 changes: 3 additions & 8 deletions lib/biokbase/catalog/registrar.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import subprocess
import yaml
from urlparse import urlparse
from docker import Client as DockerClient
from docker import APIClient as DockerClient
from docker.tls import TLSConfig as DockerTLSConfig

from biokbase.catalog.local_function_reader import LocalFunctionReader
Expand All @@ -26,7 +26,7 @@ class Registrar:
# params is passed in from the controller, should be the same as passed into the spec
# db is a reference to the Catalog DB interface (usually a MongoCatalogDBI instance)
def __init__(self, params, registration_id, timestamp, username, is_admin,token, db, temp_dir, docker_base_url,
docker_registry_host, docker_push_allow_insecure, nms_url, nms_admin_token, module_details,
docker_registry_host, nms_url, nms_admin_token, module_details,
ref_data_base, kbase_endpoint, prev_dev_version):
self.db = db
self.params = params
Expand All @@ -42,7 +42,6 @@ def __init__(self, params, registration_id, timestamp, username, is_admin,token,
self.temp_dir = temp_dir
self.docker_base_url = docker_base_url
self.docker_registry_host = docker_registry_host
self.docker_push_allow_insecure = docker_push_allow_insecure

self.nms_url = nms_url

Expand Down Expand Up @@ -564,11 +563,7 @@ def push_docker_image(self, docker_client, image_name):
#self.log(str(response_stream))

# to do: examine stream to determine success/failure of build
if self.docker_push_allow_insecure:
print("Docker push: insecure_registry: "+ str(self.docker_push_allow_insecure))
else:
print("Docker push: insecure_registry: None")
for lines in docker_client.push(image, tag=tag, stream=True, insecure_registry = self.docker_push_allow_insecure):
for lines in docker_client.push(image, tag=tag, stream=True):
for line in lines.strip().splitlines():
# example line:
#'{"status":"Pushing","progressDetail":{"current":32,"total":32},"progress":"[==================================================\\u003e] 32 B/32 B","id":"da200da4256c"}'
Expand Down
2 changes: 1 addition & 1 deletion scripts/register
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ VERSION
"""

import sys, os, traceback, time, subprocess
from docker import Client
from docker import APIClient
from docker import utils
import yaml
import string
Expand Down
3 changes: 1 addition & 2 deletions test/catalog_test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from pprint import pprint, pformat
from ConfigParser import ConfigParser
from pymongo import MongoClient
from docker import Client as DockerAPIClient
from docker import APIClient as DockerAPIClient


from biokbase.catalog.db import MongoCatalogDBI
Expand Down Expand Up @@ -73,7 +73,6 @@ def _setup_config(self):
'temp-dir':self.scratch_dir,
'docker-base-url':self.test_cfg['docker-base-url'],
'docker-registry-host':self.test_cfg['docker-registry-host'],
'docker-push-allow-insecure':self.test_cfg['docker-push-allow-insecure'],
'nms-url':self.test_cfg['nms-url'],
'nms-admin-user':self.test_cfg.get('nms-admin-user', ''),
'nms-admin-psswd':self.test_cfg.get('nms-admin-psswd', ''),
Expand Down
3 changes: 0 additions & 3 deletions test/test.cfg.example
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ mongodb-database = catalog-test
# Path to docker socket/host - you can leave this blank if you have the appropriate docker env variables defined
docker-base-url = unix://var/run/docker.sock

# temporary fix for travis- no longer needed
docker-push-allow-insecure = 0

# Narrative Method Store configuration. Please provide a token.
# If both are provided, the token is used.
nms-url = http://localhost:7125
Expand Down
2 changes: 1 addition & 1 deletion travis_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pymongo==2.8
docker-py
docker>=3.5
gitpython
pyyaml
semantic_version
Expand Down

0 comments on commit 5186404

Please sign in to comment.