How to deploy Express 4 application with mysql database setup on openshift? - mysql

I am finding it difficult to deploy the Express4 app on Openshift.
The project is working fine on localhost but not being able to push on server
remote: Git Post-Receive Result: failure
remote: Activation status: failure
remote: Activation failed for the following gears:
remote: 55d6d1367628e11bda000128 (Error activating gear: CLIENT_ERROR: Failed to execute: 'control start' for /var/lib/openshift/nodejs
remote: #<IO:0x000000017462a0>
remote: #<IO:0x00000001746228>
remote: )
remote: Deployment completed with status: failure
remote: postreceive failed
The app deployment fails on server.js ....
The express#3 version works fine on server.js(default they provide).
Any help for deploying express#4 version on openshift ???

Related

aws coldbuild failed: ebcli.objects.exceptions.NotFoundError: Environment "flask-daniel-test" not Found

I have github repo here https://github.com/DanielWu1978/flaskbeanstalk
And then configured a codebuild for it. When I run the following command from command line locally, it is ok, but when call the same code from codebuild, it raises the error of "ebcli.objects.exceptions.NotFoundError: Environment "flask-daniel-test" not Found.". Why this happens?
eb deploy flask-daniel-test --verbose
WARNING: Beanstalk configuration header 'eb_codebuild_settings' is missing from Buildspec file; will not use Beanstalk Code Build integration
INFO: Deploying code to flask-daniel-test in region us-west-2
INFO: Getting version label from git with git-describe
Creating application version archive "app-38c0-220705_182941662302".
INFO: creating zip using git archive HEAD
INFO: git archive output: .elasticbeanstalk/
.elasticbeanstalk/config.yml
.gitignore
Makefile
README.md
application.py
buildspec.yml
requirements.txt
INFO: Uploading archive to s3 location: flask-daniel/app-38c0-220705_182941662302.zip
Uploading flask-daniel/app-38c0-220705_182941662302.zip to S3. This may take a while.
Upload Complete.
INFO: Creating AppVersion app-38c0-220705_182941662302
2022-07-05 10:29:47 INFO Environment update is starting.
2022-07-05 10:29:51 INFO Deploying new version to instance(s).
2022-07-05 10:29:55 INFO Instance deployment successfully generated a 'Procfile'.
2022-07-05 10:30:04 INFO Instance deployment completed successfully.
2022-07-05 10:30:09 INFO New application version was deployed to running EC2 instances.
2022-07-05 10:30:09 INFO Environment update completed successfully.
But when run from codebuild. it has the following:

SSIS (SQL Server Integration Services) installation failed

installing the Microsoft.DataTools.IntegrationServices.exe
on a Windows 10 PC, with Visual Studio 2019 already installed,
I got this error:
Can anyone help me understand why this happens?
Thanks a lot in advance.
Luis
Here the last part of the log file:
[5CD0:13EC][2021-05-31T19:42:29]i319: Applied execute package: ISVsix,
result: 0x80131500, restart: None
[5CD0:13EC][2021-05-31T19:42:29]e000: Error 0x80131500: Failed to
execute EXE package. [0AEC:278C][2021-05-31T19:42:29]i329: Removed
package dependency provider: ISVsix, package: ISVsix
[0AEC:278C][2021-05-31T19:42:29]i351: Removing cached package: ISVsix,
from path: C:\ProgramData\Package
Cache\15160B731819F56D87A626F9A2777550340022D7
[0AEC:278C][2021-05-31T19:42:29]i326: Removed dependency:
{ab4889d7-79a3-40dc-9c9e-ccbeca99d453} on package provider:
ISVsixPreInstall, package ISVsixPreInstall
[5CD0:13EC][2021-05-31T19:42:29]i000: MainViewModel.OnPackageAction:
Install Started for package Microsoft SQL Server Integration Services
Projects Pre Install (id: ISVsixPreInstall)
[5CD0:13EC][2021-05-31T19:42:29]i000:
MainViewModel.OnPackageActionProgress: Percent completed: 100, Overall
progress: 14 [0AEC:278C][2021-05-31T19:42:29]i301: Applying rollback
package: ISVsixPreInstall, action: Uninstall, path:
C:\ProgramData\Package
Cache\BB952DD82F1ADAE438C26E4EE6C94F84C07CB447\ISVsixPreInstall.exe,
arguments: '"C:\ProgramData\Package
Cache\BB952DD82F1ADAE438C26E4EE6C94F84C07CB447\ISVsixPreInstall.exe"
/instanceIds:"2904af6a,6f5e5ef0"
/log:"C:\Users\Luigi\AppData\Local\Temp\SsdtisSetup\Microsoft.DataTools.IntegrationServices_20210531194052_0_ISVsixPreInstall.log"
/u' [5CD0:13EC][2021-05-31T19:42:29]i000:
MainViewModel.OnPackageAction: Install Completed for package Microsoft
SQL Server Integration Services Projects Pre Install (id:
ISVsixPreInstall) [5CD0:13EC][2021-05-31T19:42:29]i319: Applied
rollback package: ISVsixPreInstall, result: 0x0, restart: None
[0AEC:278C][2021-05-31T19:42:29]i329: Removed package dependency
provider: ISVsixPreInstall, package: ISVsixPreInstall
[0AEC:278C][2021-05-31T19:42:29]i351: Removing cached package:
ISVsixPreInstall, from path: C:\ProgramData\Package
Cache\BB952DD82F1ADAE438C26E4EE6C94F84C07CB447
[5CD0:13EC][2021-05-31T19:42:29]i000:
MainViewModel.OnPackageActionProgress: Percent completed: 100, Overall
progress: 100 [0AEC:278C][2021-05-31T19:42:29]i330: Removed bundle
dependency provider: {ab4889d7-79a3-40dc-9c9e-ccbeca99d453}
[0AEC:278C][2021-05-31T19:42:29]i352: Removing cached bundle:
{ab4889d7-79a3-40dc-9c9e-ccbeca99d453}, from path:
C:\ProgramData\Package Cache{ab4889d7-79a3-40dc-9c9e-ccbeca99d453}
[5CD0:13EC][2021-05-31T19:42:29]e000: MainViewModel.OnBundleAction:
Bundle action failed: Unknown error (0x80131500) (0x80131500)
[5CD0:13EC][2021-05-31T19:42:29]i399: Apply complete, result:
0x80131500, restart: None, ba requested restart: No
[5CD0:4D80][2021-05-31T19:48:12]i000: MainViewModel.OpenUrl: Opening
url:
C:\Users\Luigi\AppData\Local\Temp\SsdtisSetup\Microsoft.DataTools.IntegrationServices_20210531194052.log
[5CD0:4D80][2021-05-31T20:04:01]i000: MainViewModel.OpenUrl: Opening
url:
C:\Users\Luigi\AppData\Local\Temp\SsdtisSetup\Microsoft.DataTools.IntegrationServices_20210531194052.log
And here only the ERROR rows:
[0AEC:278C][2021-05-31T19:42:29]e000: Error 0x80131500: Process
returned error: 0x80131500 [0AEC:278C][2021-05-31T19:42:29]e000: Error
0x80131500: Failed to execute EXE package.
[5CD0:13EC][2021-05-31T19:42:29]e000: Error 0x80131500: Failed to
configure per-machine EXE package. ...
[5CD0:13EC][2021-05-31T19:42:29]e000: Error 0x80131500: Failed to
execute EXE package. ... [5CD0:13EC][2021-05-31T19:42:29]e000:
MainViewModel.OnBundleAction: Bundle action failed: Unknown error
(0x80131500) (0x80131500)
After hours trying to figure out why my installation was failing, I found a post where someone suggested to repair Visual Studio installations via VS Installer, I did it, of course this meant that the enviroment was going to be restored as new, but it solved my issue.
I hope this could help you friend, have a nice day!
For me, the reason of failure was my PC was missing some of the target packs. No need to Repair the installation.
I installed .NET 4, 4.5 and 4.7 targeting packs from VS installation media and the SSIS installation succeeded smoothly.
I solved this problem by following:
Installed all .Net Framework versions 4.X with
Visual Studio Installer
I also tried to install Microsoft.DataTools.IntegrationServices.exe on a Windows 10 PC, with Visual Studio 2019 already installed.
Try running the .exe file with "Administrator" privileges.
My error code was "Unknown error (0xffffffff) (0xFFFFFFFF)

web.xml not found during maven build of Tomcat application

I am receiving the following error when pushing a J2EE app to my OpenShift Tomcat application:
remote: [INFO] Webapp assembled in [40 msecs]
remote: [INFO] Building war: /var/lib/openshift/54eb9daa5973ca7b9a0000d9/app- root/runtime/repo/webapps/ROOT.war
remote: [INFO] ------------------------------------------------------------------------
remote: [INFO] BUILD FAILURE
remote: [INFO] ------------------------------------------------------------------------
remote: [INFO] Total time: 4.339s
remote: [INFO] Finished at: Wed Feb 25 14:51:14 EST 2015
remote: [INFO] Final Memory: 8M/112M
remote: [INFO] ------------------------------------------------------------------------
remote: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project dragonfly: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
remote: [ERROR]
remote: [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
remote: [ERROR] Re-run Maven using the -X switch to enable full debug logging.
remote: [ERROR]
remote: [ERROR] For more information about the errors and possible solutions, please read the following articles:
remote: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
I have my web.xml in webapp/WEB-INF/web.xml and in .openshift/config/web.xml
I'm also confused about webapp vs. WebContent.
The web.xml file must be placed under src/main/webapp/WEB-INF. The error you are getting is because Maven is not finding web.xml at this location.
Also, I will take a wild guess but I presume WebContent is the folder generated by Eclipse when you create a web-application. If this folder is present, then there is a issue with your Eclipse project configuration. You should follow Maven conventions through out your project (and add the Maven nature to your Eclipse project with the m2e plugin).

Unable to see Openshift application

I added a new openshift application. I followed the instructions and uploaded my code via git push.
The upload logs seem to be fine:
1)the ROOT.war got created:
remote: [INFO] Packaging webapp
remote: [INFO] Assembling webapp [opinion] in [/var/lib/openshift/542ee542e0b8cd
2ca700037d/app-root/runtime/repo/target/opinion]
remote: [INFO] Processing war project
remote: [INFO] Copying webapp resources [/var/lib/openshift/542ee542e0b8cd2ca700
037d/app-root/runtime/repo/src/main/webapp]
remote: [INFO] Webapp assembled in [108 msecs]
remote: [INFO] Building war: /var/lib/openshift/542ee542e0b8cd2ca700037d/app-roo
t/runtime/repo/webapps/ROOT.war
remote: [INFO] WEB-INF/web.xml already added, skipping
remote: [INFO] -----------------------------------------------------------------
-------
remote: [INFO] BUILD SUCCESS
remote: [INFO] -----------------------------------------------------------------
-------
remote: [INFO] Total time: 1:24.196s
remote: [INFO] Finished at: Fri Oct 03 14:11:18 EDT 2014
remote: [INFO] Final Memory: 9M/91M
remote: [INFO] -----------------------------------------------------------------
2) Deployment was a success
remote: + rm -rf /var/lib/openshift/542ee542e0b8cd2ca700037d/jbossews//work/
remote: ++ ls /var/lib/openshift/542ee542e0b8cd2ca700037d/app-root/runtime/repo/
/webapps
remote: + '[' 'META-INF
remote: ROOT.war
remote: WEB-INF
remote: css
remote: fonts
remote: img
remote: js' ']'
remote: + rsync -rS --delete /var/lib/openshift/542ee542e0b8cd2ca700037d/app-roo
t/runtime/repo//webapps/ /var/lib/openshift/542ee542e0b8cd2ca700037d/jbossews//w
ebapps/
remote: + hot_deploy_enabled_for_latest_deployment
remote: ++ ruby_sdk latest_deployment_metadata.hot_deploy
remote: ++ oo-ruby -I/usr/lib/openshift/cartridge_sdk -rruby/sdk -e 'include Ope
nShift::CartridgeSdk; puts latest_deployment_metadata.hot_deploy'
remote: + enabled=false
remote: + '[' false == true ']'
remote: + return 1
remote: Starting jbossews cartridge
remote: Found 127.4.212.129:8080 listening port
remote: -------------------------
remote: Git Post-Receive Result: success
remote: Activation status: success
remote: Deployment completed with status: success
To ssh://542ee542e0b8cd2ca700037d#opinion-expertviews.rhcloud.com/~/git/opinion.
git/
e2a907c..08d3a44 master -> master
However, when I hit the url(http://opinion-expertviews.rhcloud.com) I am still seeing the
"Welcome to your JBossEWS (Apache/Tomcat) application on OpenShift" screen
What am I missing?
Solved:
I was uploading my files incorrectly. Corrected way:
I compiled my projects into a war file, put it into the webapps
folder at root of the openshift git directory.
removed the pom.xml
file pushed the updated folder to my application
Application now available at:
http://app_name-namespace.rhcloud.com/app_name.
Thanks a lot for your help and guiding me, although it was stupid of me to miss these points
Since you are deploying your war file with a name other than ROOT.war, you will need to visit your application at the context that is the same as the name of the war file you deployed. For example, if your war file was named myapplication.war, your url would be http://app-domain.rhcloud.com/myapplication, to fix this, you can rename your war file ROOT.war, and your application would be available at http://app-domain.rhcloud.com/

Jenkins-Sonar communication on Openshift

I am making a development environnement based on Jenkins and Sonar.
Both are placed on isolated gears.
The Jenkins gear has been created with the Instant App option.
The Sonar gear has been created thanks to these github indications.
I created a Jenkins free-style job in order to analysis a Maven project.
The script used on that job is based on this wordpress article.
# Build script of the Job
settingsPath=$OPENSHIFT_DATA_DIR/settings.xml
settings="<settings>\n <localRepository>$OPENSHIFT_DATA_DIR</localRepository>\n</settings>\n"
echo $settings > $settingsPath
# Cleaning of the workspace
mvn --global-settings $settingsPath clean test
# Preparation of Sonar informations
export SONAR_JDBC="-Dsonar.jdbc.url=jdbc:mysql://xxx.xxx.xxx.xxx:3306/sonar?useUnicode=true&characterEncoding=utf8"
export SONAR_DRIVER=-Dsonar.jdbc.driver=com.mysql.jdbc.Driver
export SONAR_DBUSER=-Dsonar.jdbc.username=xxx
export SONAR_DBPASS=-Dsonar.jdbc.password=xxx
export SONAR_URL=-Dsonar.host.url=http://sonar-alc.rhcloud.com
export SONAR_OPTS="$SONAR_JDBC $SONAR_DRIVER $SONAR_DBUSER $SONAR_DBPASS $SONAR_URL"
# Sonar analysis
mvn --global-settings $settingsPath sonar:sonar $SONAR_OPTS
On the execution of the mvn sonar:sonar command, I have the following error:
Can not execute SonarQube analysis: Fail to connect to database: Cannot create PoolableConnectionFactory (Communications link failure
Here is the stacktrace corresponding to this error:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ClientEvalcolor 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- sonar-maven-plugin:2.1:sonar (default-cli) # ClientEvalcolor ---
[INFO] SonarQube version: 3.3.1
[INFO] [03:28:09.324] Create JDBC datasource for jdbc:mysql://xxx.xxx.xxx.xxx:3306/sonar?useUnicode=true&characterEncoding=utf8
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.634s
[INFO] Finished at: Mon Nov 25 03:28:10 EST 2013
[INFO] Final Memory: 12M/182M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.1:sonar (default-cli) on project ClientEvalcolor: Can not execute SonarQube analysis: Fail to connect to database: Cannot create PoolableConnectionFactory (Communications link failure
[ERROR]
[ERROR] The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.): No route to host
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Build step 'Execute shell' marked build as failure
Finished: FAILURE
I know that an Openshift mysql database isn't accessible from a remote server, but Sonar seems to be runnable on Openshift, and the article that I previously linked successfully did it.
Do you have any idea about how to fix that ?
Thank you,
Alvaro C.
I finally succeeded on making my Jenkins gear send data to my Sonar gear !
I'll explain the solution I found here, maybe it will help some people.
There a three ways to access an Openshift database:
The gear that contains that database can access it easily on localhost:3306. That's the usual case.
From your own computer, you can bind ports (with the rhc tool) in order to access the database. This can't be applied from another gear, and requires the rhc tool to keep running.
Any gear from your account can access the database of a scalable application.
Usage:
When creating the Sonar gear, it's necessary to set the gear as scalable (this can't be done with jenkins/diy gears). Adding a database cartridge to this gear will consume 1 gear, but this database can be accessed from any Openshift application.
Notice that this new database will have a port different than 3306 (in my case, 39536). If you don't have this, that's probably that the embedded app isn't set scalable.
The Jenkins job script that I put in my question is correct. Changing all these "xxxxx" and the port with your database info will permit Jenkins to do his job !