From 9b61b0d8f757ba8bb5d3b299d4c7ff3edb7994bd Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Mon, 8 Jun 2015 10:33:20 +0200 Subject: [PATCH] new: [pypi-cacher] added pypi cacher. --- .../etc/devpi-server/devpi-server-log.yml | 21 +++++++++++ .../etc/devpi-server/devpi-server.service | 17 +++++++++ precise/pypi-cacher/hooks/install | 37 +++++++++++++++++++ precise/pypi-cacher/hooks/start | 7 ++++ precise/pypi-cacher/hooks/stop | 3 ++ precise/pypi-cacher/metadata.yaml | 15 ++++++++ precise/pypi-cacher/revision | 1 + 7 files changed, 101 insertions(+) create mode 100644 precise/pypi-cacher/etc/devpi-server/devpi-server-log.yml create mode 100644 precise/pypi-cacher/etc/devpi-server/devpi-server.service create mode 100755 precise/pypi-cacher/hooks/install create mode 100755 precise/pypi-cacher/hooks/start create mode 100755 precise/pypi-cacher/hooks/stop create mode 100644 precise/pypi-cacher/metadata.yaml create mode 100644 precise/pypi-cacher/revision diff --git a/precise/pypi-cacher/etc/devpi-server/devpi-server-log.yml b/precise/pypi-cacher/etc/devpi-server/devpi-server-log.yml new file mode 100644 index 0000000..eee73fa --- /dev/null +++ b/precise/pypi-cacher/etc/devpi-server/devpi-server-log.yml @@ -0,0 +1,21 @@ +version: 1 +formatters: + simpleFormater: + format: '%(asctime)s - %(levelname)s: %(message)s' + datefmt: '%Y/%m/%d %H:%M:%S' + +handlers: + file: + class : logging.FileHandler + formatter: simpleFormater + level: WARNING + filename: /var/log/devpi-server/main.log + +loggers: + flogger: + level: WARNING + handlers: [file] + +root: + level: DEBUG + handlers: [file] diff --git a/precise/pypi-cacher/etc/devpi-server/devpi-server.service b/precise/pypi-cacher/etc/devpi-server/devpi-server.service new file mode 100644 index 0000000..0cd2ce2 --- /dev/null +++ b/precise/pypi-cacher/etc/devpi-server/devpi-server.service @@ -0,0 +1,17 @@ +[Unit] +Description=DevPi Server +After=network-online.target +Requires=network-online.target + +[Service] +TimeoutStartSec=0 +Type=forking +#PIDFile=/var/run/devpi-server.pid +Restart=always +ExecStart=/usr/local/bin/devpi-server --host 0.0.0.0 --port 3142 --serverdir=/var/lib/devpi-server --logger-cfg=/etc/devpi-server/devpi-server-log.yml --start +ExecStop=/usr/local/bin/devpi-server --host 0.0.0.0 --port 3142 --serverdir=/var/lib/devpi-server --logger-cfg=/etc/devpi-server/devpi-server-log.yml --stop +#User=devpi + +[Install] +WantedBy=multi-user.target + diff --git a/precise/pypi-cacher/hooks/install b/precise/pypi-cacher/hooks/install new file mode 100755 index 0000000..364e6f1 --- /dev/null +++ b/precise/pypi-cacher/hooks/install @@ -0,0 +1,37 @@ +#!/bin/bash + +set -eux + +apt-get install -y --force-yes python-pip + +pip install devpi-server + +# cat <> /etc/init/devpi-server.conf + +# # this script will start/stop DevPI Server +# description "DevPI server" +# version "1.0" +# author "Valentin Lab" + +# chdir /root +# exec devpi-server --start --host 0.0.0.0 --port 3142 + +# EOF + +cp -a etc/devpi-server/* /etc/devpi-server + +mkdir /var/{lib,log}/devpi-server -p + +systemctl enable /etc/devpi-server/devpi-server.service + + +## This is needed to enable https_port +#apt-get install devscripts build-essential +#apt-get install libssl-dev ## not in build-dep ... because we'll add it. +#apt-get source squid3 +#apt-get build-dep squid3 +#cd squid3-3.1.19 +#vim debian/rules # or whatever editor you use +# add --enable-ssl +#debuild -us -uc + diff --git a/precise/pypi-cacher/hooks/start b/precise/pypi-cacher/hooks/start new file mode 100755 index 0000000..88e357a --- /dev/null +++ b/precise/pypi-cacher/hooks/start @@ -0,0 +1,7 @@ +#!/bin/bash + +## XXX: will need to add route: + +route add -net VPN_NET gw LXC_NAME + +juju-log "Nothing to Start for base." diff --git a/precise/pypi-cacher/hooks/stop b/precise/pypi-cacher/hooks/stop new file mode 100755 index 0000000..170162b --- /dev/null +++ b/precise/pypi-cacher/hooks/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +juju-log "Nothing to stop for base." diff --git a/precise/pypi-cacher/metadata.yaml b/precise/pypi-cacher/metadata.yaml new file mode 100644 index 0000000..4f3d8fc --- /dev/null +++ b/precise/pypi-cacher/metadata.yaml @@ -0,0 +1,15 @@ +name: pypi-cacher +summary: "PyPI Caching Server" +maintainer: "Valentin Lab " +inherit: base-0k +description: | + PyPI Caching Server +data-resources: + - /var/lib/devpi-server + - /var/log/devpi-server +config-resources: + - /etc/devpi-server +docker: + entrypoimt: '["/usr/local/bin/devpi-server", "--host=0.0.0.0", "--port=3142", "--start"]' + expose: 3142 + diff --git a/precise/pypi-cacher/revision b/precise/pypi-cacher/revision new file mode 100644 index 0000000..573541a --- /dev/null +++ b/precise/pypi-cacher/revision @@ -0,0 +1 @@ +0