grim/containers/reviewboard

Parents 7576aed722c6
Children 275f5a519e79
Turn this repo into a fork of the old base repository but rebase it on debian:buster
  • +34 -1
    Dockerfile
  • +22 -0
    LICENSE
  • +5 -3
    README.md
  • +7 -0
    shell.sh
  • +70 -0
    start.sh
  • +26 -0
    upgrade-site.py
  • +16 -0
    uwsgi.ini
  • --- a/Dockerfile Wed Jul 01 05:02:57 2020 -0500
    +++ b/Dockerfile Sat Oct 10 06:53:04 2020 -0500
    @@ -1,5 +1,38 @@
    -FROM ikatson/reviewboard:latest
    +FROM debian:buster-slim
    +MAINTAINER grim@reaperworld.com
    +
    +ENV RB_VERSION 3.0.18
    +
    +# install the dependencies for reviewboard
    +RUN apt-get update -y && \
    + apt-get install --no-install-recommends -y \
    + build-essential python-dev libffi-dev libssl-dev patch \
    + python-pip python-setuptools python-wheel python-virtualenv \
    + uwsgi uwsgi-plugin-python \
    + postgresql-client \
    + python-psycopg2 python-ldap \
    + git-core mercurial subversion python-svn \
    + && \
    + apt-get clean && \
    + rm -rf /var/lib/apt/lists/*
    +# install reviewboard
    +RUN set -ex && \
    + python -m virtualenv --system-site-packages /opt/venv && \
    + . /opt/venv/bin/activate && \
    + pip install "ReviewBoard==${RB_VERSION}" django-storages==1.1.8 oauthlib==1.0.1 semver && \
    + rm -rf /root/.cache
    +
    +# additional housekeeping
    +ENV PATH="/opt/venv/bin:${PATH}"
    +
    +COPY start.sh uwsgi.ini shell.sh upgrade-site.py /
    +
    +EXPOSE 8000
    +
    +CMD ["/start.sh"]
    +
    +# install rbjbhub
    RUN set -e && \
    . /opt/venv/bin/activate && \
    set -x && \
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/LICENSE Sat Oct 10 06:53:04 2020 -0500
    @@ -0,0 +1,22 @@
    +The MIT License (MIT)
    +
    +Copyright (c) 2014 Igor Katson
    +Copyright (c) 2020 Gary Kramlich <grim@reaperworld.com>
    +
    +Permission is hereby granted, free of charge, to any person obtaining a copy
    +of this software and associated documentation files (the "Software"), to deal
    +in the Software without restriction, including without limitation the rights
    +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    +copies of the Software, and to permit persons to whom the Software is
    +furnished to do so, subject to the following conditions:
    +
    +The above copyright notice and this permission notice shall be included in
    +all copies or substantial portions of the Software.
    +
    +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    +THE SOFTWARE.
    --- a/README.md Wed Jul 01 05:02:57 2020 -0500
    +++ b/README.md Sat Oct 10 06:53:04 2020 -0500
    @@ -1,6 +1,8 @@
    # rwgrim/reviewboard
    -This container image is based on docker.io/ikatson/reviewboard. It adds a few
    -additional plugins namely rbjbhub and is deployed on
    -[reviews.imfreedom.org](https://reviews.imfreedom.org).
    +This container image was originally based on docker.io/ikatson/reviewboard.
    +It is now a fork so that it can be updated going forward.
    +It adds a few additional plugins to reviewboard, namely rbjbhub and is deployed
    +on [reviews.imfreedom.org](https://reviews.imfreedom.org).
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/shell.sh Sat Oct 10 06:53:04 2020 -0500
    @@ -0,0 +1,7 @@
    +#!/bin/bash
    +
    +cd /var/www/reviewboard/conf
    +
    +export PYTHONPATH=./
    +export DJANGO_SETTINGS_MODULE=reviewboard.settings
    +exec django-admin.py shell
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/start.sh Sat Oct 10 06:53:04 2020 -0500
    @@ -0,0 +1,70 @@
    +#!/bin/bash
    +PGUSER="${PGUSER:-reviewboard}"
    +PGPASSWORD="${PGPASSWORD:-reviewboard}"
    +PGDB="${PGDB:-reviewboard}"
    +
    +# Get these variables either from PGPORT and PGHOST, or from
    +# linked "pg" container.
    +PGPORT="${PGPORT:-$( echo "${PG_PORT_5432_TCP_PORT:-5432}" )}"
    +PGHOST="${PGHOST:-$( echo "${PG_PORT_5432_TCP_ADDR:-127.0.0.1}" )}"
    +
    +# Get these variable either from MEMCACHED env var, or from
    +# linked "memcached" container.
    +MEMCACHED_LINKED_NOTCP="${MEMCACHED_PORT#tcp://}"
    +MEMCACHED="${MEMCACHED:-$( echo "${MEMCACHED_LINKED_NOTCP:-127.0.0.1}" )}"
    +
    +DOMAIN="${DOMAIN:localhost}"
    +
    +if [[ "${WAIT_FOR_POSTGRES}" = "true" ]]; then
    +
    + echo "Waiting for Postgres readiness..."
    + export PGUSER PGHOST PGPORT PGPASSWORD
    +
    + until psql "${PGDB}"; do
    + echo "Postgres is unavailable - sleeping"
    + sleep 1
    + done
    + echo "Postgres is up!"
    +
    +fi
    +
    +if [[ "${SITE_ROOT}" ]]; then
    + if [[ "${SITE_ROOT}" != "/" ]]; then
    + # Add trailing and leading slashes to SITE_ROOT if it's not there.
    + SITE_ROOT="${SITE_ROOT#/}"
    + SITE_ROOT="/${SITE_ROOT%/}/"
    + fi
    +else
    + SITE_ROOT=/
    +fi
    +
    +mkdir -p /var/www/
    +
    +CONFFILE=/var/www/reviewboard/conf/settings_local.py
    +
    +if [[ ! -d /var/www/reviewboard ]]; then
    + rb-site install --noinput \
    + --domain-name="$DOMAIN" \
    + --site-root="$SITE_ROOT" \
    + --static-url=static/ --media-url=media/ \
    + --db-type=postgresql \
    + --db-name="$PGDB" \
    + --db-host="$PGHOST" \
    + --db-user="$PGUSER" \
    + --db-pass="$PGPASSWORD" \
    + --cache-type=memcached --cache-info="$MEMCACHED" \
    + --web-server-type=lighttpd --web-server-port=8000 \
    + --admin-user=admin --admin-password=admin --admin-email=admin@example.com \
    + /var/www/reviewboard/
    +fi
    +
    +/upgrade-site.py /var/www/reviewboard/rb-version /var/www/reviewboard
    +
    +if [[ "${DEBUG}" ]]; then
    + sed -i 's/DEBUG *= *False/DEBUG=True/' "$CONFFILE"
    + cat "${CONFFILE}"
    +fi
    +
    +export SITE_ROOT
    +
    +exec uwsgi --ini /uwsgi.ini
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/upgrade-site.py Sat Oct 10 06:53:04 2020 -0500
    @@ -0,0 +1,26 @@
    +#!/usr/bin/env python
    +
    +import sys
    +import subprocess
    +import semver
    +import reviewboard
    +
    +
    +def main(version_file, site_folder):
    + running_version = reviewboard.get_version_string()
    +
    + try:
    + with open(version_file) as f:
    + previous_version = f.readline().strip()
    + except IOError:
    + previous_version = "0.0.0"
    +
    + if semver.compare(running_version, previous_version) == 1:
    + print("ReviewBoard upgrade detected, performing rb-site upgrade")
    + subprocess.check_call(["rb-site", "upgrade", site_folder])
    + with open(version_file, 'w') as f:
    + f.write(running_version)
    +
    +
    +if __name__ == "__main__":
    + main(*sys.argv[1:])
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/uwsgi.ini Sat Oct 10 06:53:04 2020 -0500
    @@ -0,0 +1,16 @@
    +[uwsgi]
    +plugin=python,http
    +home=/opt/venv/
    +die-on-term=
    +env=DJANGO_SETTINGS_MODULE=reviewboard.settings
    +pymodule-alias=settings_local=/var/www/reviewboard/conf/settings_local.py
    +module = django.core.handlers.wsgi:WSGIHandler()
    +master=true
    +http=:8000
    +static-map=$(SITE_ROOT)static=/var/www/reviewboard/htdocs/static
    +static-map=$(SITE_ROOT)media=/var/www/reviewboard/htdocs/media
    +static-map=$(SITE_ROOT)errordocs=/var/www/reviewboard/htdocs/errordocs
    +static-safe=/opt/venv/lib/python2.7/site-packages/
    +enable-threads=true
    +processes=%k
    +buffer-size=8192