How to run a sample » History » Version 10
Henning Blohm, 06.09.2012 09:36
| 1 | 1 | Henning Blohm | h1. How to Run a Sample |
|---|---|---|---|
| 2 | |||
| 3 | Various z2-based sample system configurations have been prepared as Git repositories. |
||
| 4 | |||
| 5 | You can run these samples with very few manual steps in a local environment. This How-To describes what you need to do. |
||
| 6 | |||
| 7 | 2 | Henning Blohm | h2. 0. Pre-Requisites |
| 8 | |||
| 9 | All you need is Java Runtime Environment (JRE) of at least version 6. Preferrably, as that is easier to understand a sample, have the Eclipse IDE installed. |
||
| 10 | 3 | Henning Blohm | Other pre-requisites, for example some database setup may be required based on the specific example, i.e. stuff that cannot be covered here. |
| 11 | 2 | Henning Blohm | |
| 12 | 1 | Henning Blohm | h2. 1. Prepare a z2-base Installation |
| 13 | 2 | Henning Blohm | |
| 14 | Create a folder to hold the installation. We will assume that folder is called *sample* |
||
| 15 | |||
| 16 | In *sample* execute |
||
| 17 | |||
| 18 | 10 | Henning Blohm | <pre><code class="groovy"> |
| 19 | 5 | Henning Blohm | git clone -b master http://git.z2-environment.net/z2-base.core |
| 20 | 7 | Henning Blohm | </code></pre> |
| 21 | 2 | Henning Blohm | |
| 22 | Go into *sample/z2-base.core/run/bin* and run |
||
| 23 | |||
| 24 | <pre> |
||
| 25 | ./gui.sh |
||
| 26 | </pre> |
||
| 27 | |||
| 28 | or |
||
| 29 | |||
| 30 | <pre> |
||
| 31 | gui.bat |
||
| 32 | </pre> |
||
| 33 | 1 | Henning Blohm | |
| 34 | 3 | Henning Blohm | depending on your operating system. A simple graphical console should open up that displays the console log output of the z2 <home> and worker processes - as explained in http://www.z2-environment.eu/check_it_out. |
| 35 | 2 | Henning Blohm | |
| 36 | At the first start, the environment will download required resources, which may take a few minutes - depending on your network bandwidth. Subsequent starts will be faster. |
||
| 37 | Eventually the server should be up and you can go to the basic admin view at http://localhost:8080/adm (use z* with password z) to verify everything is cool. |
||
| 38 | 1 | Henning Blohm | |
| 39 | 6 | Henning Blohm | Stop the environment again by either pressing Ctrl+C on the console where you started the GUI or by clicking the Exit button on the GUI. |
| 40 | 1 | Henning Blohm | |
| 41 | 3 | Henning Blohm | h2. 2. Clone the specific sample repository |
| 42 | 1 | Henning Blohm | |
| 43 | 3 | Henning Blohm | Given the sample repository is called *z2-samples.sampleX*, go into *sample* once more and run |
| 44 | 1 | Henning Blohm | |
| 45 | 3 | Henning Blohm | <pre> |
| 46 | 5 | Henning Blohm | git clone -b master http://git.z2-environment.net/z2-samples.sampleX |
| 47 | 3 | Henning Blohm | </pre> |
| 48 | |||
| 49 | Now start the environment as described above. The environment will now run with the sample configuration and all required dependencies. |
||
| 50 | |||
| 51 | 4 | Henning Blohm | In other words: That's it. |
| 52 | |||
| 53 | 3 | Henning Blohm | h2. Why does that actually work |
| 54 | |||
| 55 | If you care, here is how everything falls into place: |
||
| 56 | |||
| 57 | The z2-base.core repository contains a z2 core installation that is bound to a remote "system repository" at http://git.z2-environment.net/z2-base.base. As it is by now best practice with z2, that repository contains an *environment* module that describes system specific settings such as other repositories. |
||
| 58 | |||
| 59 | By cloning the sample repository you put an override of *environment* module into view of the _dev repository_. That is, the local server will take your local definitions with preference over the remote definitions. These may include other remote component repositories such as *z2-addons.spring*. |
||
| 60 | |||
| 61 | In addition the sample repository contains all the modules holding code and other resources that implement the actual sample. |
||
| 62 | |||
| 63 | If you already understand how the _dev repository_ works, you will not be surprised to find files called LOCAL in the module folders of cloned repository's workspace. |
||
| 64 | |||
| 65 | h2. References |
||
| 66 | |||
| 67 | * Dev Repository: http://www.z2-environment.eu/v20doc#Workspace%20Development%20Using%20the%20Dev%20Repository |
