diff --git a/Changelog.md b/Changelog.md index 8c317b5..63a8c36 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,10 @@ +## 2.21.1 + +### Changes + +* Use python3 throughout (v3.5) +* Update to version 2.21.1 + ## 2.18.3 ### Changes diff --git a/Makefile b/Makefile index df21e2b..e001a1c 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ NAME = madharjan/docker-nginx-web2py -VERSION = 2.18.3 +VERSION = 2.21.1 DEBUG ?= true diff --git a/README.md b/README.md index ba664bf..0e87138 100644 --- a/README.md +++ b/README.md @@ -8,21 +8,23 @@ Docker container for Nginx with Web2py based on [madharjan/docker-nginx](https:/ ## Features * Environment variables to set admin password +* User-provided appconfig.ini file can be specified * Minimal (for production deploy) version of container `docker-nginx-web2py-min` for Web2py without `admin`, `example` and `welcome` * Bats [bats-core/bats-core](https://github.com/bats-core/bats-core) based test cases -## Nginx 1.10.3 & Web2py 2.18.3 (docker-nginx-web2py) +## Nginx 1.10.3 & Web2py 2.21.1 (docker-nginx-web2py) ### Environment -| Variable | Default | Example | -|----------------------|---------|--------------------------------------------------------------------------------------------| -| WEB2PY_ADMIN | | Pa55w0rd | -| DISABLE_UWSGI | 0 | 1 (to disable) | -| | | | -| INSTALL_PROJECT | 0 | 1 (to enable) | -| PROJECT_GIT_REPO | | [https://github.com/madharjan/web2py-contest](https://github.com/madharjan/web2py-contest) | -| PROJECT_GIT_TAG | HEAD | v5.1.4 | +| Variable | Default | Example | +|---------------------------|---------|--------------------------------------------------------------------------------------------| +| WEB2PY_ADMIN | | Pa55w0rd | +| DISABLE_UWSGI | 0 | 1 (to disable) | +| | | | +| INSTALL_PROJECT | 0 | 1 (to enable) | +| PROJECT_GIT_REPO | | [https://github.com/madharjan/web2py-contest](https://github.com/madharjan/web2py-contest) | +| PROJECT_GIT_TAG | HEAD | v5.1.4 | +| PROJECT_APPCONFIG_INI_PATH| | /etc/appconfig.ini | ## Build @@ -60,7 +62,7 @@ docker run -d \ -v /opt/docker/web2py/applications:/opt/web2py/applications \ -v /opt/docker/web2py/log:/var/log/nginx \ --name web2py \ - madharjan/docker-nginx-web2py:2.18.5 + madharjan/docker-nginx-web2py:2.21.1 # run container # Web2py Minimal @@ -70,7 +72,7 @@ docker run -d \ -v /opt/docker/web2py/applications:/opt/web2py/applications \ -v /opt/docker/web2py/log:/var/log/nginx \ --name web2py \ - madharjan/docker-nginx-web2py-min:2.18.5 + madharjan/docker-nginx-web2py-min:2.21.1 ``` ## Systemd Unit File @@ -90,7 +92,7 @@ ExecStartPre=-/bin/mkdir -p /opt/docker/web2py/applications ExecStartPre=-/bin/mkdir -p /opt/docker/web2py/log ExecStartPre=-/usr/bin/docker stop web2py ExecStartPre=-/usr/bin/docker rm web2py -ExecStartPre=-/usr/bin/docker pull madharjan/docker-nginx-web2py:2.18.5 +ExecStartPre=-/usr/bin/docker pull madharjan/docker-nginx-web2py:2.21.1 ExecStart=/usr/bin/docker run \ -e WEB2PY_ADMIN=Pa55w0rd \ @@ -98,7 +100,7 @@ ExecStart=/usr/bin/docker run \ -v /opt/docker/web2py/applications:/opt/web2py/applications \ -v /opt/docker/web2py/log:/var/log/nginx \ --name web2py \ - madharjan/docker-nginx-web2py:2.18.5 + madharjan/docker-nginx-web2py:2.21.1 ExecStop=/usr/bin/docker stop -t 2 web2py @@ -121,22 +123,29 @@ WantedBy=multi-user.target | PROJECT_GIT_REPO | | [https://github.com/madharjan/web2py-contest](https://github.com/madharjan/web2py-contest) | | PROJECT_GIT_TAG | HEAD | v1.0 | -### With deploy web projects +### To deploy web projects ```bash docker run --rm \ -e PORT=80 \ -e VOLUME_HOME=/opt/docker \ - -e VERSION=2.18.5 \ + -e VERSION=2.21.1 \ -e WEB2PY_ADMIN=Pa55w0rd \ -e WEB2PY_MIN=false \ -e INSTALL_PROJECT=1 \ -e PROJECT_GIT_REPO=https://github.com/madharjan/web2py-contest.git \ -e PROJECT_GIT_TAG=HEAD \ - madharjan/docker-nginx-web2py-min:2.18.5 \ + madharjan/docker-nginx-web2py-min:2.21.1 \ web2py-systemd-unit | \ sudo tee /etc/systemd/system/web2py.service sudo systemctl enable web2py sudo systemctl start web2py ``` + +note that some projects may require an bespoke appconfig.ini file, e.g. to specify +a database to be used with this docker instance. This can be done by mounting +a fine in your docker image at (e.g.) /etc/appconfig.ini, then setting +PROJECT_APPCONFIG_INI_PATH to this file path, from where it will be moved into +the `private` directory of your web2py project, overwriting any existing +appconfig.ini file in there. \ No newline at end of file diff --git a/bin/web2py-setpass b/bin/web2py-setpass index f4d32b3..83b79c7 100644 --- a/bin/web2py-setpass +++ b/bin/web2py-setpass @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys from gluon.main import save_password; diff --git a/bin/web2py-systemd-unit b/bin/web2py-systemd-unit index 9a3d582..e924d60 100755 --- a/bin/web2py-systemd-unit +++ b/bin/web2py-systemd-unit @@ -6,13 +6,14 @@ if [ "${DEBUG}" = true ]; then set -x fi -VERSION=2.18.3 +VERSION=2.21.1 DEF_PORT=80 DEF_VOLUME_HOME=/opt/docker DEF_NAME=web2py DEF_INSTALL_PROJECT=0 DEF_PROJECT_GIT_REPO= +DEF_PROJECT_APPCONFIG_INI_PATH= DEF_PROJECT_GIT_TAG= DEF_WEB2PY_ADMIN= @@ -24,6 +25,7 @@ NAME=${NAME:-$DEF_NAME} INSTALL_PROJECT=${INSTALL_PROJECT:-$DEF_INSTALL_PROJECT} PROJECT_GIT_REPO=${PROJECT_GIT_REPO:-$DEF_PROJECT_GIT_REPO} +PROJECT_APPCONFIG_INI_PATH=${PROJECT_APPCONFIG_INI_PATH:-$DEF_PROJECT_APPCONFIG_INI_PATH} PROJECT_GIT_TAG=${PROJECT_GIT_TAG:-$DEF_PROJECT_GIT_TAG} WEB2PY_ADMIN=${WEB2PY_ADMIN:-$DEF_WEB2PY_ADMIN} diff --git a/scripts/install.sh b/scripts/install.sh index 84c3995..2728659 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -18,19 +18,19 @@ cp ${NGINX_CONFIG_PATH}/default-web2py.conf /config/etc/nginx-web2py/conf.d/defa /build/services/uwsgi/uwsgi.sh apt-get install -y --no-install-recommends git-core -pip install gitpython +pip3 install gitpython ## Install Web2py mkdir -p /opt/tmp cd /opt/tmp -git clone https://github.com/web2py/web2py.git --depth 1 --branch R-2.18.3 --single-branch web2py +git clone https://github.com/web2py/web2py.git --depth 1 --branch v2.21.1 --single-branch web2py cd web2py git submodule update --init --recursive cd ../../ if [ "${WEB2PY_MIN}" == true ]; then cd tmp/web2py - python scripts/make_min_web2py.py ../../tmp/web2py-min + python3 scripts/make_min_web2py.py ../../tmp/web2py-min mv ../../tmp/web2py-min ../../web2py cd ../../ else diff --git a/services/16-project.sh b/services/16-project.sh index d3b65d8..9c17424 100644 --- a/services/16-project.sh +++ b/services/16-project.sh @@ -16,7 +16,10 @@ if [ ! "${INSTALL_PROJECT}" -eq 0 ]; then mkdir -p /opt/web2py/applications/${FOLDER} rsync -avh --remove-source-files --delete /var/www/html/* /opt/web2py/applications/${FOLDER}/ find . -type d -empty -delete - + # If an alterative appconfig.ini file has been provided via an env var, use that + if [ -n "${PROJECT_APPCONFIG_INI_PATH}" ]; then + cp "${PROJECT_APPCONFIG_INI_PATH}" "/opt/web2py/applications/${FOLDER}/private/appconfig.ini" + fi fi fi diff --git a/services/uwsgi/uwsgi.ini b/services/uwsgi/uwsgi.ini index 4d41cf1..e35bf0d 100644 --- a/services/uwsgi/uwsgi.ini +++ b/services/uwsgi/uwsgi.ini @@ -16,5 +16,5 @@ reload-on-rss = 192 uid = www-data gid = www-data touch-reload = /opt/web2py/routes.py -cron = 0 0 -1 -1 -1 python /opt/web2py/web2py.py -Q -S welcome -M -R scripts/sessions2trash.py -A -o +cron = 0 0 -1 -1 -1 python3 /opt/web2py/web2py.py -Q -S welcome -M -R scripts/sessions2trash.py -A -o no-orphans = true diff --git a/services/uwsgi/uwsgi.sh b/services/uwsgi/uwsgi.sh index 0e27619..c59606a 100755 --- a/services/uwsgi/uwsgi.sh +++ b/services/uwsgi/uwsgi.sh @@ -9,17 +9,18 @@ fi UWSGI_BUILD_PATH=/build/services/uwsgi -## Install Nginx. +## Install uwsgi. apt-get install -y --no-install-recommends \ build-essential \ libxml2-dev \ - python-dev \ - python-pip \ + python3-dev \ + python3-pip \ unzip \ rsync -pip install setuptools --upgrade -PIPPATH=`which pip` +PIPPATH=`which pip3` +$PIPPATH install --upgrade "pip < 21.0" +$PIPPATH install setuptools --upgrade $PIPPATH install wheel $PIPPATH install --upgrade uwsgi