| 1 | <h2>Full example</h2> |
| 2 | <pre><code>ApacheServer { |
| 3 | # Apache instances will be deployed by Roboconf's Puppet extension |
| 4 | installer: puppet; |
| 5 | |
| 6 | # Web applications could be deployed over this Apache server |
| 7 | children: My-Dash-Board, Marketing-Suite; |
| 8 | |
| 9 | # Properties exported by this component. |
| 10 | # 'port' should have a default value, or we will have to set it when we create an instance. |
| 11 | exports: port = 19099; |
| 12 | |
| 13 | # 'ip' is a special variable. It will be updated at runtime by a Roboconf agent. |
| 14 | exports: ip; |
| 15 | |
| 16 | # Other components properties that this server needs to have so that it can start. |
| 17 | imports: LB.port (optional), LB.ip (optional); |
| 18 | |
| 19 | # Here, the Apache may also be notified about components instances of type LB. |
| 20 | # The imports are marked as optional. It means that if there is no LB instance, an |
| 21 | # Apache instance will be able to start anyway. |
| 22 | # |
| 23 | # If the import was not optional, e.g. |
| 24 | # |
| 25 | # imports: LB.port, LB.ip; |
| 26 | # or even |
| 27 | # imports: LB.port (optional), LB.ip; |
| 28 | # |
| 29 | # ... then an Apache instance would need at least one LB instance somewhere. |
| 30 | |
| 31 | # Imports may also reference variables from other applications |
| 32 | imports: external Lamp.lb-ip; |
| 33 | } |
| 34 | |
| 35 | facet LoadBalanced { |
| 36 | exports: ip, port; # Define we export two variables. |
| 37 | } |
| 38 | |
| 39 | instance of VM { |
| 40 | |
| 41 | # This will create 5 VM instances, called VM 1, VM 2, VM3, VM 4 and VM 5. |
| 42 | name: VM ; # Yes, there is a space at the end... :) |
| 43 | count: 5; |
| 44 | |
| 45 | # On every VM instance, we will deploy... |
| 46 | instance of Tomcat { |
| 47 | name: Tomcat; |
| 48 | } |
| 49 | }</code></pre> |