You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2020/10/12 21:21:43 UTC

[allura] 06/16: [#8378] docker and instructions use py3 and venv now

This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch db/8378
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 61ec6035a051bfc376dcaec86979c49a62de7b7d
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Tue Oct 6 18:15:21 2020 -0400

    [#8378] docker and instructions use py3 and venv now
---
 Allura/docs/getting_started/install_each_step.rst | 26 +++++++++++------------
 Allura/docs/getting_started/installation.rst      | 20 ++++++++++++-----
 Dockerfile                                        |  6 +++---
 scripts/init-docker-dev.sh                        |  6 +++---
 4 files changed, 34 insertions(+), 24 deletions(-)

diff --git a/Allura/docs/getting_started/install_each_step.rst b/Allura/docs/getting_started/install_each_step.rst
index eb2fd0d..3d0a49c 100644
--- a/Allura/docs/getting_started/install_each_step.rst
+++ b/Allura/docs/getting_started/install_each_step.rst
@@ -47,11 +47,11 @@ In these instructions, we'll use `VirtualBox <http://www.virtualbox.org>`__ and
 System Packages
 ^^^^^^^^^^^^^^^
 
-Before we begin, you'll need to install some system packages.
+Before we begin, you'll need to install some system packages.  Allura currently supports Python 2.7, 3.6 and 3.7.  Python 3.7 is recommended, support for Python 2.7 will likely be removed soon.
 
 .. code-block:: bash
 
-    ~$ sudo apt-get install git-core python2.7-dev libssl-dev libldap2-dev libsasl2-dev libjpeg8-dev zlib1g-dev libffi-dev
+    ~$ sudo apt-get install git-core python3-dev gcc libmagic1 libssl-dev libldap2-dev libsasl2-dev libjpeg8-dev zlib1g-dev libffi-dev
 
 To install MongoDB, follow the instructions `here <https://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/>`_.
 
@@ -59,30 +59,29 @@ Optional, for SVN support:
 
 .. code-block:: bash
 
-    ~$ sudo apt-get install subversion python-svn
+    ~$ sudo apt-get install subversion python3-svn
 
-Setting up a virtual python environment
+Setting up a python virtual environment
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-The first step to installing the Allura platform is installing a virtual environment via `virtualenv <https://virtualenv.pypa.io/en/latest/>`_.  This helps keep our distribution python installation clean.
+The first step to installing the Allura platform is installing a virtual environment via :code:`venv`.  This helps keep our distribution python installation clean.
 
 .. code-block:: bash
 
-    ~$ sudo apt-get install python-pip
-    ~$ sudo pip install virtualenv
+    ~$ sudo apt-get install python3-venv
 
-Once you have virtualenv installed, you need to create a virtual environment.  We'll call our Allura environment 'env-allura'.
+Then create a virtual environment.  We'll call our Allura environment 'env-allura'.
 
 .. code-block:: bash
 
-    ~$ virtualenv env-allura
+    ~$ python3 -m venv env-allura
 
 This gives us a nice, clean environment into which we can install all the allura dependencies.
 In order to use the virtual environment, you'll need to activate it:
 
 .. code-block:: bash
 
-    ~$ . env-allura/bin/activate
+    ~$ source env-allura/bin/activate
 
 You'll need to do this whenever you're working on the Allura codebase so you may want to consider adding it to your :file:`~/.bashrc` file.
 
@@ -107,20 +106,21 @@ Now we can get down to actually getting the Allura code and dependencies downloa
 
 If you already reading this file from an Allura release or checkout, you're ready to continue.
 
-Although the application :file:`setup.py` files define a number of dependencies, the :file:`requirements.txt` files are currently the authoritative source, so we'll use those with `pip <https://pip.pypa.io/en/stable/>`_ to make sure the correct versions are installed.
+We'll upgrade `pip <https://pip.pypa.io/en/stable/>`_ to make sure its a current version, and then install all Allura python dependencies with it.
 
 .. code-block:: bash
 
     (env-allura)~/src$ cd allura
+    (env-allura)~/src/allura$ pip install -U pip
     (env-allura)~/src/allura$ pip install -r requirements.txt
 
-This will take a while.  If you get an error from pip, it is typically a temporary download error.  Just run the command again and it will quickly pass through the packages it already downloaded and then continue.
+This may take a little while.
 
 Optional, for SVN support: symlink the system pysvn package into our virtual environment
 
 .. code-block:: bash
 
-    (env-allura)~/src/allura$ ln -s /usr/lib/python2.7/dist-packages/pysvn ~/env-allura/lib/python2.7/site-packages/
+    (env-allura)~/src/allura$ ln -s /usr/lib/python3/dist-packages/pysvn ~/env-allura/lib/python3.*/site-packages/
 
 Next, run this to set up all the Allura tools:
 
diff --git a/Allura/docs/getting_started/installation.rst b/Allura/docs/getting_started/installation.rst
index 92021a3..23c75bb 100644
--- a/Allura/docs/getting_started/installation.rst
+++ b/Allura/docs/getting_started/installation.rst
@@ -122,8 +122,7 @@ changes.
 
 Python environment:
 
-- :file:`/allura-data/env-docker/python`
-- :file:`/allura-data/env-docker/bin`
+- :file:`/allura-data/virtualenv/bin/python`
 
 Services data:
 
@@ -222,7 +221,8 @@ Change default configuration
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 The :file:`development.ini` file is geared towards development, so you will want to review
-carefully and make changes for production use.
+carefully and make changes for production use.  See also :file:`production-docker-example.ini` which sets a variety
+of settings better for production (you will always need to customize some values like keys and domains).
 
 Change `[handler_console]` section, so that logs go to a file and will include background tasks info.
 
@@ -269,7 +269,7 @@ If you'd like to use another webserver, here are a few options:
 .. code-block:: bash
 
     ~$ pip install mod_wsgi  # requires httpd2 devel libraries installed in the system
-    ~$ mod_wsgi-express start-server development.ini --application-type paste --user allura --group allura --port 8080  --python-path /PATH/TO/VIRTUALENV/lib/python2.7/site-packages/
+    ~$ mod_wsgi-express start-server development.ini --application-type paste --user allura --group allura --port 8080  --python-path /PATH/TO/VIRTUALENV/lib/python3.6/site-packages/
 
 For any other wsgi server (e.g. mod_wsgi with Apache, or waitress) you will need a wsgi callable set up like this:
 
@@ -297,7 +297,8 @@ Enabling inbound email
 ^^^^^^^^^^^^^^^^^^^^^^
 
 Allura can listen for email messages and update tools and artifacts.  For example, every ticket has an email address, and
-emails sent to that address will be added as comments on the ticket.  To set up the SMTP listener, run:
+emails sent to that address will be added as comments on the ticket.  With Docker, this is already running on port 8825.
+If you are not running docker, run:
 
 .. code-block:: bash
 
@@ -307,6 +308,15 @@ By default this uses port 8825.  Depending on your mail routing, you may need to
 And if the port is in use, this command will fail.  You can check the log file for any errors.
 To change the port number, edit :file:`development.ini` and change :samp:`forgemail.port` to the appropriate port number for your environment.
 
+You will need to customize your mail server to route mail for Allura to this service.  For example with postfix you can
+use :samp:`transport_maps` with::
+
+    mydomain.com smtp:127.0.0.1:8825
+    .mydomain.com smtp:127.0.0.1:8825
+    *.mydomain.com smtp:127.0.0.1:8825
+
+Various other settings may be necessary depending on your environment.
+
 SMTP in development
 ^^^^^^^^^^^^^^^^^^^
 
diff --git a/Dockerfile b/Dockerfile
index 7181616..f361e92 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -19,7 +19,7 @@ FROM ubuntu:18.04
 
 RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
     git-core \
-    python2.7-dev \
+    python3-dev \
     gcc \
     libmagic1 \
     libssl-dev \
@@ -27,10 +27,10 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins
     libsasl2-dev \
     libjpeg8-dev \
     zlib1g-dev \
-    python-pip \
+    python3-venv \
     zip \
     subversion \
-    python-svn \
+    python3-svn \
     curl \
     locales \
     sudo \
diff --git a/scripts/init-docker-dev.sh b/scripts/init-docker-dev.sh
index 3e75f21..f8dc856 100755
--- a/scripts/init-docker-dev.sh
+++ b/scripts/init-docker-dev.sh
@@ -38,9 +38,9 @@ echo "# No robots.txt rules here" > /allura-data/www-misc/robots.txt
 # share venv to allow update and sharing across containers
 if [ ! -e /allura-data/virtualenv ]; then
     echo -e "Creating virtualenv\n"
-    pip install 'virtualenv >= 20.0.8'  # https://github.com/pypa/virtualenv/issues/1684
-    virtualenv /allura-data/virtualenv
-    ln -s /usr/lib/python2.7/dist-packages/pysvn /allura-data/virtualenv/lib/python2.7/site-packages/
+    python3 -m venv /allura-data/virtualenv
+    /allura-data/virtualenv/bin/pip install -U pip
+    ln -s /usr/lib/python3/dist-packages/pysvn /allura-data/virtualenv/lib/python3.*/site-packages/
     echo # just a new line
 fi
 source /allura-data/virtualenv/bin/activate