Skip to content

Commit 8ed90ff

Browse files
committed
Updated Vagrant documentation
1 parent 33011ac commit 8ed90ff

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

arca/backend/vagrant.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ class VagrantBackend(DockerBackend):
2424
* **disable_pull**
2525
* **inherit_image**
2626
* **use_registry_name**
27-
* **keep_containers_running** - applies for containers inside the VM, default is ``True`` here.
27+
* **keep_containers_running** - applies for containers inside the VM, default being ``True`` for this backend
2828
2929
Adds new settings:
3030
3131
* **box** - what Vagrant box to use (must include docker >= 1.8 or no docker), ``ailispaw/barge`` being the default
3232
* **provider** - what provider should Vagrant user, ``virtualbox`` being the default
3333
* **quiet** - Keeps the extra vagrant logs quiet, ``True`` being the default
34-
* **keep_vm_running** - Keeps the VM up until ``stop_vm`` is called, ``False`` being the default
34+
* **keep_vm_running** - Keeps the VM up until :meth:`stop_vm` is called, ``False`` being the default
3535
* **destroy** - Destroy the VM (instead of halt) when stopping it, ``False`` being the default
3636
3737
"""
@@ -71,7 +71,7 @@ def __init__(self, **kwargs):
7171
self.vagrant: vagrant.Vagrant = None
7272

7373
def inject_arca(self, arca):
74-
""" Creates log file for this instance.
74+
""" Apart from the usual validation stuff it also creates log file for this instance.
7575
"""
7676
super().inject_arca(arca)
7777

@@ -282,6 +282,8 @@ def run(self, repo: str, branch: str, task: Task, git_repo: Repo, repo_path: Pat
282282
self.vagrant.halt()
283283

284284
def stop_containers(self):
285+
""" Raises an exception in this backend, can't be used. Stop the entire VM instead.
286+
"""
285287
raise ValueError("Can't be used here, stop the entire VM instead.")
286288

287289
def stop_vm(self):

docs/backends.rst

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,16 @@ Vagrant
141141

142142
*arca.backend.VagrantBackend*
143143

144-
**This backend might be reworked completely, consider its API unstable.**
145-
146-
If you're extra paranoid you can use Vagrant to completely isolate the tasks.
144+
If you're extra paranoid you can use Vagrant to completely isolate the runtime in a Virtual Machine (VM).
147145
This backend is actually a subclass of ``DockerBackend`` and uses docker in the VM to run the tasks.
148-
Currently the backend works by building the image with requirements and dependencies locally and pushing it to registry
149-
(``push_to_registry_name`` is required), spinning up a VM for each repository,
150-
pulling the image in the VM and running the task. Docker and Vagrant must be runnable by the current user.
146+
Docker and Vagrant must be runnable by the current user.
147+
148+
The backend works by building the image with requirements and dependencies locally and pushing it to registry using ``use_to_registry_name``.
149+
Then a VM is launched and the image is pulled there from the registry.
150+
This takes some time when first launching the VM, but if the VM is reused often, the upload/download time is shorted.
151+
The built images are also not lost when the VM is destroyed.
151152

152-
The backend inherits all the settings of ``DockerBackend`` except
153-
for ``keep_container_running`` and has these extra settings:
153+
The backend inherits all the settings of ``DockerBackend`` (**keep_containers_running** is by default ``True``) has these extra settings:
154154

155155
* **box**: Vagrant box used in the VM. Either has to have docker version >= 1.8 or not have docker at all, in which case
156156
it will be installed when spinning up the VM.
@@ -160,8 +160,10 @@ for ``keep_container_running`` and has these extra settings:
160160
* **quiet**: Tells Vagrant and Fabric (which is used to run the task in the VM) to be quiet. Default is ``True``.
161161
Vagrant and Docker output is logged in separate files for each run in a folder ``logs`` in the :class:`Arca <arca.Arca>` ``base_dir``.
162162
The filename is logged in the arca logger (see bellow)
163-
* **destroy**: Destroy the VM right after the task is finished if ``True`` (default).
164-
If ``False`` is set, the VM is only halted.
163+
* **keep_vm_running**: Should the VM be kept up once a task finishes? By default ``False``.
164+
If set to ``True``, :meth:`stop_vm <arca.VagrantBackend.stop_vm>` can be used to stop the VM.
165+
* **destroy**: When stopping the VM (either after a task or after :meth:`stop_vm` is called), should the VM be destroyed (= deleted) or just halted?
166+
``False`` by default.
165167

166168
(possible settings prefixes: ``ARCA_VAGRANT_BACKEND_`` and ``ARCA_BACKEND_``)
167169

0 commit comments

Comments
 (0)