launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #17990
[Merge] lp:~cjwatson/charms/trusty/turnip/api-server into lp:~canonical-launchpad-branches/charms/trusty/turnip/devel
Colin Watson has proposed merging lp:~cjwatson/charms/trusty/turnip/api-server into lp:~canonical-launchpad-branches/charms/trusty/turnip/devel.
Commit message:
Start the turnip API server. This requires installing python-pygit2 from the Launchpad PPA.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/charms/trusty/turnip/api-server/+merge/251305
Start the turnip API server, now that it's been split out from turnipserver.
This requires installing python-pygit2 from the Launchpad PPA, and will also only work once https://code.launchpad.net/~cjwatson/turnip/pastescript/+merge/251303 has been merged. Furthermore, I could only make this work by switching to "virtualenv --system-site-packages", along with disabling wheel support when building the pip cache because pkg_resources called from within pyramid is apparently unable to understand wheels and requires eggs. I don't think that the loss of isolation is important within a charm, since we're running within a contained environment anyway.
Once we go to production, I expect we'll want to use an IS-managed PPA rather than the Launchpad PPA, but this works for now.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/charms/trusty/turnip/api-server into lp:~canonical-launchpad-branches/charms/trusty/turnip/devel.
=== modified file 'Makefile'
--- Makefile 2015-02-27 15:28:32 +0000
+++ Makefile 2015-02-27 18:18:37 +0000
@@ -45,7 +45,7 @@
@echo "Updating python dependency cache..."
@sudo apt-get install -qq -y python-pip
@mkdir -p $(PIP_CACHE)
- @pip install --download $(PIP_CACHE) -r $(SOURCE_DIR)/requirements.txt
+ @pip install --no-use-wheel --download $(PIP_CACHE) -r $(SOURCE_DIR)/requirements.txt
check-rev:
=== modified file 'config.yaml'
--- config.yaml 2015-02-18 20:51:24 +0000
+++ config.yaml 2015-02-27 18:18:37 +0000
@@ -72,4 +72,18 @@
authentication_endpoint:
type: string
default: http://xmlrpc-private.launchpad.dev:8087/authserver
- description: XMLRPC auth
\ No newline at end of file
+ description: XMLRPC auth
+
+ # apt configuration used by charmhelpers.
+ install_sources:
+ type: string
+ default: |
+ - ppa:launchpad/ppa
+ description: |
+ YAML list of additional installation sources.
+ install_keys:
+ type: string
+ default: |
+ - null # PPA keys securely added via Launchpad.
+ description: |
+ YAML list of GPG keys for installation sources.
=== modified file 'hooks/actions.py'
--- hooks/actions.py 2015-02-16 00:30:29 +0000
+++ hooks/actions.py 2015-02-27 18:18:37 +0000
@@ -12,7 +12,7 @@
# Globals
CHARM_FILES_DIR = os.path.join(hookenv.charm_dir(), 'files')
-REQUIRED_PACKAGES = ['python-virtualenv', 'python-dev']
+REQUIRED_PACKAGES = ['python-virtualenv', 'python-dev', 'python-pygit2']
APP = config['app_name']
SRV_DIR = config['srv_dir']
USER = config['user']
@@ -71,7 +71,7 @@
pip_cache = os.path.join(CHARM_FILES_DIR, 'pip-cache')
requirements = os.path.join(SRV_DIR, 'requirements.txt')
- subprocess.call(['virtualenv', env_dir])
+ subprocess.call(['virtualenv', '--system-site-packages', env_dir])
for dirpath, dirname, files in os.walk(pip_cache):
if files:
hookenv.log('Installing from download cache.')
@@ -83,3 +83,5 @@
else:
subprocess.call(['%s/bin/pip' % env_dir,
'install', '-r', requirements])
+ subprocess.call(['%s/bin/pip' % env_dir,
+ 'install', '--no-deps', '-e', SRV_DIR])
=== modified file 'hooks/services.py'
--- hooks/services.py 2015-02-18 20:51:24 +0000
+++ hooks/services.py 2015-02-27 18:18:37 +0000
@@ -25,6 +25,11 @@
owner=config['user'],
perms=0o644),
helpers.render_template(
+ source='turnip-api.conf.j2',
+ target='/etc/init/turnip-api.conf',
+ owner=config['user'],
+ perms=0o644),
+ helpers.render_template(
source='turnip-app.j2',
target='/srv/deploymgr/turnip-app',
owner=config['user'],
=== added file 'templates/turnip-api.conf.j2'
--- templates/turnip-api.conf.j2 1970-01-01 00:00:00 +0000
+++ templates/turnip-api.conf.j2 2015-02-27 18:18:37 +0000
@@ -0,0 +1,16 @@
+description "Turnip git API server"
+author "Canonical Launchpad Team"
+
+setuid {{ user }}
+setgid {{ group }}
+
+env PYTHON_HOME=/srv/{{ app_name }}/env
+env PATH=$PYTHON_HOME/bin:$PATH
+
+start on started turnip
+stop on stopping turnip
+
+chdir /srv/{{ app_name }}
+exec $PYTHON_HOME/bin/envdir {{ env_dir }} $PYTHON_HOME/bin/pserve api.ini
+
+respawn