You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/10/19 13:37:49 UTC

[24/50] [abbrv] allura git commit: Docker & doc fixes for node, pwd, etc

Docker & doc fixes for node, pwd, etc

Revert changes to WORKDIR in Allura/Dockerfile from recent broccoli/jsx setup
commits.  Its needed to have the 'web' container start in the root folder, so
`pip` command etc works.

Update docs to take advantage of the 'taskd' container starting in Allura
subdir so paster commands can run without "bash -c 'cd ...'" stuff.

Use newest version of node/npm to avoid symlink errors when installing
npm packages within a VM shared mount.

Add instructions for running administrative commands within docker.  Add
success logging at end of create-neighborhood so that some thread widget
errors don't make people think that command failed.


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/a1aab220
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/a1aab220
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/a1aab220

Branch: refs/heads/ib/7924
Commit: a1aab2208a37d3a32ed6639650eedcd5325dccaf
Parents: 0323078
Author: Dave Brondsema <da...@brondsema.net>
Authored: Mon Oct 5 13:38:39 2015 -0400
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Mon Oct 5 13:38:39 2015 -0400

----------------------------------------------------------------------
 Allura/allura/command/create_neighborhood.py   |  5 +++++
 Allura/docs/getting_started/administration.rst |  4 ++++
 Allura/docs/getting_started/installation.rst   | 20 +++++++++++++-------
 Dockerfile                                     | 13 +++++++++----
 docker-compose.yml                             |  8 ++++----
 5 files changed, 35 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/a1aab220/Allura/allura/command/create_neighborhood.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/create_neighborhood.py b/Allura/allura/command/create_neighborhood.py
index db79bb0..d099c46 100644
--- a/Allura/allura/command/create_neighborhood.py
+++ b/Allura/allura/command/create_neighborhood.py
@@ -15,6 +15,8 @@
 #       specific language governing permissions and limitations
 #       under the License.
 
+import logging
+
 from . import base
 
 from ming.orm import session
@@ -23,6 +25,8 @@ from bson import ObjectId
 from allura import model as M
 from allura.lib import plugin, exceptions
 
+log = logging.getLogger(__name__)
+
 
 class CreateNeighborhoodCommand(base.Command):
     min_args = 3
@@ -44,6 +48,7 @@ class CreateNeighborhoodCommand(base.Command):
                           google_analytics=False))
         project_reg = plugin.ProjectRegistrationProvider.get()
         project_reg.register_neighborhood_project(n, admins)
+        log.info('Successfully created neighborhood "{}"'.format(shortname))
 
 
 class UpdateNeighborhoodCommand(base.Command):

http://git-wip-us.apache.org/repos/asf/allura/blob/a1aab220/Allura/docs/getting_started/administration.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/getting_started/administration.rst b/Allura/docs/getting_started/administration.rst
index 1571cb6..8673840 100644
--- a/Allura/docs/getting_started/administration.rst
+++ b/Allura/docs/getting_started/administration.rst
@@ -76,6 +76,10 @@ Scripts are in the `scripts/` directory and run slightly differently, via `paste
 
      paster script development.ini ../scripts/create-allura-sitemap.py -- -u 100
 
+To run these when using docker, prefix with :code:`docker-compose run web` and use :code:`docker-dev.ini` like::
+
+    docker-compose run taskd paster create-neighborhood docker-dev.ini myneighborhood myuser ...
+
 Tasks can be run via the web interface at http://MYSITE/nf/admin/task_manager  You must know
 the full task name, e.g. :code:`allura.tasks.admin_tasks.install_app`  You can
 optionally provide a username and project and app which will get set on the

http://git-wip-us.apache.org/repos/asf/allura/blob/a1aab220/Allura/docs/getting_started/installation.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/getting_started/installation.rst b/Allura/docs/getting_started/installation.rst
index 026da99..e180ac3 100644
--- a/Allura/docs/getting_started/installation.rst
+++ b/Allura/docs/getting_started/installation.rst
@@ -182,12 +182,12 @@ Allura uses a background task service called "taskd" to do async tasks like send
 A few more steps, if using git
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-If you're using a released version of Allura, these are already done for you.  This transpiles JS into a version all browsers support:
+If you're using a released version of Allura, these are already done for you.  This transpiles JS into a version all browsers support.
+For non-Ubuntu installations see https://nodejs.org/en/download/package-manager/ for other options to replace the first line here:
 
 .. code-block:: bash
 
-    (env-allura)~$ sudo aptitude install nodejs npm
-    (env-allura)~$ sudo ln -s /usr/bin/nodejs /usr/bin/node
+    (env-allura)~$ curl --silent --location https://deb.nodesource.com/setup_4.x | sudo bash -
     (env-allura)~$ cd ~/src/allura
     (env-allura)~$ npm install -g broccoli-cli
     (env-allura)~$ npm install
@@ -256,7 +256,7 @@ Build/fetch all required images (run these in allura source directory):
 
     docker-compose build
 
-Install requirements:
+Install requirements (and first containers started):
 
 .. code-block:: bash
 
@@ -272,11 +272,11 @@ Initialize database with test data:
 
 .. code-block:: bash
 
-    docker-compose run web bash -c 'cd Allura && paster setup-app docker-dev.ini'
+    docker-compose run taskd paster setup-app docker-dev.ini
 
 .. note::
 
-   If you want to skip test data creation you can instead run: :code:`docker-compose run web bash -c 'cd Allura && ALLURA_TEST_DATA=False paster setup-app docker-dev.ini'`
+   If you want to skip test data creation you can instead run: :code:`docker-compose run -e ALLURA_TEST_DATA=False taskd paster setup-app docker-dev.ini`
 
 Start containers in the background:
 
@@ -284,9 +284,15 @@ Start containers in the background:
 
     docker-compose up -d
 
-You're up and running!  Visit localhost:8080 or on a Mac or Windows, whatever IP address Docker Toolbox is using.  Then
+You're up and running!  Visit localhost:8080, or on a Mac or Windows whatever IP address Docker Toolbox is using.  Then
 see our :ref:`post-setup-instructions` and read more below about the Docker environment for Allura.
 
+.. note::
+
+   If running from git source, it will take a few minutes during the first time running "up", to set up JS build tools
+   before the webapp is actually running on port 8080.  Watch the progress with :code:`docker-compose logs web`.
+
+
 Containers
 ^^^^^^^^^^
 

http://git-wip-us.apache.org/repos/asf/allura/blob/a1aab220/Dockerfile
----------------------------------------------------------------------
diff --git a/Dockerfile b/Dockerfile
index f125d55..f91dd98 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -30,8 +30,13 @@ RUN apt-get update && apt-get install -y \
     zip \
     subversion \
     python-svn \
-    npm
-RUN ln -s /usr/bin/nodejs /usr/bin/node
+    curl
+
+# up-to-date version of node & npm
+RUN curl --silent --location https://deb.nodesource.com/setup_4.x | sudo bash - && \
+    apt-get install --yes nodejs
+
+# only do the global installation here.  All local packages are installed in the docker-compose.yml command, since they need the shared mount
 RUN npm install -g broccoli-cli
 
 # Snapshot generation for SVN (and maybe other SCMs) might fail without this
@@ -42,5 +47,5 @@ ENV LANG en_US.UTF-8
 # tests). If this is not set, it uses os.getlogin, which fails inside docker.
 ENV USER root
 
-WORKDIR /allura/Allura
-CMD gunicorn --paste docker-dev.ini --reload
+WORKDIR /allura
+CMD gunicorn --paste Allura/docker-dev.ini --reload

http://git-wip-us.apache.org/repos/asf/allura/blob/a1aab220/docker-compose.yml
----------------------------------------------------------------------
diff --git a/docker-compose.yml b/docker-compose.yml
index faac4a4..5eaaf4c 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -17,16 +17,16 @@
 
 web:
   build: .
-  working_dir: /allura
-  # specialized command (and working_dir) to run broccoli
+  # specialized command to run broccoli
   # since it depends on files from the shared volume, it can't be run as part of the Dockerfile build :(
+  # and --no-bin-links necessary when Virtualbox is used since shared mount can't handle symlinks
   command: >
     sh -c '
     if [ ! -e Allura/allura/public/nf/js/build/transpiled.js ]; then
-      npm install &&
+      npm install --no-bin-links --loglevel http &&
       npm run build;
     fi;
-    gunicorn --paste Allura/docker-dev.ini --reload
+    gunicorn --paste Allura/docker-dev.ini --reload;
     '
   ports:
     - "8080:8080"