Skip to content
This repository was archived by the owner on Jun 30, 2024. It is now read-only.

Commit 2e5240e

Browse files
committed
Merge branch 'master' into docker_to_py10
2 parents 3e52379 + 780a330 commit 2e5240e

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

docker/.env.prototype

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
RUNESTONE_HOST=localhost
88

99
# Select a configuration for the instructor-facing server (the Runestone server) and the student-facing server (BookServer). Valid values are ``test``, ``development``, and ``production``.
10-
SERVER_CONFIG=development
10+
SERVER_CONFIG=production
11+
1112

1213
# For production, change the credentials for the DB to something more secure.
1314
# This should be done prior to first running ``docker/docker_tools.py up``.

docker/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ For the development use case, you do not need to modify any of the default envir
200200

201201
**OR**
202202

203-
For the production use case, you will need to modify these variables. To do so, edit the ``.env`` file, which Docker will read automatically as it loads containers. A sample ``.env`` file is provided as ``./.env`` (copied from `docker/.env.prototype <.env.prototype>` on the first build). See comments in the file for details.
203+
For the production use case, you will need to modify these variables. To do so, edit the ``.env`` file, which Docker will read automatically as it loads containers. A sample ``.env`` file is provided as ``./.env`` (copied from `docker/.env.prototype <.env.prototype>` on the first build). See comments in the file for details. Especially pay attention to the `SERVER_CONFIG` value. It defaults to `development` and you will need to change it to `production` if you do a `build --single` or just `build` defaults to single or `build --multi`.
204204

205205
Python Settings
206206
^^^^^^^^^^^^^^^

docker/docker_tools.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#
1818
# - Single-container: these commands creates a container designed to execute on a single server. The Dockerized applications associated with it include Jobe, Redis, and Postgres. A volume is used to persist data, such as updates to the server.
1919
#
20-
# - Production mode (the default): ``docker-tool build --single`` creates a container designed for production (which includes obtaining an HTTPS certificate).
20+
# - Production mode (the default): ``docker-tools build --single`` creates a container designed for production (which includes obtaining an HTTPS certificate).
2121
#
2222
# - Development mode: ``docker-tools build --single-dev`` creates a container supporting a development mode, which provides additional tools and installs the BookServer and Runestone Components from github, instead of from releases on PyPI.
2323
#
@@ -868,6 +868,7 @@ def _build_phase_1(
868868
# ``sphinxcontrib.paverutils.run_sphinx`` lacks venv support -- it doesn't use ``sys.executable``, so it doesn't find ``sphinx-build`` in the system path when executing ``/srv/venv/bin/runestone`` directly, instead of activating the venv first (where it does work). As a huge, ugly hack, symlink it to make it available in the system path.
869869
"ln -sf $RUNESTONE_PATH/.venv/bin/sphinx-build /usr/local/bin",
870870
# Deal with a different subdirectory layout inside the container (mandated by web2py) and outside the container by adding these symlinks.
871+
# TODO: should only do this in dev
871872
"ln -sf $BOOK_SERVER_PATH $WEB2PY_PATH/applications/BookServer",
872873
# We can't use ``$BOOK_SERVER_PATH`` here, since we need ``/srv/bookserver-dev`` in lowercase, not CamelCase.
873874
"ln -sf /srv/bookserver-dev $WEB2PY_PATH/applications/bookserver-dev",
@@ -1044,7 +1045,9 @@ def _build_phase_2_core(
10441045
xqt("rm -f $RUNESTONE_PATH/databases/*")
10451046
print("Populating database...")
10461047
xqt("rsmanage initdb --force", cwd=env.WEB2PY_PATH)
1047-
xqt("alembic stamp head", cwd=env.BOOK_SERVER_PATH)
1048+
# Should only use alembic in dev mode.
1049+
if build_config.is_dev():
1050+
xqt("alembic stamp head", cwd=env.BOOK_SERVER_PATH)
10481051
else:
10491052
print("Database already populated.")
10501053
# TODO: any checking to see if the db is healthy? Perhaps run Alembic autogenerate to see if it wants to do anything?

docker/docker_tools_misc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ def start_servers(dev: bool) -> None:
7373
def _start_servers(dev: bool) -> None:
7474
ensure_in_docker()
7575
bs_config = os.environ.get("BOOK_SERVER_CONFIG", "production")
76+
w2p_config = os.environ.get("WEB2PY_CONFIG", "production")
77+
if bs_config != w2p_config:
78+
raise ValueError("web2py and bookserver configs do not match")
79+
7680
if bs_config == "development":
7781
dev = True
7882

0 commit comments

Comments
 (0)