How can I deploy a IIB application using the command line like it is done by the toolkit (gui)? - ibm-integration-bus

I would like to execute exactly the same steps done by the IIB Toolkit deploy (right click the application and Deploy...to an integration server) but using the command line.
In my humble opinion it is an action that does trigger several steps/commands.

Below are the commands to deploy an application to integration server:
Create a bar file using mqsicreatebar command.
Deploy the created bar file from step 1 using mqsideploy command.

Use the below command:
mqsideploy node_name -e server_name -a <bar_file_location>_file.bar

Related

WebLogic in Docker: how to start managed servers automatically

I am learning Docker, and creating an image for Oracle WebLogic 12.2.1.4 server.
My image is ready, working fine. It contains
an admin server
two managed servers
When I run my image with docker run -d -p 7001:7001 --name WL oracle/weblogic-12.2.1.4.0:1.0 the admin server starts automatically because I added the following line at the end of my Dockerfile:
CMD /u01/oracle/user_projects/domains/$DOMAIN_NAME/startWebLogic.sh
But I need to start managed servers manually. I need to login into the container and start them by hand:
docker exec -it WL /bin/bash
./startManagedWebLogic.sh MANAGED_SERVER_1 http://localhost:7001 &
./startManagedWebLogic.sh MANAGED_SERVER_2 http://localhost:7001 &
This is not what I want. I want to start managed servers automatically after admin server is up and running.
I was thinking about to create a new bash script, copy it into the image and use it to boot up the admin and managed servers. Like this:
start-wls-domain.sh
#!/bin/bash
/u01/oracle/user_projects/domains/$DOMAIN_NAME/startWebLogic.sh &
# there are a more sophisticated way to check the status of the admin server but it is okay for test
sleep 60
./startManagedWebLogic.sh MANAGED_SERVER_1 http://localhost:7001 &
./startManagedWebLogic.sh MANAGED_SERVER_2 http://localhost:7001 &
This script can be called from Dockerfile with CMD command.
But with this solution, I lost the ability to see the output on the default Docker log. The docker logs WL -f will display nothing.
Another issue with this bash script solution is if this script finished the container will stop running. Do I need an infinite loop at the end of this script?
If possible I would like to have a solution without start-wls-domain.sh.
What is the best and easiest way to start Weblogic managed servers automatically within a Docker container?
I followed the suggestions and I run different servers in different containers. That way I was able to start properly the server.
I published the solution on Github, here.

How to run Spring Boot Application as a Service?

I have deployed my web application on company server by executing jar files then the project is running fine.But when i close the jar and again try to run the project on browser then client is not able to access the application.I want solution on this that if i close the jar then also client can access the application.
you can use this simple command to run a jar file as background service...
javaw -jar test.jar
after run this command you could not detect any change in cmd...and can close your command prompt. after 1 or 2 minute enter your URL in browser .. you will see your web program is running...
before run this command must be stop previously running jar for avoid same port conflict
for more details
When you close the cmd prompt, your java application will also be killed. To keep the java application running after closing the terminal you have to use the below command.
nohup java -jar app_name.jar &
just replace the app_name with your application name and run the command.

Nohup didn't work in Jenkins shell

I want my JBoss server to run in background, for that I am using nohup ./startPID.sh > /dev/null 2>&1& command. But when I pass same command in Jenkins, it doesn't work as expected. The console output in Jenkins says "command ran successfully" but in backend the JBoss server is still down.
Any inputs?
Regards
Manish Mehra
Use "at now" instead of "nohup"
In your job jenkins (execute shell) put :
set +e #so "at now" will run even if java -jar fails
#Run java app in background
echo "java -jar $(ls | grep *.jar | head -n 1)" | at now + 1 min
You could look at the JBoss management plugin
which spins up JBoss for you
This plugin allows to manage a JBoss Application Server during build
procedure.
With the plugin we can start/stop JBoss AS. It's very useful if we
need to run some integration tests against of the server. There is
also operation allows verification if artifacts are deployable.
It looks to be quite an old plugin but has cuurent users

How to deploy SpringBoot Maven application with Jenkins ?

I have a Spring Boot application which runs on embedded Tomcat servlet container mvn spring-boot:run . And I don’t want to deploy the project as separate war to standalone Tomcat.
Whenever I push code to BitBucket/Github, a hook runs and triggers Jenkins job (runs on Amazon EC2) to deploy the application.
The Jenkins job has a post build action: mvn spring-boot:run, the problem is that the job hangs when post build action finished.
There should be another way to do this. Any help would be appreciated.
The problem is that Jenkins doesn't handle spawning child process from builds very well. Workaround suggested by #Steve in the comment (nohuping) didn't change the behaviour in my case, but a simple workaround was to schedule app's start by using the at unix command:
> echo "mvn spring-boot:run" | at now + 1 minutes
This way Jenkins successfully completes the job without timing out.
If you end up running your application from a .jar file via java -jar app.jar be aware that Boot breaks if the .jar file is overwritten, you'll need to make sure the application is stopped before copying the artifact. If you're using ApplicationPidListener you can verify that the application is running (and stop it if it is) by adding execution of this command:
> test -f application.pid && xargs kill < application.pid || echo 'App was not running, nothing to stop'
I find very useful to first copy the artifacts to a specified area on the server to keep track of the deployed artifacts and not to start the app from the jenkins job folder. Then create a server log file there and start to listening to it on the jenkins window until the server started.
To do that I developed a small shell script that you can find here
You will also find a small article explaining how to configure the project on jenkins.
Please let me know if worked for you. Thnaks
The nohup and the at now + 1 minutes didn't work for me.
Since Jenkins was killing the process spun in the background, I ensured the process to not be killed by setting a fake BUILD_ID to that Jenkins task. This is what the Jenkins Execute shell task looks like:
BUILD_ID=do_not_kill_me
java -jar -Dserver.port=8053 /root/Deployments/my_application.war &
exit
As discussed here.
I assume you have a Jenkins-user on the server and this user is the owner of the Jenkins-service:
log in on the server as root.
run sudo visudo
add "jenkins ALL=(ALL) NOPASSWD:ALL" at the end (jenkins=your Jenkins-user)
Sign In in Jenkins and choose your jobs and click to configure
Choose "Execute Shell" in the "Post build step"
Copy and paste this:
service=myapp
if ps ax | grep -v grep | grep -v $0 | grep $service > /dev/null
then
sudo service myapp stop
sudo unlink /etc/init.d/myapp
sudo chmod +x /path/to/your/myapp.jar
sudo ln -s /path/to/your/myapp.jar /etc/init.d/myapp
sudo service myapp start
else
sudo chmod +x /path/to/your/myapp.jar
sudo ln -s /path/to/your/myapp.jar /etc/init.d/myapp
sudo service myapp start
fi
Save and run your job, the service should start automatically.
This worked for me on jenkins on a linux machine
kill -9 $(lsof -t -i:8080) || echo "Process was not running."
mvn clean compile
echo "mvn spring-boot:run" | at now + 1 minutes
In case no process on 8080 it will print the message and will continue.
Make sure that at is installed on your linux machine. You can use
sudo apt-get install at
to install at

How to stop/start specfic WebSphere-deployed EAR from command line?

I'm throwing a dependency jar into my exploded EAR on WebSphere app server. I need to stop/start the EAR to get WS to execute the new code. Is there a way to do this from command line?
Try running something like this:
/opt/ibm/websphere/appserver/profiles/<MyProfileName>/bin/wsadmin.sh -c "AdminControl.invoke(AdminControl.queryNames('type=ApplicationManager,process=<MyServerName>,*'),'stopApplication','MyAppName')" -lang jython
It will prompt you for a WAS Userid and password (in case you have enabled "Administrative Security") and when you enter them - provided your userid has at least been assigned the Operator Role - your application will be stopped.
In a similar way you may start the same application.
You should be able to manage that using the wsadmin command line tool provided as a part of your WAS installation. Pretty much any administration task can be scripted using this tool.
I don't know the specific command to do what you've asked but here is a link to the documentation that should help get you going.
http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Ftxml_script.html

Resources