Project

General

Profile

How to use the hub cr » History » Version 7

Henning Blohm, 20.07.2013 15:54

1 2 Henning Blohm
h1. How to use the Hub Component Repository (beta)
2 1 Henning Blohm
3 3 Henning Blohm
h2. Principles
4
5 2 Henning Blohm
(See also "Z2V2.1 is out – working on v2.2":http://www.z2-environment.net/blog/2012/12/z2v2-1-is-out-working-on-v2-2/)
6
7
By default, a Z2 installation (a z2 Home) accesses the version controlled storage that holds the system definition directly to download and prepare (and compile) modules as needed. This is the underpinnings of the system centric, pull-deployment based approach. In some situations however, it is not desirable to have source code on production servers at any time. This may be for compliance reasons or for fear of risking theft of intellectual property.
8
9
This is where the HubCR comes in. As a principle, all modules, all component resources, essentially anything the Z2 runtime knows about is served by component repository implementations.  There are implementations for Subversion, Git, file system folders, development workspaces and now, the latest addition, for another Z2 server that provides a consolidated, source-code free and pre-compiled view onto production resources (the HubCR provider).
10
11
So, instead of having production systems read and process source code directly, an intermediate node provides a semantically equivalent but pre-processed view onto the system definition:
12 1 Henning Blohm
13 4 Henning Blohm
p=. !{width:600px;}hubcr2.png!
14 3 Henning Blohm
15
The way the HubCR does that is by maintaining a pre-compiled and source-code stripped snapshot of the original production configuration. At the same time, the HubCR is just a regular z2 Home that runs the production config.
16
17
To the real production nodes (on the right in the diagram) however, the HubCR presents everything but the HubCR and other remote component repositories.
18
19
As a result, production systems can be completely separated from the source level details of the system definition. They don’t even see authentication details to the configuration store – only those necessary to access the HubCR service. At the same time, the pull semantics are preserved and updates can flow in and will be distributed consistently as for any other Z2-based system.
20
21
h2. How to configure and use
22 5 Henning Blohm
23
The HubCR consists of three parts: For once, there is a repository client implementation that is now part of the Z2 core (necessarily so that bootstrapping from a HubCR is possible). Secondly there is a z2-base level module that implements the serving side and thirdly there are some important rules that allow to implement the HubCR in a system that can be used in the default development flow as well.
24
25
The latter is a crucial cool feature: Just because a production system makes use of the HubCR, from where we do have access to the configuration source (i.e. the left side of the picture), we can still supply, implement and verify hot fixes without going through the HubCR.
26 6 Henning Blohm
27
h3. Consuming from a Hub
28
29 7 Henning Blohm
In order to connect a z2 <home> to a HubCR, you simply configure a repository to read from as in all the other cases. In case of the HubCR however, the home would only read from one repository (whereas the HubCR serving side may read from many). A HubCR consuming declaration of @com.zfabrik.boot.config/hubRepository.properties@  (see in particular [[How to create your own system]] to learn about repository topology) may look like this:
30 6 Henning Blohm
31
<pre><code class="bash">
32
com.zfabrik.systemStates.participation=com.zfabrik.boot.main/bootrepo_up
33
#
34
# hub stored component repository
35
#
36
com.zfabrik.component.type=com.zfabrik.hubcr
37
#
38
# The URL to the source repo. Typically this is of the form http://<server>:<port>/z_hubcr
39
#
40
hubcr.url=http://myhub:8080/z_hubcr
41
#
42
# Connection timeout in ms for connecting to the providing side (defaults to 10000)
43
#
44
hubcr.timeout=10000
45
#
46
# The remote user to use (optional but required by default)
47
#	
48
hubcr.user=hubcraccess
49
hubcr.password=secret
50
#
51
# The priority of the repository (defaults to 500)
52
#
53
hubcr.priority=500
54 1 Henning Blohm
</code></pre>
55 7 Henning Blohm
56
As mentioned above, when configuring a HubCR in a home, you will typically not connect to any other repository. So check carefully, if there are other effective repository configurations in @Z2_HOME/run/local/com.zfabrik.boot.config@.
57
58
h3. Serving from a Hub