I am new to Saltstack, I have some history with Ansible. And I am
surprise by the "standard" saltstack formulas.
I will use Tomcat as example.
In Ansible, in the Tomcat role, I add dependency to Java.
So in the future, I don't need to remenber that Tomcat depends on Java. I just run
the Tomcat role to deploy Tomcat and Java if necessary. (See ansible-examples on github)
In Saltstack, in the Tomcat formula, I suppose that Java is installed.
When I need to install Tomcat, I must install Java first with another formula.
(See saltstack formula on github)
The Saltstack method seems less usable and robust.
Everyone knows that Java is required for Tomcat but for my internal
applications/servers, these dependencies are not so clear.
Ansible (install Java with yum or call another role)
---
- name: Install Java 1.7
yum: name=java-1.7.0-openjdk state=present
---
- name: Install Java 1.7
include_role: java7
Salttack: the pillar should contain the Java home directory, so Java must be installed before the Tomcat installation
{% from "tomcat/map.jinja" import tomcat with context %}
{% set tomcat_java_home = tomcat.java_home %}
{% set tomcat_java_opts = tomcat.java_opts %}
So, my question is: Should I follow the saltstack standard ? Or should I call formula from my formula ?
Any others solutions ?
Thanks
Related
I'm using JBDS 11.3.0.GA on Ubuntu 16.04 LTS. I'm generating a Fuse project for Fuse 7.1.0 on standalone Karaf platform, using the camel-spring-cxf-code-first template. The project generates correctly but, trying to run it as described by the ReadMe.txt file fails. For example, after installing the bundle as follows:
karaf#root()> install -s mvn:com.mycompany/camel-spring-cxf-code-first/1.0.0-SNAPSHOT
Bundle ID: 223
karaf#root()>
trying to go to http://localhost:8181/cxf/report/?wsdl (of course, after having replaced in the generated code 9292 by 8181) displays "No service was found." in the browser and shows the following in the log file:
16:33:36.209 WARN [XNIO-4 task-1] Can't find the the request for http://localhost:8181/cxf/report/'s Observe
meaning that the generated project is not valid.
Kind regards,
Nicolas
The deployment of this kind of projects is not working at the moment - see the following statement in the Readme.txt file.
Note: This project does not currently work. It has some issues. It is based
on the archetype.
I raised an issue for developers - https://issues.jboss.org/browse/FUSETOOLS-3177.
** EDIT **
For several cases we need to call Symfony commands on a deployed CloudFoundry app. Symfony commands are php scripts which are called with the PHP CLI.
One example is bin/console doctrine:schema:update (but could be user generation, cache clearing etc.)
So for our app we need both, fpm and cli enabled. This is done with:
"PHP_MODULES": [
"fpm",
"cli"]
in options.json.
After connecting to the app with cf ssh I change to app directory and I call php/bin/php doctrine:schema:update this results in a ClassNotFound: PDO issue.
During staging these commands are called successfully.
I checked that for PHP CLI the PDO extension is not available (by checking php -i) although I have mentioned it in options.json.
"PHP_EXTENSIONS": [
...
"pdo",
"pdo_mysql",
...]
How to enable extensions for CLI and FPM on one app? And is it theoretically possible to have different extensions for CLI and FPM and as well different user-php.ini s to fully/particularly override php.ini of CLI and FPM?
So for our app we need both, fpm and cli enabled. This is done with:
"PHP_MODULES": [ "fpm", "cli"]
in options.json.
This is something that we should probably clean up in the build pack. I do not believe it's (PHP_MODULES) actually used any more.
Maybe a year or more ago, the build pack switched how it downloads PHP. It would previously download individual components modules & extensions. Now it just downloads everything at once. This actually ends up being faster since it's one larger download vs many smaller downloads, and bandwidth is generally very fast for build pack downloads.
Worth mentioning that while PHP_EXTENSIONS no longer triggers what to download it is still used in terms of what extensions get enabled in php.ini. Thus you still need to set that or indicate extensions through composer.
After connecting to the app with cf ssh
I believe that this is the issue. You need to source the build pack env variables so that the env is configured properly.
Ex:
vcap#359b74ff-686c-494e-4a1e-46a9c420f262:~$ php
bash: php: command not found
vcap#359b74ff-686c-494e-4a1e-46a9c420f262:~$ HOME=$HOME/app source app/.profile.d/bp_env_vars.sh
vcap#359b74ff-686c-494e-4a1e-46a9c420f262:~$ php -v
PHP 5.6.26 (cli) (built: Oct 28 2016 22:24:22)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
Staging does this automatically as does runtime for your app. Unfortunately cf ssh does not.
UPDATE:
A slightly easier way to do this is to run cf ssh myapp -t -c "/tmp/lifecycle/launcher /home/vcap/app bash ''". This will open a bash shell and it lets the lifecycle launcher handle sourcing & setting up the environment.
And is it theoretically possible to have different extensions for CLI and FPM and as well different user-php.ini s to fully/particularly override php.ini of CLI and FPM?
Sure. By default, we download and install all extensions. Thus you just need a different php.ini (or some other setting to enable that extension) in which you enable your alternate set of extensions.
When you cf ssh into the container, you could copy the existing php.ini somewhere else and edit it for your CLI needs. Then reference that php-alt.ini when you run your CLI commands.
Never did this but does enabling the php cli in PHP_MODULES (https://docs.developer.swisscom.com/buildpacks/php/gsg-php-config.html) help?
It sounds very basic but I haven't found clear instructions on how to do this. I'm new on openstack. I have setted up devstack on my laptop, I have created an instance from a cirros image and now I would like this image to run a jar. I was expecting this to work in a similar way as Amazon EMR for instance, but obviously it doesn't. Any help or hints for straightforward tutorials will be appreciated.
The cirros image doesn't include Java nor does it include a facility for installing additional packages. You should boot using a full distribution of some sort (e.g., Fedora, CentOS, Ubuntu, etc), and then proceed to install Java following instruction appropriate for that distribution.
Once you have Java installed, you can install and run your jar file.
How can I set my java jar application to use jre 6 instead of jre 7?
I'm doing this because there are some compatibility issue with the libraries I'm using if the application use jre 7.
Edit:
The application will come with its own installers (using advanced installer) that have a jre6 installer. But I don't know how to trace the installation folder of the jre6.
How can I trace it and make the jar file use the jre6?
You can do this from Advanced Installer much simpler. You have two options:
Force the package to use the JRE 1.6 found on the machine by going to "Virtual Machine" tab from Java Products page and setting the minimum and maximum JRE versions to 1.6
Add as bundle in the project from the same page the JRE for version 1.6. This means that Advanced Installer will automatically import in your package the JRE resources required for your application, thus increases the package size, and will install them in the application's install folder. This JRE bundle will be used only by your application and removed along with it.
When running your application using java.exe, you could provide the absolute path to a Java 1.6 installation. Something like:
absolute_path_to_java6_dir/bin/java -jar yourRunnableJar.jar
or
absolute_path_to_java6_dir/bin/java -cp .;yourJar.jar;otherJarFiles className
You could check the running JVM version when starting your application.
System.getProperty("java.version");
This way you could provide a meaningful explanation to end-user.
I have developed a TideSDK application and am now ready to package it, but I'm having problems with the network type installer.
It always gives me code 404 on the Application first run:
Could not query info: Invalid HTTP Status Code (404)
I presume the installer is having difficulty with reaching the correct servers and downloading the needed runtime, but I have run through most solutions on this forum, and none have worked.
So I tried a bundle packaging, as it should include such runtime, but I must be doing something wrong, since it does not bundle within the MSI.
The code I'm executing is as follows:
C:\TideSDK\sdk\win32\1.2.0.RC6d\tibuild.py -p --type=BUNDLE --os=win32 "C:\path_to_app\app_dir"
I also tried:
C:\TideSDK\sdk\win32\1.2.0.RC6d\tibuild.py -p -t bundle --os=win32 "C:\path_to_app\app_dir"
And all the uppercase/lowercase combinations. Also tried version 1.2.0.4, without sucess. Am I doing something wrong?
the network type installer is not available anymore, since appcelerator has canceled their services for titanium desktop.
So you can only do bundle packaging. Try the following command:
python tibuild.py --dest=. --type=bundle --package=. "c:\path\to\your\app\dir"
This should build and package your app and create a installer for it.
Change "dest" and "package" to the directories where you want to have the built app and installation package.
You can omit the OS parameter, since the builder can only generate builds for the current OS.