Skip to content
This repository has been archived by the owner on Feb 26, 2023. It is now read-only.

Commit

Permalink
Add strategy for distributed deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
jachinte committed Oct 6, 2017
1 parent 514ea36 commit 5f3fe29
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 5 deletions.
21 changes: 20 additions & 1 deletion examples/frascati-helloworld-rmi/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# FraSCAti helloworld-rmi

This example installs Java 1.6.0_23 & FraSCAti 1.4 (if not installed) and compiles and executes the helloworld-rmi project from the FraSCAti distribution. It requires specifying the following parameters:
This example installs Java 1.6.0_23 & FraSCAti 1.4 (if not installed) and compiles and executes the helloworld-rmi project from the FraSCAti distribution. There are two deployment variants: monolithic and distributed deployment. The first one runs both server and client components in the same server, and the second one uses two hosts.

The __monolithic__ strategy requires specifying the following parameters:

- __host__: the target host name
- __privileged-user__: a privileged user to install Java and FraSCAti
Expand All @@ -12,6 +14,23 @@ By default, the project pom defines these parameters as follow:
- privileged-user = root
- unprivileged-user = ${user.name} # the user running maven

The __distributed__ strategy requires specifying the following parameters:

- __host-server__: the target host name for the server component
- __host-client__: the target host name for the client component
- __privileged-user__: a privileged user to install Java and FraSCAti
- __unprivileged-user__: an unprivileged user to execute the components
- __mainClass__: org.amelia.dsl.examples.ubuntu.frascati.demo.DistributedDeployment

Both users are expected to exist in the target hosts.

By default, the project pom defines these parameters as follow:

- host-server = localhost
- host-client = localhost
- privileged-user = root
- unprivileged-user = ${user.name} # the user running maven

To run the example:

1. [Package and install the language artefacts](/README.md#compiling-from-sources)
Expand Down
10 changes: 10 additions & 0 deletions examples/frascati-helloworld-rmi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<properties>
<mainClass>org.amelia.dsl.examples.ubuntu.frascati.demo.Deployment</mainClass>
<host>localhost</host>
<host-server>localhost</host-server>
<host-client>localhost</host-client>
<privileged-user>root</privileged-user>
<unprivileged-user>${user.name}</unprivileged-user>
</properties>
Expand Down Expand Up @@ -92,6 +94,14 @@
<key>host</key>
<value>${host}</value>
</systemProperty>
<systemProperty>
<key>host-server</key>
<value>${host-server}</value>
</systemProperty>
<systemProperty>
<key>host-client</key>
<value>${host-client}</value>
</systemProperty>
<systemProperty>
<key>privileged-user</key>
<value>${privileged-user}</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ subsystem Client {
param Host host

on host {
compilation:
configuration:
cd '$FRASCATI_HOME/examples/helloworld-rmi'
// ensure the right host name
cmd 'sed -i \\"s/localhost/«host.hostname»/g\\" client/src/main/resources/helloworld-rmi-client.composite;'

compilation:
compile 'client/src' 'client'

execution: compilation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ includes org.amelia.dsl.examples.ubuntu.frascati.demo.Client
* <p>
* This deployment expects the following parameters:
* <ul>
* <li> host: the host name to install docker and run the container
* <li> privileged-user: a privileged user to install Docker
* <li> unprivileged-user: an unprivileged user to run the container
* <li> host: the host name to install Java & FraSCAti, and execute the components
* <li> privileged-user: a privileged user to install the required software
* <li> unprivileged-user: an unprivileged user to run the components
* </ul>
*
* @author Miguel Jimenez ([email protected])
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.amelia.dsl.examples.ubuntu.frascati.demo

includes org.amelia.dsl.examples.ubuntu.frascati.FraSCAti
includes org.amelia.dsl.examples.ubuntu.frascati.demo.Server
includes org.amelia.dsl.examples.ubuntu.frascati.demo.Client

/*
* Distributed deployment to run the FraSCAti helloworld-rmi project
* in two hosts.
* <p>
* This deployment expects the following parameters:
* <ul>
* <li> host-server: the host name to install Java & FraSCAti, and execute the server component
* <li> host-client: the host name to install Java & FraSCAti, and execute the client component
* <li> privileged-user: a privileged user to install the required software in both hosts
* <li> unprivileged-user: an unprivileged user to run the components in both hosts
* </ul>
*
* @author Miguel Jimenez ([email protected])
* @date 2017-09-22
*/
deployment DistributedDeployment {
// Input data
val privileged = System.getProperty('privileged-user')
val unprivileged = System.getProperty('unprivileged-user')
val server = System.getProperty('host-server')
val client = System.getProperty('host-client')

// configure subsystems
add(new FraSCAti(unprivileged, #[ host(server, privileged), host(client, privileged) ]))
add(new Server(host(server, unprivileged)))
add(new Client(host(client, unprivileged)))

// Deploy the subsystems & stop the executed components
start(true)
}

0 comments on commit 5f3fe29

Please sign in to comment.