From a04fa82a1472c694211d45eca324477ea0dca4de Mon Sep 17 00:00:00 2001 From: Taka Date: Wed, 25 Mar 2020 13:04:21 +0000 Subject: [PATCH] Updated some comments. --- Dockerfile | 5 +++-- asl_articles/__init__.py | 4 +--- run-containers.sh | 23 +++++++++++------------ 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index fe5e9c1..7cba40a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,8 @@ -# NOTE: psycopg2-binary won't install into Alpine because pg_config is missing, and to install that, -# we need a full development environment :-/ # We do a multi-stage build (requires Docker >= 17.05) to install everything, then copy it all # to the final target image. + +# NOTE: psycopg2-binary won't install into Alpine because pg_config is missing, and to install that, +# we need a full development environment :-/ # https://github.com/psycopg/psycopg2/issues/684 FROM python:alpine3.7 AS base diff --git a/asl_articles/__init__.py b/asl_articles/__init__.py index 443a50a..d486ad3 100644 --- a/asl_articles/__init__.py +++ b/asl_articles/__init__.py @@ -86,9 +86,7 @@ base_dir = os.path.join( BASE_DIR, ".." ) app = Flask( __name__ ) app.config.update( _cfg ) -# connect to the database -# NOTE: We assume that this web server will only be handling a single user. If we ever have -# multiple concurrent users, we will need to change to per-session database connections. +# initialize the database connection app.config[ "_IS_CONTAINER" ] = _cfg.get( "IS_CONTAINER" ) if _cfg.get( "IS_CONTAINER" ): # if we are running in a container, the database must be specified in an env variable e.g. diff --git a/run-containers.sh b/run-containers.sh index a3faa20..1e73da8 100755 --- a/run-containers.sh +++ b/run-containers.sh @@ -7,19 +7,18 @@ function print_help { echo "`basename "$0"` {options}" echo " Build and launch the \"asl-articles\" containers." echo - echo " -t --tag Docker container tag e.g. \"testing\" or \"latest\"." - echo " -d --dbconn Database connection string e.g." - echo " ~/asl-articles.db (path to a SQLite database)" - echo " postgresql://USER:PASS@host/dbname (database connection string)" - echo " Note that the database server address is relative to the container i.e. NOT \"localhost\"." - echo " -e --extdocs Base directory for external documents (to allow articles to link to them)." - echo " -u --user-files Base directory for user files." - echo " -r --aslrb Base URL for an eASLRB." + echo " -t --tag Docker container tag e.g. \"testing\" or \"latest\"." + echo " -d --dbconn Database connection string e.g." + echo " ~/asl-articles.db (path to a SQLite database)" + echo " postgresql://USER:PASS@host/dbname (database connection string)" + echo " Note that the database server address is relative to the container i.e. NOT \"localhost\"." + echo " --web-portno Webapp port number." + echo " --flask-portno Flask backend server port number." + echo " -e --extdocs Base directory for external documents (to allow articles to link to them)." + echo " -u --user-files Base directory for user files." + echo " -r --aslrb Base URL for an eASLRB." echo " -a --author-aliases Author aliases config file (see config/author-aliases.cfg.example)." - echo " --no-build Launch the containers as they are (i.e. without rebuilding them first)." - echo - echo " The TAG env variable can also be set to specify which containers to run e.g." - echo " TAG=testing `basename "$0"` /tmp/asl-articles.db" + echo " --no-build Launch the containers as they are (i.e. without rebuilding them first)." } # ---------------------------------------------------------------------