use of org.opentosca.toscana.plugins.cloudfoundry.application.Application in project TOSCAna by StuPro-TOSCAna.
the class CloudFoundryLifecycle method fillApplications.
/**
* Fills the Applications with the sorted Node structure
*/
public void fillApplications() {
filledApplications = new ArrayList<>();
for (Application app : applications) {
for (int i = 0; i < app.getStack().getNodes().size(); i++) {
nodeApplicationMap.put(app.getStack().getNodes().get(i).getNode(), app);
}
}
for (Application application : applications) {
NodeVisitor visitor = new NodeVisitor(application, nodeApplicationMap, graph, logger);
for (KubernetesNodeContainer s : application.getStack().getNodes()) {
s.getNode().accept(visitor);
}
Application filledApplication = visitor.getFilledApp();
filledApplications.add(filledApplication);
}
}
use of org.opentosca.toscana.plugins.cloudfoundry.application.Application in project TOSCAna by StuPro-TOSCAna.
the class FileCreator method replaceStrings.
/**
* replaces strings in files with suitable strings.
* If a path is not suitable to the path in the warden container
* A replace command will be added to the deployscript which replaces the Strings locally.
*
* @param deployScript script the commands will be written in
*/
private void replaceStrings(BashScript deployScript) throws IOException {
for (Application application : applications) {
Deployment deployment = new Deployment(deployScript, application, fileAccess, context);
if (!application.getExecuteCommands().isEmpty()) {
Map<String, String> executeCommands = application.getExecuteCommands();
for (Map.Entry<String, String> command : executeCommands.entrySet()) {
// TODO: add lists which strings should be replaced. In 12 Factor it is probably not necessary.
String findStr = "/var/www/html/";
String replaceStr = "/home/vcap/app/htdocs/";
deployment.replaceStrings(command.getKey(), findStr, replaceStr);
logger.info("Add command to replace all occurence of {} with {}", findStr, replaceStr);
}
}
}
}
use of org.opentosca.toscana.plugins.cloudfoundry.application.Application in project TOSCAna by StuPro-TOSCAna.
the class FileCreator method handleServices.
/**
* looks for a suitable service of the provider which matches to the needed service
* adds the creation command to the deployscript
*
* @param deployScript script the commands will be written in
*/
private void handleServices(BashScript deployScript) throws IOException {
for (Application application : applications) {
Deployment deployment = new Deployment(deployScript, application, fileAccess, context);
// only one time all service offerings should be printed
this.alreadyHandledServices = deployment.treatServices(alreadyHandledServices);
}
}
use of org.opentosca.toscana.plugins.cloudfoundry.application.Application in project TOSCAna by StuPro-TOSCAna.
the class FileCreator method createFiles.
/**
* creates all files which are necessary for deployment
* Each application has to be filled with information
*/
public void createFiles() throws IOException, JSONException {
logger.info("Create manifest.yml");
createManifest();
logger.info("Create deploy script");
createDeployScript();
for (Application application : applications) {
createBuildpackAdditionsFile(application);
insertFiles(application);
createEnvironmentConfigFile(application, application.getEnvironmentVariables());
}
logger.info("Create readme text file");
createReadme();
}
use of org.opentosca.toscana.plugins.cloudfoundry.application.Application in project TOSCAna by StuPro-TOSCAna.
the class FileCreator method createManifest.
/**
* creates the manifest
* multiple applications are in the same manifest
*/
private void createManifest() throws IOException {
createManifestHead();
for (Application application : applications) {
addNameToManifest(application);
addPathToApplication(application);
createAttributes(application);
createEnvironmentVariables(application);
createService(application);
}
}
Aggregations