diff --git a/.docker-registry.metadata b/.docker-registry.metadata new file mode 100644 index 0000000..ff41afd --- /dev/null +++ b/.docker-registry.metadata @@ -0,0 +1 @@ +ad9ce8889d4507ac89884d2abb4f392963c913a0 SOURCES/docker-registry-097381d.tar.gz diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ce0971 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/docker-registry-097381d.tar.gz diff --git a/README.md b/README.md deleted file mode 100644 index ce46a88..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -\ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/Support-for-older-Redis-Python-binding.patch b/SOURCES/Support-for-older-Redis-Python-binding.patch new file mode 100644 index 0000000..60a8db8 --- /dev/null +++ b/SOURCES/Support-for-older-Redis-Python-binding.patch @@ -0,0 +1,25 @@ +From 8167153cc069eacd041b0b0d6bb19150f291d881 Mon Sep 17 00:00:00 2001 +From: Marek Goldmann +Date: Thu, 21 Nov 2013 11:12:22 +0100 +Subject: [PATCH] Support for older Redis Python binding + +--- + lib/cache.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/cache.py b/lib/cache.py +index 4b0f93d..534eb55 100644 +--- a/lib/cache.py ++++ b/lib/cache.py +@@ -29,7 +29,7 @@ def init(): + for k, v in cache.iteritems(): + redis_opts[k] = v + logging.info('Redis config: {0}'.format(redis_opts)) +- redis_conn = redis.StrictRedis(host=redis_opts['host'], ++ redis_conn = redis.Redis(host=redis_opts['host'], + port=int(redis_opts['port']), + db=int(redis_opts['db']), + password=redis_opts['password']) +-- +1.8.5.3 + diff --git a/SOURCES/docker-registry.service b/SOURCES/docker-registry.service new file mode 100644 index 0000000..394bc0f --- /dev/null +++ b/SOURCES/docker-registry.service @@ -0,0 +1,13 @@ +[Unit] +Description=Registry server for Docker + +[Service] +Type=simple +Environment=DOCKER_REGISTRY_CONFIG=/etc/docker-registry.yml +EnvironmentFile=-/etc/sysconfig/docker-registry +WorkingDirectory=#WORKDIR# +ExecStart=/usr/bin/gunicorn --access-logfile - --debug --max-requests 100 --graceful-timeout 3600 -t 3600 -k gevent -b ${REGISTRY_ADDRESS}:${REGISTRY_PORT} -w $GUNICORN_WORKERS docker_registry.wsgi:application +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/SOURCES/docker-registry.sysconfig b/SOURCES/docker-registry.sysconfig new file mode 100644 index 0000000..3f9374c --- /dev/null +++ b/SOURCES/docker-registry.sysconfig @@ -0,0 +1,14 @@ +# The Docker registry configuration file +# DOCKER_REGISTRY_CONFIG=/etc/docker-registry.yml + +# The configuration to use from DOCKER_REGISTRY_CONFIG file +SETTINGS_FLAVOR=local + +# Address to bind the registry to +REGISTRY_ADDRESS=0.0.0.0 + +# Port to bind the registry to +REGISTRY_PORT=5000 + +# Number of workers to handle the connections +GUNICORN_WORKERS=8 diff --git a/SOURCES/docker-registry.sysvinit b/SOURCES/docker-registry.sysvinit new file mode 100644 index 0000000..832a933 --- /dev/null +++ b/SOURCES/docker-registry.sysvinit @@ -0,0 +1,117 @@ +#!/bin/sh +# +# /etc/rc.d/init.d/docker-registry +# +# Registry server for Docker +# +# chkconfig: 2345 93 93 +# description: Registry server for Docker + +### BEGIN INIT INFO +# Provides: docker-registry +# Required-Start: $network +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: start and stop Docker registry +# Description: Registry server for Docker +### END INIT INFO + +# Source function library. +. /etc/rc.d/init.d/functions + +exec="/usr/bin/python" +prog="docker-registry" +pidfile="/var/run/$prog.pid" +lockfile="/var/lock/subsys/$prog" +logfile="/var/log/$prog" + +[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +export DOCKER_REGISTRY_CONFIG=${DOCKER_REGISTRY_CONFIG:-"/etc/docker-registry.yml"} +export SETTINGS_FLAVOR=${SETTINGS_FLAVOR:-"dev"} + +start() { + [ -x $exec ] || exit 5 + + if ! [ -f $pidfile ]; then + cd #WORKDIR# + printf "Starting $prog:\t" + $exec /usr/bin/gunicorn --access-logfile - --debug --max-requests 100 --graceful-timeout 3600 -t 3600 -k gevent -b ${REGISTRY_ADDRESS}:${REGISTRY_PORT} -w $GUNICORN_WORKERS wsgi:application &>> $logfile & + pid=$! + echo $pid > $pidfile + touch $lockfile + success + echo + else + failure + echo + printf "$pidfile still exists...\n" + exit 7 + fi +} + +stop() { + echo -n $"Stopping $prog: " + killproc -p $pidfile $prog + retval=$? + echo + [ $retval -eq 0 ] && rm -f $lockfile + return $retval +} + +restart() { + stop + start +} + +reload() { + restart +} + +force_reload() { + restart +} + +rh_status() { + status -p $pidfile $prog +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + +case "$1" in + start) + rh_status_q && exit 0 + $1 + ;; + stop) + rh_status_q || exit 0 + $1 + ;; + restart) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; + status) + rh_status + ;; + condrestart|try-restart) + rh_status_q || exit 0 + restart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" + exit 2 +esac + +exit $? diff --git a/SPECS/docker-registry.spec b/SPECS/docker-registry.spec new file mode 100644 index 0000000..2791fe1 --- /dev/null +++ b/SPECS/docker-registry.spec @@ -0,0 +1,205 @@ +%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} + +%if 0%{?fedora} >= 19 || 0%{?rhel} >= 7 +%bcond_without systemd +%endif + +%global commit 097381d336017ba772dffd439e316120b639ffbd +%global shortcommit %(c=%{commit}; echo ${c:0:7}) + +Summary: Registry server for Docker +Name: docker-registry +Version: 0.6.8 +Release: 8%{?dist} +License: ASL 2.0 +URL: https://github.com/dotcloud/docker-registry +Source: https://github.com/lsm5/docker-registry/archive/%{commit}/docker-registry-%{shortcommit}.tar.gz +Source1: docker-registry.service +Source2: docker-registry.sysconfig +Source3: docker-registry.sysvinit + +# Support for older Redis Python binding in EPEL +Patch0: Support-for-older-Redis-Python-binding.patch + +BuildRequires: python2-devel + +%if %{with systemd} +BuildRequires: systemd +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +%else +Requires(post): chkconfig +Requires(preun): chkconfig +Requires(postun): initscripts +%endif + +Requires: m2crypto +Requires: PyYAML +Requires: python-requests +Requires: python-gunicorn +Requires: python-gevent +Requires: python-blinker +Requires: python-backports-lzma +Requires: python-jinja2 +Requires: python-flask + +BuildArch: noarch + +%description +Registry server for Docker (hosting/delivering of repositories and images). + +%prep +%setup -q -n docker-registry-%{commit} + +# Remove the golang implementation +# It's not the main one (yet?) +rm -rf contrib/golang_impl + +%if !%{with systemd} +%patch0 -p1 +%endif + +%install +install -d %{buildroot}%{_bindir} +install -d %{buildroot}%{_sysconfdir}/sysconfig +install -d %{buildroot}%{_sharedstatedir}/%{name} +install -d %{buildroot}%{python_sitelib}/%{name} + +install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{name} + +%if %{with systemd} +install -d %{buildroot}%{_unitdir} +install -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service + +# Make sure we set proper WorkingDir in the systemd service file +sed -i "s|#WORKDIR#|%{python_sitelib}/%{name}|" %{buildroot}%{_unitdir}/%{name}.service +%else +install -d %{buildroot}%{_initddir} +install -p -m 755 %{SOURCE3} %{buildroot}%{_initddir}/%{name} + +# Make sure we set proper wrking dir in the sysvinit file +sed -i "s|#WORKDIR#|%{python_sitelib}/%{name}|" %{buildroot}%{_initddir}/%{name} +%endif + +cp -r docker_registry test %{buildroot}%{python_sitelib}/%{name} +#cp wsgi.py %{buildroot}%{python_sitelib}/%{name} +cp config/config_sample.yml %{buildroot}%{_sysconfdir}/%{name}.yml + +echo "local: + storage: local + storage_path: %{_sharedstatedir}/%{name}" >> %{buildroot}%{_sysconfdir}/%{name}.yml + +%post +%if %{with systemd} +%systemd_post %{name}.service +%else +/sbin/chkconfig --add %{name} +%endif + +%preun +%if %{with systemd} +%systemd_preun %{name}.service +%else +if [ $1 -eq 0 ] ; then + /sbin/service %{name} stop >/dev/null 2>&1 + /sbin/chkconfig --del %{name} +fi +%endif + +%postun +%if %{with systemd} +%systemd_postun_with_restart %{name}.service +%else +if [ "$1" -ge "1" ] ; then + /sbin/service %{name} condrestart >/dev/null 2>&1 || : +fi +%endif + +%files +%dir %{python_sitelib}/%{name} +%config(noreplace) %{_sysconfdir}/sysconfig/%{name} +%config(noreplace) %{_sysconfdir}/%{name}.yml +%{python_sitelib}/%{name}/docker_registry/*.py +%{python_sitelib}/%{name}/docker_registry/*.pyc +%{python_sitelib}/%{name}/docker_registry/*.pyo +%{python_sitelib}/%{name}/docker_registry/lib/*.py +%{python_sitelib}/%{name}/docker_registry/lib/*.pyc +%{python_sitelib}/%{name}/docker_registry/lib/*.pyo +%{python_sitelib}/%{name}/docker_registry/lib/index/*.py +%{python_sitelib}/%{name}/docker_registry/lib/index/*.pyc +%{python_sitelib}/%{name}/docker_registry/lib/index/*.pyo +%{python_sitelib}/%{name}/docker_registry/storage/*.py +%{python_sitelib}/%{name}/docker_registry/storage/*.pyc +%{python_sitelib}/%{name}/docker_registry/storage/*.pyo +%{python_sitelib}/%{name}/test/*.py +%{python_sitelib}/%{name}/test/*.pyc +%{python_sitelib}/%{name}/test/*.pyo +%{python_sitelib}/%{name}/test/Dockerfile +%{python_sitelib}/%{name}/test/dockertest.sh +%{python_sitelib}/%{name}/test/utils/*.py +%{python_sitelib}/%{name}/test/utils/*.pyc +%{python_sitelib}/%{name}/test/utils/*.pyo +%dir %{_sharedstatedir}/%{name} +%doc LICENSE README.md +%if %{with systemd} +%{_unitdir}/%{name}.service +%else +%{_initddir}/%{name} +%endif + +%changelog +* Tue May 06 2014 Lokesh Mandvekar - 0.6.8-8 +- import lzma if no backports.lzma + +* Fri May 02 2014 Lokesh Mandvekar - 0.6.8-7 +- do not complain if redis absent + +* Wed Apr 30 2014 Lokesh Mandvekar - 0.6.8-6 +- import json if simplejson fails + +* Wed Apr 30 2014 Lokesh Mandvekar - 0.6.8-5 +- Add python-flask to requires + +* Tue Apr 29 2014 Lokesh Mandvekar - 0.6.8-4 +- remove python-simplejson runtime requirement + +* Tue Apr 29 2014 Lokesh Mandvekar - 0.6.8-3 +- remove redis requirement from unitfile + +* Wed Apr 23 2014 Lokesh Mandvekar - 0.6.8-2 +- M2Crypto branch used: https://github.com/lsm5/docker-registry/tree/m2crypto +- Built for RHEL7 + +* Fri Apr 18 2014 Marek Goldmann - 0.6.8-1 +- Upstream release 0.6.8 + +* Mon Apr 07 2014 Marek Goldmann - 0.6.6-2 +- docker-registry settings in /etc/sysconfig/docker-registry not honored, + RHBZ#1072523 + +* Thu Mar 20 2014 Marek Goldmann - 0.6.6-1 +- Upstream release 0.6.6 +- docker-registry cannot import module jinja2, RHBZ#1077630 + +* Mon Feb 17 2014 Marek Goldmann - 0.6.5-1 +- Upstream release 0.6.5 + +* Tue Jan 07 2014 Marek Goldmann - 0.6.3-1 +- Upstream release 0.6.3 +- Added python-backports-lzma and python-rsa to R +- Removed configuration file path patch, it's in upstream + +* Fri Dec 06 2013 Marek Goldmann - 0.6.0-4 +- Docker-registry does not currently support moving the config file, RHBZ#1038874 + +* Mon Dec 02 2013 Marek Goldmann - 0.6.0-3 +- EPEL support +- Comments in the sysconfig/docker-registry file + +* Wed Nov 27 2013 Marek Goldmann - 0.6.0-2 +- Added license and readme + +* Wed Nov 20 2013 Marek Goldmann - 0.6.0-1 +- Initial packaging +