I have the last Apache Brooklyn (24.08.2015), Version: 0.8.0-SNAPSHOT, and when I am trying the example of the blueprint which is here: https://brooklyn.incubator.apache.org/v/latest/yaml/custom-entities.html
name: Simple Netcat Server Example
location: localhost
services:
- type: brooklyn.entity.basic.VanillaSoftwareProcess
name: Simple Netcat Server
launch.command: |
echo hello | nc -l 4321 &
echo $! > $PID_FILE
# The following overrides demonstrate the use of a custom shell environment as well as
# check-running and stop commands. These are optional; default behavior will "do the
# right thing" with the pid file automatically.
env: { CHECK_MARKER: "checkRunning", STOP_MARKER: "stop" }
checkRunning.command: echo $CHECK_MARKER >> DATE && test -f "$PID_FILE" && ps -p `cat $PID_FILE` >/dev/null
stop.command: echo $STOP_MARKER >> DATE && test -f "$PID_FILE" && { kill -9 `cat $PID_FILE`; rm /tmp/vanilla.pid; }
# can also define download.url, in which case the launch command defaults to ./start.sh in that (archive) file
When I tried to create the application with the Apache Brooklyn, I get an Internal error. I debugged the application, and the Exception I get is the following (PlanToSpecFactory.java):
java.lang.UnsupportedOperationException: Deployment plan item
org.apache.brooklyn.camp.spi.pdp.Service#62abec8e[name=Simple Netcat
Server,description=,serviceType=brooklyn.entity.basic.VanillaSoftwareProcess,characteristics=[],customAttributes={launch.command=echo
hello | nc -l 4321 & echo $! > $PID_FILE ,
env={CHECK_MARKER=checkRunning, STOP_MARKER=stop},
checkRunning.command=echo $CHECK_MARKER >> DATE && test -f "$PID_FILE"
&& ps -p cat $PID_FILE >/dev/null, stop.command=echo $STOP_MARKER
DATE && test -f "$PID_FILE" && { kill -9 cat $PID_FILE; rm /tmp/vanilla.pid; }}] cannot be matched
The trace in debug.log
DEBUG o.a.b.c.plan.PlanToSpecFactory
[brooklyn-jetty-server-8443-qtp1119923741-24]: Plan could not be
transformed; failure will be propagated (other transformers tried =
[]): [java.lang.IllegalArgumentException: Transformer for Brooklyn
OASIS CAMP interpreter gave an error creating this plan]
Any idea why? In the past this has worked
(I would like to post in the mailing list of Apache Brooklyn, but I get an error and I can not contact nobody)
The latest SNAPSHOT versions went through an heavy refactoring to change the package name to org.apache.brooklyn.*. That's probably why your version of Brooklyn cannot find the VanillaSoftwareProcess anymore.
Based on the Github repository, this entity is now located here: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
Related
As part of my ansible setup I'm currently checking in the VM what is the Java version and if that's not the one expected then download and install that version. I have given the standard regex to find the Java version but that step is getting skipped
- name: "[install] Check for Java install"
shell: "java -version 2>&1 | grep version | awk '{print $3}'"
changed_when: False
register: java_installed
ignore_errors: True
- when: java_installed.stdout != "17.0.2"
block:
- debug:
msg: "Java is not installed"
- name: "[install] Installing Java 17"
become: true
yum:
name: /var/tmp/jdk-17_linux-x64_bin.rpm
state: present
But these steps are getting skipped while executing
TASK [java : [install] Check for Java install] *****************************************************************************************************************************
skipping: [VM name hidden by me ]
TASK [java : debug] ********************************************************************************************************************************************************
skipping: [VM name hidden by me]
TASK [java : [install] Installing Java 17] *********************************************************************************************************************************
skipping: [VM name hidden by me]
when I execute
java -version 2>&1 | grep version | awk '{print $3}'
This is what I get
"1.8.0_312"
Does anyone know why it's getting skipped. Thanks
Note: below is an answer to your direct problem. Meanwhile if java was installed as a system package, I strongly suggest you have a look at the answer by #Jaay to get the version directly from package facts rather than using shell/command
This is what I get
"1.8.0_312"
As you can see, the quotes are part of the output. Hence if you debug java_installed.stdout you get (ran on my local machine with java 11):
TASK [debug] ********************************************************************************************************************
ok: [localhost] => {
"java_installed.stdout": "\"11.0.15\""
}
A simple workaround is to read the incoming value as json. The following does the job (once again customized for my local machine to test and using the version test as good practice)
---
- hosts: localhost
gather_facts: false
tasks:
- name: "[install] Check for Java install"
shell: "java -version 2>&1 | grep version | awk '{print $3}'"
changed_when: false
failed_when: false
register: java_installed
- name: show the raw and refactored captured var
vars:
my_msg:
- "Raw value for version is: {{ java_installed.stdout }}"
- "Refactored value for version is: {{ java_installed.stdout | from_json }}"
debug:
msg: "{{ my_msg }}"
- when: java_installed.stdout | from_json is version("11.0.15", "==")
debug:
msg: "Java 11 is installed"
- when: java_installed.stdout | from_json is not version("17.0.2", "==")
debug:
msg: "Java 17 is not installed"
and gives
PLAY [localhost] ****************************************************************************************************************
TASK [[install] Check for Java install] *****************************************************************************************
ok: [localhost]
TASK [show the raw and refactored captured var] *********************************************************************************
ok: [localhost] => {
"msg": [
"Raw value for version is: \"11.0.15\"",
"Refactored value for version is: 11.0.15"
]
}
TASK [debug] ********************************************************************************************************************
ok: [localhost] => {
"msg": "Java 11 is installed"
}
TASK [debug] ********************************************************************************************************************
ok: [localhost] => {
"msg": "Java 17 is not installed"
}
PLAY RECAP **********************************************************************************************************************
localhost : ok=4 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Not really a big fan of shell command in Ansible, you can use the package facts core plugin to retrieve the installed Java version. This way you should get rid of the outputs problem using shell command
- name: get the rpm or apt package facts
package_facts:
manager: "auto"
- name: show Java version
debug: var=ansible_facts.packages.jdk[0].version
PS: This will work only if java is installed with a package manager (not just copied in your system)
I am trying to set up oracle data once my oracle container is up and running, below is my compose file:
version: '3'
services:
oracle:
image: absolutapps/oracle-12c-ee
container_name: oracle-docker
ports:
- 8080:8080
- 1521:1521
environment:
CASSANDRA_BROADCAST_ADDRESS: 127.0.0.1
ORACLE_ALLOW_REMOTE: "true"
volumes:
- ./scripts/oracle-init.sh:/oracle-init.sh
oracle-init.sh:
#!/usr/bin/env bash
echo "### SETUP EXECUTION! ###"
sqlplus -s "system/oracle#localhost:1521/orcl /scripts/init-oracle.sql"
echo "### SETUP EXECUTED! ###"
init-oracle.sql :
CREATE USER ot_consumer_tryout IDENTIFIED BY ot_consumer_tryout;
Can anyone help me what is wrong with above snippets. My docker container getting started but sql script does not execute ,here is the log from terminal:
oracle-docker | Running init scripts...
oracle-docker | Init scripts in /oracle.init.d/: Ignoring /oracle.init.d/*
oracle-docker |
oracle-docker | Done with scripts we are ready to go
Look at the volume you created
- ./scripts/oracle-init.sh:/oracle-init.sh
which means inside your container the file is in '/oracle-init.sh' but your
container might be expecting in a different location something with folder name oracle.init.d as per your container log.
oracle-init.sh is trying to run /scripts/init-oracle.sql , hope your image already has it otherwise you will have to mount it as well in compose file.
I am trying to sign my Java/JavaFX application using codesign with gradle. My gradle code is as following:
exec {
val codeSignArgs = listOf("-s", "'${macSigningKeyDeveloperIdApp}'", "--timestamp", "--options", "runtime", "--entitlements", "../../../entitlements.plist", "--deep", "-f", "--verbose", "UTMCoordinateConverter.app")
logger.quiet("code sign args: $codeSignArgs")
workingDir = macRel
isIgnoreExitValue = true
executable = codeSignTool.absolutePath
args(codeSignArgs)
}
Where codeSignTool is /usr/bin/codesign and macRel is the directory where the app file is, and macSigningKeyDeveloperIdApp is my signing developer id.
Gradle gives me the following output:
> Task :codeSign
Inside codeSign
code sign args: [-s, 'Developer ID Application: Victor Ewert (XXXXXXXXXX)', --timestamp, --options, runtime, --entitlements, ../../../entitlements.plist, --deep, -f, --verbose, UTMCoordinateConverter.app]
BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed
'Developer ID Application: Victor Ewert (XXXXXXXXXX)': no identity found
2:38:26 p.m.: Task execution finished 'codeSign'.
The strange thing is, I can run the (equivalent) command fine, from the command line using:
/usr/bin/codesign -s 'Developer ID Application: Victor Ewert (XXXXXXXXX)' --timestamp --options runtime --entitlements ../../../entitlements.plist --deep -f --verbose UTMCoordinateConverter.app
run from the location of the app file.
I have double and triple checked my Developer ID, and it looks fine (checked using security find-identity -p codesigning -v login.keychain. I have also made sure my login keychain is unlocked. I don't think it is a problem with my Developer ID.
I'm guessing it has something to do with how gradle is executing the command, but I can't figure it out.
I converted this original project into a docker-compose project here and followed a their setup instructions. It seems that I am not able to connect with the browser.
The SQL file contains the database schema and looks like this:
CREATE DATABASE mgsv;
CREATE USER 'mgsv_user'#'localhost' IDENTIFIED BY 'mgsvpass';
GRANT SELECT, INSERT, CREATE, DROP ON mgsv.* TO 'mgsvuser'#'localhost';
use mgsv;
CREATE TABLE IF NOT EXISTS `userinfo` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`email` text NOT NULL,
`hash` text NOT NULL,
`synfilename` text NOT NULL,
`annfilename` text NOT NULL,
`url` text NOT NULL,
`session_id` text NOT NULL,
`annImage` int(5) NOT NULL,
`create_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
The docker-compose.yml looks like this:
version: '3.1'
services:
db:
image: mysql
restart: always
environment:
- MYSQL_DATABASE=mgsv
- MYSQL_USER=mgsv_user
- MYSQL_PASSWORD=mgsvpass
- MYSQL_ROOT_PASSWORD=mysql123
volumes:
- ./mysql:/docker-entrypoint-initdb.d
www:
build: ./mGSV
restart: always
ports:
- 8080:8080
And the Dockerfile contains PHP and all other tools setup and looks like this.
FROM php:5-apache
RUN apt-get update && apt-get install -y --no-install-recommends \
openjdk-7-jdk \
maven \
git \
&& rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/qunfengdong/mGSV.git
# Move the folder 'mgsv' to DocumentRoot of Apache web server. By default, the DocumentRoot of Apache is /var/www/ (speak to the system administrator to know the exact DocumentRoot).
RUN cd /var/www/html/mGSV \
&& mkdir tmp \
&& chmod -R 777 tmp
RUN cd /var/www/html/mGSV && sed -i.bak "s|'gsv'|'mgsv_user'|" lib/settings.php \
&& sed -i.bak "s|$database_pass = ''|$database_pass = 'mgsvpass'|" lib/settings.php \
&& sed -i.bak "s|cas-qshare.cas.unt.edu|localhost|" lib/settings.php
RUN cp /var/www/html/mGSV/Arial.ttf /usr/share/fonts/truetype/
#Do not understand
#7. Cleanup scripts are provided to drop database synteny and annotation tables, remove entries from database table 'userinfo' and delete the folder containing image files which are older than 60 days. This task is accomplished by cron job to run the cleanup script every day. To create a cron job, use the command below:
# shell> crontab -e
#At the last line of crontab, copy and paste the line below, and provide the exact path to mgsv/lib/cleanup.php
# 30 04 * * * /var/www/mgsv/lib/cleanup.php
#The script cleanup.php will be executed at 4:30 AM every morning.
#8. mGSV uses the mail function from PHP to send email to users. Speak to your system administrator to provide required information in the PHP configuration file called 'php.ini'.
#9. When installation completes, you can now open Install/index.php (i.e., http://<YOUR_SERVER_DOMAIN_NAME>/mgsv/Install/), which verifies prerequisites, database setup, and installation. YOUR_SERVER_DOMAIN_NAME refers to the domain name of your server.
RUN cd /var/www/html/mGSV/ws \
&& tar -xzf mgsv-ws-server.tar.gz
RUN cd /var/www/html/mGSV/ws/mgsv-ws-server \
&& mvn package
RUN cp -f /var/www/html/mGSV/ws/mgsv-ws-server/target/ws-server-1.0RC1-jar-with-dependencies.jar /var/www/html/mGSV/ws/
RUN cd /var/www/html/mGSV/ws \
&& echo "mgsv_upload_url=http://localhost/mgsv" > config.properties \
&& echo "ws_publish_url=http\://localhost\:8081/MGSVService" >> config.properties \
&& java -jar ws-server-1.0RC1-jar-with-dependencies.jar &
#To stop the web service
#shell> ps aux | grep ws-server-1.0RC1-jar-with-dependencies.jar
#*Note the process id from the output*
#shell> kill -9 <process id>
This is the output which I got:
Successfully tagged mgsvdocker_www:latest
Starting mgsvdocker_www_1 ...
mgsvdocker_db_1 is up-to-date
Starting mgsvdocker_www_1 ... error
ERROR: for mgsvdocker_www_1 Cannot start service www: driver failed programming external connectivity on endpoint mgsvdocker_www_1 (37d78703b379b65521d9fc15d2d1d51379f7eee71f7dc912585e088d8bf1b4e9): Bind for 0.0.0.0:8080 failed: port is already allocated
ERROR: for www Cannot start service www: driver failed programming external connectivity on endpoint mgsvdocker_www_1 (37d78703b379b65521d9fc15d2d1d51379f7eee71f7dc912585e088d8bf1b4e9): Bind for 0.0.0.0:8080 failed: port is already allocated
ERROR: Encountered errors while bringing up the project.
I am not quite sure whether I did a mistake in the docker-compose.yml file or database configuration inside the Dockerfile.
By any chance, do anyone know what I am missing?
Thank you in advance
Hi I am using Cassandra 1.2.4 with Java 8(moving on from 7) as a service .I can run cassandra as a standalone process without any hassle, however when I use it with an Apache Virgo application(3.7.0.D-20150114193621) it fails.
Following is the output in the status.out log file and nothing in the system.log.
+ case "$1" in
+ echo 'Checking status of Cassandra daemon......'
Checking status of Cassandra daemon......
+ is_running
++ get_cass_pid
+++ ps -fC java
+++ grep -w org.apache.cassandra.service.CassandraDaemon
+++ head -n 1
+++ awk '{print $2}'
++ echo
+ pid=
+ '[' x = x ']'
+ return 1
+ stat=1
+ case "$stat" in
+ echo 'Cassandra is not running'
Cassandra is not running
+ exit 1
I only get the below stacktrace in the virgo logs:
ERROR TaskExec-1-thread-8 DE0005I Failed to start cassandra service
Since, it can run fine as a standalone process, there is no issue with setting the $CASSANDRA_HOME,$CLASSPATH or other variables.
I have verified the API call from the application and looks like its not able to start the daemon. Also,any information relating to the cassandra logging will be helpful to debug.