How to deploy Apache-Jmeter-5.1.1 on Pivotal Cloud Foundary - jmeter

I am trying to deploy an Apache-Jmeter (version 5.1.1), a stand-alone application on Pivotal cloud Foundry but unable to
I have the Apache-Jmeter (version 5.1.1) set-up running on my windows machine so I tried to push that directory/folder to PCF as an App but it failed with the below error
C:\Program Files\apache-jmeter-5.1.1>cf push apache-jmeter-5.1.1
Pushing from manifest to org dev-testing/ space Dev as user1...
Using manifest file C:\Program Files\apache-jmeter-5.1.1\manifest.yml
Getting app info...
readat C:\Program Files\apache-jmeter-5.1.1\bin\jmeter.bat: negative offset
FAILED
Here is my manifest.yml file looks like :
---
applications:
- name: jmeter-5-1-pcf
path: bin/jmeter.bat
memory: 512m
instances: 1
I should be able to run my Jmeter scripts (I mean test.jmx) from Pivotal Cloud Foundry, also It could be good if I can see the UI of Apache-Jmeter which was deployed on Pivotal Cloud Foundry

OK, easy answer first.
readat C:\Program Files\apache-jmeter-5.1.1\bin\jmeter.bat: negative offset
FAILED
It's failing because that's a Windows bat file, and you're trying to run it on Linux. You would want to run the .sh start script, and make sure you're pushing the .tgz download from the JMeter Binaries page.
Beyond that, it gets murky and depends on what exactly you want to run?
You could simply run jmeter from the command line, like here. In that case, you don't have a persistent running server though, which poses a problem because Cloud Foundry expects your app to run forever.
You could work around this by using a task instead. You would need to push JMeter as an app, let it stage then stop the app. After that you could cf run-task to execute jmeter -n -t plan.jmx ....
The other option would be to try and run JMeter remote, but that's not going to work well because JMeter uses Java RMI, which is not HTTP based so it would require use of Cloud Foundry TCP routes, or copious use of cf ssh to make tunnels. Neither are great options.
I would suggest using the cf cli. A quick test, the following worked for me.
Download the .tgz binary release from JMeter's web site.
Add the following .cfignore file. It just skips stuff you don't need.
NOTICE
LICENSE
README.md
docs
printable_docs
licenses
extras
Add a file .profile. This will set a couple env variables to make JMeter work.
export JAVA_HOME=.java-buildpack/open_jdk_jre/
export PATH=$PATH:$JAVA_HOME/bin
Put your .jmx files into the JMeter directory.
Then run cf push -b java_buildpack -m 1G -c 'sleep 9999' -u process --no-route jmeter-cli.
The app should start and do nothing, immediately run cf stop jmeter-cli. You just need to do this so that the app stages.
Then run cf run-task jmeter-cli './bin/jmeter -n -t your-test.jmx'.
Run cf logs --recent jmeter-cli and see the results. Or run cf logs jmeter-cli in a second terminal and stream them as the task runs.
Example output:
2019-09-08T22:06:35.72-0400 [CELL/0] OUT Cell e5f61515-c164-4c36-9686-faa2a0a363ed creating container for instance 29a1deb6-04c1-4105-91f8-0a8a5dadf367
2019-09-08T22:06:36.56-0400 [CELL/0] OUT Cell e5f61515-c164-4c36-9686-faa2a0a363ed successfully created container for instance 29a1deb6-04c1-4105-91f8-0a8a5dadf367
2019-09-08T22:06:41.18-0400 [APP/TASK/4e6e54e6/0] ERR Sep 09, 2019 2:06:41 AM java.util.prefs.FileSystemPreferences$1 run
2019-09-08T22:06:41.18-0400 [APP/TASK/4e6e54e6/0] ERR INFO: Created user preferences directory.
2019-09-08T22:06:41.61-0400 [APP/TASK/4e6e54e6/0] OUT Creating summariser <summary>
2019-09-08T22:06:41.61-0400 [APP/TASK/4e6e54e6/0] OUT Created the tree successfully using Test Google.jmx
2019-09-08T22:06:41.61-0400 [APP/TASK/4e6e54e6/0] OUT Starting the test # Mon Sep 09 02:06:41 UTC 2019 (1567994801615)
2019-09-08T22:06:41.63-0400 [APP/TASK/4e6e54e6/0] OUT Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445
2019-09-08T22:06:43.66-0400 [APP/TASK/4e6e54e6/0] OUT summary = 30 in 00:00:02 = 19.9/s Avg: 99 Min: 60 Max: 450 Err: 0 (0.00%)
2019-09-08T22:06:43.66-0400 [APP/TASK/4e6e54e6/0] OUT Tidying up ... # Mon Sep 09 02:06:43 UTC 2019 (1567994803664)
2019-09-08T22:06:43.66-0400 [APP/TASK/4e6e54e6/0] OUT ... end of run
2019-09-08T22:06:44.39-0400 [APP/TASK/4e6e54e6/0] OUT Exit status 0
The only other thing to mention is that you can use the -l option and write the output to a JTL file. If you do that, it will write to the local file system and when your task ends that file will disappear, you won't be able to get it.
If you need to write the results to a JTL file, then you will also need to modify the task command that you run to, upon completion of JMeter, upload the results file to persistent storage like S3.
Hope that helps!

Related

Connect to Jenkins server via SSH

I was wondering if I can ssh a local instance of Jenkins. When I go to Jenkins CLI menu in the UI, there's a comment saying the below:
You can access various features in Jenkins through a command-line
tool. See the documentation for more details of this feature. To get
started, download jenkins-cli.jar, and run it as follows:
java -jar jenkins-cli.jar -s http://localhost:8080/ -webSocket help
So I tried it and it worked but it only gave a list of limited commands which I can execute. So I searched more and found I can use -ssh instead of -webSocket but I get the same result as -webSocket.
What I want to do is accessing the Jenkins bash so I can test my build scripts.
I'm trying
ssh 127.0.0.1 -p 23 // I set this port in the settings
but I keep getting :
shell request failed on channel 0
is it impossible what I'm trying to do? if not, how can I achieve it?

Why does ApplicationStart timeout with AWS code deploy?

I am using codedeploy to deploy a springboot app to an ec2. But I keep getting a script timeout error. I event set the timeout to 60 seconds event tho the application always starts up within 20 seconds. The application starts up fine. I run top on the linux instance and see the java process started up. I can then use postman to hit the http status check endpoint and confirm that it has started up successfully. But this is what it looks like in the code deploy console:
The appspec.yml file looks like this
The server_start.sh file looks like this.
Why is this happening? Thanks.
I think this has more to do with how Linux process works than with Code Build. I'm far from being a specialist on that, but according to with AWS documentation, there is a certain way you must use to start your long-running processes, as a Java application
The syntax is:
#!/bin/bash
/tmp/sleep.sh > /dev/null 2> /dev/null < /dev/null &
Replace the sleep by your Java command.
More details here
You should put some some codes of your script to the BeforeInstall or AfterInstall.
remove java -jar application.jar
BeforeInstall – You can use this deployment lifecycle event for preinstall tasks, such as decrypting files and creating a backup of the current version.
Install – During this deployment lifecycle event, the CodeDeploy agent copies the revision files from the temporary location to the final destination folder. This event is reserved for the CodeDeploy agent and cannot be used to run scripts.
AfterInstall – You can use this deployment lifecycle event for tasks such as configuring your application or changing file permissions.
ApplicationStart – You typically use this deployment lifecycle event to restart services that were stopped during ApplicationStop.
Then create another bash script for your ApplicationStart. Put the line your removed earlier on this script.

Error in hyperledger fabric writing your first app using windows 10

I am following the getting started guide in the URL below
http://hyperledger-fabric.readthedocs.io/en/latest/
I installed all prerequisites.
Using windows 10.
After installation of prerequisites   I move to next section “Write your First Application” URL given below
http://hyperledger-fabric.readthedocs.io/en/latest/write_first_app.html
After download “fabric-sample” from git  when I try “startFabric.sh” script in “fabcar” subdirectory for launch the network I am  encountering an error are show below.
UTC [main] main -> ERRO 001 Cannot run peer because cannot init crypto, missing /etc/hyperledger/fabric/C:/Program Files/Git/etc/hyperledger/msp/users/Admin#org1.example.com/msp folder
If you look at the path of the missing file you'll see it is malformed.  It was resolved by issuing an export command before running the startFabric.sh script:
export MSYS_NO_PATHCONV=1
./startFabric.sh
See https://jira.hyperledger.org/browse/FAB-5392?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel.
Thanks Tim & Gari

Jmeter Execution on Remote system does not work

I am able to successfully execute JMX file on local instance but execution on Remote system(Slaves) fails. I am using latest version of Jmeter. This is the second time I am facing the issue.
Can you please advise if I am missing anything here. I initially thought it was because I had toggled off the script from Execution but thats not the case here.
My script(JMX) has a Transaction controller(under a Thread group) with some http requests.
Code from command line executed is as below. Its the same result when I execute from Run>>Remote Start
sh Jmeter.sh -n -t R3Performance_Fragment.jmx -R 192.168.7.25 -G ucount=1 -l Results/r1.csv
Results are as below. It just starts and winds up without initiating the Execution at all.
Krishna-MBP:bin krishnap$ sh Jmeter.sh -n -t
R3Performance_Fragment.jmx -R 192.168.7.25 -G ucount=1 -l
Results/r1.csv Creating summariser Created the tree
successfully using R3Performance_Fragment.jmx Configuring remote
engine: 192.168.7.25 Starting remote engines Starting the test # Mon
May 29 13:07:40 IST 2017 (1496043460922) Remote engines have been
started Waiting for possible Shutdown/StopTestNow/Heapdump message on
port 4446 summary = 0 in 00:00:00 = ******/s Avg: 0 Min:
9223372036854775807 Max: -9223372036854775808 Err: 0 (0.00%)
Tidying up remote # Mon May 29 13:07:43 IST 2017 (1496043463653) ...
end of run
Check the .jmx file you uploaded. If you are using any .csv file. Need to change the location of it. It will be pointing to your local machine. Change it to remote machines address
The answer is always in jmeter.log file:
Look into jmeter.log file on master for any suspicious entries
Run JMeter slave instance(s) like:
jmeter ${RMI_HOST_DEF} -Dserver_port=${SERVER_PORT:-1099} -s -j jmeter-server.log -Djava.rmi.server.hostname=xxx.xxx.xxx.xxx -Dserver_port=xxxx -s -j jmeter-server.log
Look into jmeter-server.log file on remote slave(s)
Most likely your test fragment configuration is not correct. JMeter is not smart enough to copy dependencies (external .jmx files) automatically, you should copy it to all remote slave(s) manually prior to starting the test. The same applies to i.e. CSV configuration files, files you will be uploading, etc. Other reasons could be in:
0 threads (virtual users)
disabled thread group/transaction controller
incorrect test fragment reference
See the following guides for more information:
JMeter Distributed Testing Step-by-step
How to Manage Large JMeter Scripts With JMeter Test Fragments

Smartfoxserver 2X linux 64 running on EC2 via dotcloud - how to install?

I am currently trying to deploy smartfoxserver 2X on EC2 using dotcloud. I have been able to detect the private ip of the amazon web instance, and using the dotcloud tools I have been able to determine the correct port. However, I have difficulty installing the server proper via the command line so that I can log into it using the AdminTool.
My postinstall is fairly straightforward:
./SFS2X/sfs2x-service start-launchd
I find that on 'dotcloud push' there is a fair amount of promising output in my cygwin terminal, but the push hangs after saying that the sfs2x-service has been launched correctly, until timeout.
Consequently, my question is, has anyone found a way to install SFS2X on EC2 via dotcloud successfully? I managed to have partial success with SFS Pro, with a complete push to dotcloud, by calling ./jre/bin/java -jar installer.jar in my postinstall. Do I need to do extra legwork and build an installer jar for SFS2X? Is there a way that would be best to do this?
I do understand that there is a standard approach to deployment with SFS2X using RightScale on EC2, however I am interested in deployment using the dotcloud platform.
Thanks in advance.
The reason why it is hanging is because you are trying to start your process in the postinstall, and this is not the correct place to do that. The postinstall script is suppose to finish, if it doesn't the deployment will time out, and then get cancelled.
Once the postinstall script is finished, it will then finish the rest of your deployment.
See this page for more information about dotCloud postinstall script:
http://docs.dotcloud.com/0.9/guides/hooks/#post-install
Pay attention to this warning at the end.
Warning:
If your post-install script returns an error (non-zero exit code), or if it runs for more than 10 minutes, the platform will consider that your build has failed, and the new version of your code will not be deployed.
Instead of putting this in the postinstall script, you should add it as a background process, so that it starts up once the deployment process is complete.
See this page for more information on adding background processes to dotCloud services:
http://docs.dotcloud.com/0.9/guides/daemons/
TL;DR: You need to create a supervisord.conf file, and add it to the root of your project, and add your service to that.
Example (you will need to change to fit your situation):
[program:smartfoxserver]
command = /home/dotcloud/current/SFS2X/sfs2x-service start-launchd
Also, make sure you have the correct dotCloud service specified in your dotcloud.yml in order to have the correct binary and libraries installed for what your smartfoxserver application.

Resources