You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 30, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: docker/README.rst
+67-22Lines changed: 67 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ Docker Deployment
3
3
4
4
.. TODO
5
5
6
-
Docs to update:
6
+
Is there some way to simplify these instructions? It's still a long, error-prone process! Do we need another setup script that follows these directions and prompts the user for input (do you want to run the server or do development? What is your github userid? Etc.)? Such a script would be able to take care of the first 7 steps, which would be good progress. But, we'd need os-dependent stuff for the first bits (install WSL/Ubuntu on Windows); can we assume Python 3 on Mac?
7
7
8
8
Enable the script to download and install the Docker Desktop if necessary.
9
9
@@ -60,6 +60,8 @@ If running on OS X, install then run the `Docker Desktop <https://www.docker.com
60
60
61
61
Expect to wait a few minutes the first time you start the Docker Desktop. Don't proceed until the Docker Desktop's initialization is complete.
@@ -89,15 +91,55 @@ Next, install ``curl`` by opening an Ubuntu terminal then typing:
89
91
90
92
sudo apt-get install -y curl
91
93
92
-
2. Run the bootstrap script
93
-
***************************
94
+
2. Download the bootstrap script
95
+
********************************
96
+
To keep your filesystem tidy, create a directory before running the following commands, since these commands download several scripts and subdirectories. To do this:
97
+
98
+
.. code-block:: bash
99
+
100
+
mkdir rsdocker
101
+
cd rsdocker
102
+
103
+
.. note::
104
+
105
+
On OS X, avoid placing your files in the Documents folder, since security features introduced in OS X 12.4 require you to give Docker `additional permissions <https://support.apple.com/guide/mac-help/control-access-to-files-and-folders-on-mac-mchld5a35146/mac>`_.
106
+
94
107
Next, download the bootstrap script. To do this, open a terminal in Ubuntu or OS X then type:
This download the bootstrap script. The next step, which installs required dependencies for the remainder of the process, depends on the two mutually exclusive use cases below. **Remember which use case you select**; many of the following steps vary based on your use case.
113
+
This downloads the bootstrap script.
114
+
115
+
116
+
3. Create then activate a Python virtual environment
A Python virtual environment ensures that all the Python dependencies installed by this process don't interfere with your global / system Python installation.
119
+
120
+
#. `Create a Python virtual environment <https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment>`_ named ``rsvenv`` (RuneStone Virtual ENVironment):
121
+
122
+
.. code-block:: bash
123
+
124
+
python3 -m venv rsvenv
125
+
126
+
#. `Activate the virtual environment <https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#activating-a-virtual-environment>`_ you just created.
127
+
128
+
On Windows:
129
+
130
+
.. code-block:: bash
131
+
132
+
rsvenv\Scripts\activate
133
+
134
+
On Linux and OS X:
135
+
136
+
.. code-block:: bash
137
+
138
+
. rsvenv/bin/activate
139
+
140
+
4. Run the bootstrap script
141
+
***************************
142
+
The next step, which installs required dependencies for the remainder of the process, depends on the two mutually exclusive use cases below. **Remember which use case you select**; many of the following steps vary based on your use case.
101
143
102
144
Use case: running the server
103
145
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -109,11 +151,11 @@ For the use case of running the server, execute:
109
151
110
152
**OR**
111
153
112
-
Use case: change the way Runestone works or change/add to the way `interactive exercises <https://pretextbook.org/doc/guide/html/topic-interactive-exercises.html>`_ behave
154
+
Use case: in addition to running the server, change the way Runestone works or change/add to the way `interactive exercises <https://pretextbook.org/doc/guide/html/topic-interactive-exercises.html>`_ behave
#. `Fork <https://docs.github.com/en/get-started/quickstart/fork-a-repo>`_ the `RunestoneServer <https://github.com/RunestoneInteractive/RunestoneServer.git>`_, `RunestoneComponents <https://github.com/RunestoneInteractive/RunestoneComponents.git>`_, and `BookServer <https://github.com/RunestoneInteractive/BookServer.git>`_ repositories.
158
+
#. `Fork <https://docs.github.com/en/get-started/quickstart/fork-a-repo>`_ the `RunestoneServer <https://github.com/RunestoneInteractive/RunestoneServer.git>`_, `RunestoneComponents <https://github.com/RunestoneInteractive/RunestoneComponents.git>`_, and `BookServer <https://github.com/RunestoneInteractive/BookServer.git>`_ repositories. If you've already forked these repositories, `fetch the latest updates from these upstream repositories <https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork>`_.
117
159
118
160
#. In the terminal, run:
119
161
@@ -125,7 +167,7 @@ For the developer use case:
125
167
126
168
On Windows using Ubuntu under WSL2: if you see the error message "Docker Desktop not detected..." but you are running the Docker Desktop, then click the gear (settings) icon in Docker Desktop, select Resources then WSL Integration, and make sure the switch next to Ubuntu is turned on.
127
169
128
-
3. Build the necessary containers
170
+
5. Build the necessary containers
129
171
*********************************
130
172
In the terminal, type:
131
173
@@ -141,10 +183,6 @@ The next command depends on the use case you chose in the previous step.
141
183
142
184
Pre-build
143
185
^^^^^^^^^
144
-
.. warning::
145
-
146
-
On OS X, use ``python3 -m docker_tools`` instead of ``docker-tools`` in the following instructions. Likewise, use ``python3 -m rsmanage`` instead of ``rsmanage``.
147
-
148
186
For the use case of running the server, execute:
149
187
150
188
.. code-block:: bash
@@ -169,9 +207,11 @@ The build will take a **long** time (5-10 minutes in many cases). When this comp
169
207
170
208
#. **Reboot your computer** to update your group membership.
171
209
#. Run the Docker Desktop if using WSL on Windows or using OS X.
172
-
#. Open a terminal then ``cd RunestoneServer``.
210
+
#. Open a terminal then ``cd rsvenv``.
211
+
#. Activate your virtual environment -- see the second step of `create a virtual environment <Create then activate a Python virtual environment>`_.
212
+
#. ``cd RunestoneServer``.
173
213
174
-
4. Configuration
214
+
6. Configuration
175
215
***********************
176
216
177
217
Most basic configuration can be done via two files you will need to create. These files
@@ -201,7 +241,7 @@ For the use case of running the server, you will need to modify these settings t
201
241
You will NOT want to check either ``.env`` or ``models/1.py`` into source control, since these contain passwords. The ``.gitignore`` file is set to ignore both of them.
202
242
203
243
204
-
5. Starting the containerized application
244
+
7. Starting the containerized application
205
245
*****************************************
206
246
207
247
Pre-start
@@ -229,7 +269,7 @@ For the developer use case, execute:
229
269
230
270
Post-start
231
271
^^^^^^^^^^
232
-
The first time you run the command will take a **lot** longer as it downloads containers then installs software into the various containers. You may ignore a red message about the Jobe container. After it is complete, you can go to http://localhost/ to see the application (if you configured a hostname, substitute it for localhost). If everything so far is set up correctly, you should see a welcome/login page. Continue in the instructions to add book(s), course(s) and a user account.
272
+
The first time you run the command will take a **lot** longer as it downloads containers then installs software into the various containers. You may ignore the red message ``jobe error`` that appears during this process. After it is complete, you can go to http://localhost/ to see the application (if you configured a hostname, substitute it for localhost). If everything so far is set up correctly, you should see a welcome/login page. Continue in the instructions to add book(s), course(s) and a user account.
233
273
234
274
Introducing ``rsmanage``
235
275
^^^^^^^^^^^^^^^^^^^^^^^^
@@ -244,7 +284,7 @@ The ``rsmanage`` command will run many useful commands inside the container for
244
284
...and many other things. Just type ``rsmanage`` for a list of things it can do. For a list of options just type ``rsmanage`` and the subcommand you want followed by ``--help``; for example, ``rsmanage build --help``.
245
285
246
286
247
-
6. Add books
287
+
8. Add books
248
288
**************************
249
289
250
290
No books are installed by default; you must add books using the following process. To add a book, you need to add its source code to the ``RunestoneServer/books/`` directory. Typically, that means cloning its source code. For example, to add
@@ -278,7 +318,7 @@ The following information applies only *authoring* books using the Runestone.
278
318
If you are running docker on a remote host then make sure to set it to the name of the remote host.
279
319
280
320
281
-
7. Add courses
321
+
9. Add courses
282
322
**************************
283
323
284
324
To add a course based on a book, run the ``rsmanage addcourse`` script. If you run it just like
@@ -311,7 +351,7 @@ You do not have to restart the server to make use of the course.
311
351
a course with a name like ``thinkcspy`` you will be told that the course name is the same as the book.
312
352
313
353
314
-
8. Add a user
354
+
10. Add a user
315
355
**************************
316
356
317
357
To add an initial instructor account to the course you have created, you can either create a new user or add
@@ -338,7 +378,7 @@ Once you have logged in as an instructor, you can bulk add students through the
338
378
It is also possible to use a csv file to add multiple instructors or students as you start
339
379
up the server. However, this process is brittle (any error loading the information results
340
380
in the server entering a restart loop as it fails to load). To do so, make a file named either
341
-
`instructors.csv` or `students.csv` in a folder called `configs` in the RunestoneServer folder.
381
+
`instructors.csv` or `students.csv` in a folder called `configs` in the ``RunestoneServer/`` folder.
342
382
The format of the csv files is to have one person per line with the format of each line as follows:
343
383
344
384
username,email,first_name,last_name,pw,course
@@ -351,6 +391,12 @@ Operation
351
391
---------
352
392
The containerized application is configured to automatically start as soon as Docker / the Docker Desktop is started. Therefore, on OS X or Windows (when using WSL2): after a reboot or after manually shutting down the Docker Desktop, **remember to start the Docker Desktop application**.
353
393
394
+
Before using ``docker-tools`` or ``rsmanage``:
395
+
396
+
#. Open a terminal then ``cd rsdocker``.
397
+
#. Activate your virtual environment -- see the second step of `create a virtual environment <Create then activate a Python virtual environment>`_.
398
+
#. ``cd RunestoneServer``.
399
+
354
400
355
401
Other Tips & Tricks
356
402
-------------------------------
@@ -381,14 +427,13 @@ Shelling Inside
381
427
**********************************
382
428
383
429
You can shell into the container to look around, or otherwise test. When you enter,
384
-
you'll be in the web2py folder, where runestone is an application under applications. From
385
-
the RunestoneServer directory do:
430
+
you'll be in the web2py folder, where ``runestone/`` is an application under ``applications/``. From the ``RunestoneServer/`` directory do:
386
431
387
432
.. code-block:: bash
388
433
389
434
docker-tools shell
390
435
391
-
Remember that the folder under web2pyapplications/runestone is bound to your host,
436
+
Remember that the folder under ``web2py/applications/runestone`` is bound to your host,
392
437
so **do not edit files from inside the container** otherwise they will have a change
0 commit comments