Skip to content

Commit 0a52f25

Browse files
committed
Merge branch 'development' into release
2 parents 89a8ab2 + 20eb1a8 commit 0a52f25

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+716
-205
lines changed

.gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@ machines/
44
roles/thydel.patch/
55
roles/yaegashi.blockinfile/
66
docs/_build/
7-
docs/graphs/*.pdf
7+
docs/images/graphs/*.pdf
8+
docs/images/graphs/*.png
9+
10+
*.aux
11+
*.log
12+
*.synctex.gz

Makefile

+33-6
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,59 @@
11
# This makefile is the user interface to jobs that the user may wish to carry
22
# out using virtual machines.
33

4+
## Container targets
5+
full-container:
6+
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=container container_name=full playbook=provision_virtualmicromagnetics_full.yml hookbook=hook_container.yml extra_resources_dir=guest_resources/"
7+
8+
lite-container:
9+
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=container container_name=lite playbook=provision_virtualmicromagnetics_lite.yml hookbook=hook_container.yml extra_resources_dir=guest_resources/"
10+
11+
oommf-container:
12+
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=container container_name=oommf playbook=provision_virtualmicromagnetics_oommf.yml hookbook=hook_container.yml extra_resources_dir=guest_resources/"
13+
14+
magpar-container:
15+
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=container container_name=magpar playbook=provision_virtualmicromagnetics_magpar.yml hookbook=hook_container.yml extra_resources_dir=guest_resources/"
16+
17+
nmag-container:
18+
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=container container_name=nmag playbook=provision_virtualmicromagnetics_nmag.yml hookbook=hook_container.yml extra_resources_dir=guest_resources/"
19+
20+
fidimag-container:
21+
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=container container_name=fidimag playbook=provision_virtualmicromagnetics_fidimag.yml hookbook=hook_container.yml extra_resources_dir=guest_resources/"
22+
23+
## VM targets
24+
full-vm: full
25+
lite-vm: lite
26+
oommf-vm: oommf
27+
magpar-vm: magpar
28+
nmag-vm: nmag
29+
fidimag-vm: fidimag
30+
431
# This target builds a virtual hard disk file containing various open
532
# micromagnetics simulation technologies and other convenient packages.
633
full:
7-
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="vm_name=virtualmicromagnetics-full playbook=provision_virtualmicromagnetics_full.yml hookbook=hook.yml extra_resources_dir=guest_resources/"
34+
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=vm vm_name=virtualmicromagnetics-full playbook=provision_virtualmicromagnetics_full.yml hookbook=hook_vm.yml extra_resources_dir=guest_resources/"
835

936
# This target builds a virtual hard disk file containing various open
1037
# micromagnetics simulation technologies.
1138
lite:
12-
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="vm_name=virtualmicromagnetics-lite playbook=provision_virtualmicromagnetics_lite.yml hookbook=hook.yml extra_resources_dir=guest_resources/"
39+
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=vm vm_name=virtualmicromagnetics-lite playbook=provision_virtualmicromagnetics_lite.yml hookbook=hook_vm.yml extra_resources_dir=guest_resources/"
1340

1441
# This target builds a virtual hard disk file containing an OOMMF
1542
# installation.
1643
oommf:
17-
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="vm_name=virtualmicromagnetics-oommf playbook=provision_virtualmicromagnetics_oommf.yml hookbook=hook.yml extra_resources_dir=guest_resources/"
44+
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=vm vm_name=virtualmicromagnetics-oommf playbook=provision_virtualmicromagnetics_oommf.yml hookbook=hook_vm.yml extra_resources_dir=guest_resources/"
1845

1946
# This target builds a virtual hard disk file containing a Magpar
2047
# installation.
2148
magpar:
22-
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="vm_name=virtualmicromagnetics-magpar playbook=provision_virtualmicromagnetics_magpar.yml hookbook=hook.yml extra_resources_dir=guest_resources/"
49+
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=vm vm_name=virtualmicromagnetics-magpar playbook=provision_virtualmicromagnetics_magpar.yml hookbook=hook_vm.yml extra_resources_dir=guest_resources/"
2350

2451
# This target builds a virtual hard disk file containing a Nmag
2552
# installation.
2653
nmag:
27-
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="vm_name=virtualmicromagnetics-nmag playbook=provision_virtualmicromagnetics_nmag.yml hookbook=hook.yml extra_resources_dir=guest_resources/"
54+
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=vm vm_name=virtualmicromagnetics-nmag playbook=provision_virtualmicromagnetics_nmag.yml hookbook=hook_vm.yml extra_resources_dir=guest_resources/"
2855

2956
# This target builds a virtual hard disk file containing a fidimag
3057
# installation.
3158
fidimag:
32-
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="vm_name=virtualmicromagnetics-fidimag playbook=provision_virtualmicromagnetics_fidimag.yml hookbook=hook.yml extra_resources_dir=guest_resources/"
59+
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=vm vm_name=virtualmicromagnetics-fidimag playbook=provision_virtualmicromagnetics_fidimag.yml hookbook=hook_vm.yml extra_resources_dir=guest_resources/"

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Welcome to the Virtual Micromagnetics project repository!
1+
Welcome to the Virtual Micromagnetics project repository! [![DOI](https://zenodo.org/badge/19288/computationalmodelling/virtualmicromagnetics.svg)](https://zenodo.org/badge/latestdoi/19288/computationalmodelling/virtualmicromagnetics)
22

33
Provided by Mark Vousden, Hans Fangohr, and others at the University of Southampton. Funded by EPSRC's DTC grant EP/G03690X/1.
44

docs/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@
6060
# built documents.
6161
#
6262
# The short X.Y version.
63-
version = u'1.0.2'
63+
version = u'1.0.4'
6464
# The full version, including alpha/beta/rc tags.
65-
release = u'1.0.2'
65+
release = u'1.0.4'
6666

6767
# The language for content autogenerated by Sphinx. Refer to documentation
6868
# for a list of supported languages.

docs/container-software.rst

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
.. _container-software:
2+
3+
Containers and Related Software
4+
===============================
5+
6+
In :ref:`getting-started-user`, we created a :term:`container` in addition to a
7+
:term:`virtual machine` based on the Full :term:`Virtual Micromagnetics`
8+
environment. This page talks about containers and how the
9+
:term:`provider`\-:term:`manager`\-:term:`provisioner` model applies to
10+
container creation. We recommend reading :ref:`vm-software`, if you have not
11+
already.
12+
13+
Containers and Images
14+
---------------------
15+
16+
A :term:`container` is a virtualisation mechanism similar to a :term:`virtual
17+
machine`\, in that it allows users to run software in a controlled environment
18+
with a cap on available computing resources (like memory). Where a virtual
19+
machine contains the entire software stack above and including the operating
20+
system, a container uses the operating system and kernel of the host machine to
21+
produce its environment. Containers are created from :term:`image`\s (container
22+
templates, analogous to :term:`box file`\s) to run a single process, and are
23+
usually destroyed once that process has been completed.
24+
25+
Images can be distributed to other users so that they can run :term:`Virtual
26+
Micromagnetics` environments from a container.
27+
28+
Software Related to Containers
29+
------------------------------
30+
31+
As with :term:`virtual machine`\s, :term:`container`\s require supporting
32+
software to function. The
33+
:term:`provider`\-:term:`manager`\-:term:`provisioner` model outlined for
34+
virtual machines in :ref:`vm-software` also applies to containers as follows:
35+
36+
- Provisioner: Ansible is also used to provision containers. In :term:`Virtual
37+
Micromagnetics`, scripts to provision containers and virtual machines with
38+
software are very similar, encouraging code reuse.
39+
40+
- Manager: Vagrant is used to manage containers in this project in a similar
41+
way to how virtual machines are managed. An exception is that Vagrant can
42+
only be used to host :term:`box file`\s, meaning another hosting method is
43+
needed for :term:`images`.
44+
45+
- Provider: Docker is used in Virtual Micromagnetics to create containers for
46+
simulation (as the user) and for provisioning (as the poweruser). Docker
47+
also supports online hosting of images; this is used in Virtual
48+
Micromagnetics as a distribution method.
49+
50+
Summary
51+
-------
52+
53+
:term:`Container`\s are another virtualisation mechanism, like :term:`virtual
54+
machines`. Containers virtualise fewer elements of the software stack so they
55+
are smaller, but consequently impose more requirements on the :term:`host
56+
machine`. Like virtual machines, containers can be provisioned, managed, and
57+
distributed.
58+
59+
You are now ready to :ref:`get started as a
60+
poweruser<getting-started-poweruser>`, which explains how to create custom
61+
environments containing software you choose, as well as instructions for adding
62+
new software or configuring your own virtual environment.

docs/developer-notes.rst

+74-45
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.. _dev-notes:
22

3-
Developer Notes (valid for version 1.0.2)
3+
Developer Notes (valid for version 1.0.4)
44
=========================================
55

66
In :ref:`getting-started-poweruser`, we created a virtual environment from
@@ -9,66 +9,77 @@ completely specify your own environment. Knowledge of Ansible is needed, which
99
can be gleaned from their excellent documentation at
1010
http://docs.ansible.com/ansible/.
1111

12-
Overview: The Build and Run Processes
13-
-------------------------------------
12+
.. _dev-build-process:
13+
14+
Build and Run
15+
-------------
16+
17+
The Build and Run Processes for Virtual Machines
18+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1419

15-
This graph shows the operations involved in the build and run processes.
20+
This graph shows the operations involved in the build and run processes for
21+
:term:`virtual machine`\s.
1622

17-
.. image:: images/graph.png
23+
.. image:: images/vm_graph.png
1824

19-
Lets break this down:
25+
The run process is simple: the user follows the instructions in
26+
:ref:`getting-started-user` to create a virtual machine for themselves. Lets
27+
break down the build process:
2028

21-
- Input Environment -> Developer's Virtual Machine: The input environment is a
22-
:term:`virtual environment` containing only the operating system and few
29+
- Input Environment Box File -> Initial Virtual Machine: The input environment
30+
is a :term:`virtual environment` containing only the operating system and few
2331
convenience tools. In development, Vagrant and VirtualBox create a
2432
:term:`virtual machine` from this environment in the ``create_vm`` role (see
2533
:ref:`dev-build-process`).
2634

27-
- Ansible Provisions: Vagrant commands Ansible to provision this machine using
28-
an Ansible playbook.
35+
- Initial Virtual Machine -> Virtual Machine with Simulation Packages: Vagrant
36+
commands Ansible to provision this machine using an Ansible playbook.
2937

30-
- Developer's Virtual Machine -> Output Environment: Vagrant then packages the
31-
virtual machine into a new virtual environment, which can be distributed to
32-
others. Tagged releases are uploaded by administrators to
33-
atlas.hashicorp.com, where they become available to all Vagrant users.
38+
- Virtual Machine with Simulation Packages -> Output Environment Box File:
39+
Vagrant then packages the virtual machine into a new virtual environment,
40+
which can be distributed to others. Tagged releases are uploaded by
41+
administrators to atlas.hashicorp.com, where they become available to all
42+
Vagrant users.
3443

35-
- Output Environment -> User's Virtual Machine: The previous steps are run in
36-
the build phase by a developer as the build process. This step represents the
37-
user following the instructions in :ref:`getting-started-user` to create a
38-
virtual machine for themselves, which is referred to as the run process.
44+
The Build and Run Processes for Containers
45+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3946

40-
The run process performed by the user has been documented in
41-
:ref:`getting-started-user`. Here we introduce the build process, which
42-
represents the other section of this diagram.
47+
In the same way, this graph shows the operations involved in the build and run
48+
processes for :term:`container`\s.
4349

44-
.. _dev-build-process:
50+
.. image:: images/container_graph.png
51+
52+
Again the process of creating and running a container as a user is as simple as
53+
following the instructions in :ref:`getting-started-user`. The build process is
54+
also similar; a container template (:term:`image`) is downloaded, a container
55+
is created and provisioned, and the container is packaged as an image for
56+
download by all Docker users. The key difference is that Docker pushes the
57+
image to https://hub.docker.com/ as opposed to Vagrant.
4558

46-
The Build Process
47-
~~~~~~~~~~~~~~~~~
59+
Details
60+
~~~~~~~
4861

4962
The build (make) process in step 3 in :ref:`getting-started-poweruser` allowed
5063
us to create a virtual environment. The Makefile in the software repository can
5164
build multiple targets. Each target runs Ansible on the ``master.yml``
52-
playbook, which in turn runs the ``create_vm`` role in the roles
53-
directory. This creates a virtual machine and provisions it with the playbook
54-
passed as a command-line argument in ``Makefile``, which lives in the jobs
55-
directory. It will also do some post-provisioning tasks using the hookbook,
56-
again passed as a command-line argument. The fundamental difference between the
57-
playbook and the hookbook is that the playbook is run on the guest virtual
58-
machine by vagrant, and the hookbook is run on the host machine. Different
59-
Makefile targets may place different build artefacts in the artefacts
60-
directory.
65+
playbook, which in turn runs the ``create_vm`` or ``create_container`` role in
66+
the roles directory. This creates a virtual machine or container and provisions
67+
it with the playbook passed as a command-line argument in ``Makefile``, which
68+
lives in the jobs directory. It will also do some post-provisioning tasks using
69+
the hookbook, again passed as a command-line argument. The fundamental
70+
difference between the playbook and the hookbook is that the playbook is run on
71+
the guest virtual machine by :term:`Vagrant`, and the hookbook is run on the
72+
host machine. Different Makefile targets may place different build artefacts in
73+
the artefacts directory.
6174

6275
Roles add or configure software, playbooks describe the roles that must be
6376
enacted to provision the machine, hookbooks describe what to do with that
6477
machine (like creating a :term:`box file`), and jobs are Makefile targets that
65-
produce certain machines.
66-
67-
To add a new environment, one needs to add a job that follows the pattern of
68-
existing jobs.
78+
produce certain machines. To add a new environment, one needs to add a job that
79+
follows the pattern of existing jobs.
6980

7081
Where Things Are
71-
----------------
82+
~~~~~~~~~~~~~~~~
7283

7384
In order to add jobs, one should edit ``Makefile``. In order to do that, one
7485
would need to know where things are, hence the purpose of this section. The
@@ -115,8 +126,8 @@ server. Firstly, we add a target to ``Makefile`` (append the following to the ``
115126

116127
# This target builds a virtual hard disk file containing an OOMMF and Fidimag
117128
# installation.
118-
doc-example:
119-
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="vm_name=virtualmicromagnetics-doc-example playbook=provision_virtualmicromagnetics_doc-example.yml hookbook=hook.yml extra_resources_dir=guest_resources/"
129+
doc-example-vm:
130+
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=vm vm_name=virtualmicromagnetics-doc-example playbook=provision_virtualmicromagnetics_doc-example.yml hookbook=hook_vm.yml extra_resources_dir=guest_resources/"
120131

121132
Now we need to describe what the state of the machine should be, by writing the
122133
playbook `jobs/provision_virtualmicromagnetics_doc-examples.yml`::
@@ -199,8 +210,25 @@ now looks like::
199210
- { role: set_hostname, HOSTNAME: {{ vm_name }} }
200211
- emacs
201212

202-
Further Tinkering
203-
~~~~~~~~~~~~~~~~~
213+
Can I have a Container Too?
214+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
215+
216+
You certainly can, with minimal changes too. Add this target to your Makefile::
217+
218+
# This target builds a container image containing an OOMMF and Fidimag
219+
# installation.
220+
doc-example-container:
221+
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=container container_name=doc-example playbook=provision_virtualmicromagnetics_doc-example.yml hookbook=hook_container.yml extra_resources_dir=guest_resources/"
222+
223+
The only differences between this target and the one added previously are:
224+
225+
- The value of "type" is now "container", not "vm".
226+
- The value of "hookbook" is now "hook_container.yml", not "hook_vm.yml".
227+
- "vm_name=virtualmicromagnetics-doc-example" is now
228+
"container_name=doc-example".
229+
230+
Further Tinkering with the Virtual Machine
231+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
204232

205233
We have explored how a new :term:`virtual environment` can be created, and how
206234
new software can be added. In this section, we describe how the virtual machine
@@ -240,9 +268,10 @@ Summary and Final Words
240268
To summarise, :term:`virtual environment`\s are created from an empty Ubuntu
241269
virtual machine after being provisioned and packaged. This build process allows
242270
the user to create a Virtual Micromagnetics :term:`virtual machine` using
243-
Vagrant and VirtualBox. We have also presented how a new environment can be
244-
created, how the software of that environment can be controlled, and how the
245-
virtual machines can be parameterised.
271+
Vagrant and VirtualBox. A similar approach is used to create :term:`image`\s
272+
for :term:`Docker` :term:`containers`\. We have also presented how a new
273+
environment can be created, how the software of that environment can be
274+
controlled, and how the virtual machines can be parameterised.
246275

247276
Thank you for using Virtual Micromagnetics! If you create roles for your
248277
favourite software, consider sharing them with the community. You can create a

docs/environments-software.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ they contain:
9191
+-----------------+--------+----+----+-----+------+----+-------+
9292

9393
See :ref:`getting-started-poweruser` if more fine-grained control over your
94-
software interests you. However, we firstly recommend reading :ref:`software`
95-
to understand more about :term:`virtual machine`\s, :term:`virtual
96-
environment`\s, and the software used to create them in the Virtual
97-
Micromagnetics project.
94+
software interests you. However, we firstly recommend reading
95+
:ref:`vm-software` to understand more about :term:`virtual machine`\s,
96+
:term:`virtual environment`\s, and the software used to create them in the
97+
Virtual Micromagnetics project.

docs/getting-started-poweruser.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ In :ref:`environments`, we learned about the different :term:`Virtual
77
Micromagnetics` environments available to users, which bundle sets of
88
configured software. Here we outline how you can create virtual environments
99
yourself, which you can distribute to others. We recommend reading
10-
:ref:`software`, if you have not already.
10+
:ref:`vm-software`, if you have not already.
1111

1212
To create a new, custom :term:`virtual environment`, you will need the
1313
following software in addition to the software list in

0 commit comments

Comments
 (0)