Not able to push my local app to bluemix - ibm-cloud

I had an app running on another bluemix account. I wanted to copy the app and run it in another bluemix account. So I downloaded code from github repo., but when I am trying to push this app to another account I am seeing following error.
Note : I used cf push to push the downloaded app. Any help ?
Log :
2014-12-16T14:49:15.41+0530 [API] OUT Updated app with guid e2fca26a-c62d-47 5d-8c21-8e959ae6632c ({"state"=>"STOPPED"})
2014-12-16T14:49:42.10+0530 [DEA] OUT Got staging request for app with id e2 fca26a-c62d-475d-8c21-8e959ae6632c
2014-12-16T14:49:45.08+0530 [API] OUT Updated app with guid e2fca26a-c62d-47 5d-8c21-8e959ae6632c ({"state"=>"STARTED"})
2014-12-16T14:49:45.65+0530 [STG] OUT -----> Downloaded app package (4.6M)
2014-12-16T14:49:46.15+0530 [STG] OUT -----> Downloaded app buildpack cache(4.4M)
2014-12-16T14:49:48.62+0530 [STG] OUT Staging failed: An application could not be detected by any available buildpack
2014-12-16T14:49:49.37+0530 [API] ERR Encountered error: An app was not succ
essfully detected by any available buildpack

Please check your Manifest.yml. Either your app is missing it or has some wrong entry. you can look for this file in your downloaded app. And also don't forget to pass build pack name when running push command.
This link could be helpful:
https://ibm.biz/BdEgub

What language is the app in? Sometimes Cloud Foundry can't detect the type of app you are running and when you push the app you need to tell it what kind of app it is. We can do that with some of the following commands. I went ahead and posted it for a couple different languages. More info here. https://www.ng.bluemix.net/docs/#starters/byob.html
To see all the "built in" buildpacks run the following command.
cf buildpacks
You will get something like the following.
Getting buildpacks...
buildpack position enabled locked filename
liberty-for-java 1 true false buildpack_liberty-for-java_v1.9-20141202-0947-yp.zip
sdk-for-nodejs 2 true false buildpack_sdk-for-nodejs_v1.9.1-20141208-1221-yp.zip
noop-buildpack 3 true false noop-buildpack-20140311-1519.zip
java_buildpack 4 true false java-buildpack-v2.5.zip
ruby_buildpack 5 true false ruby_buildpack-offline-v1.1.1.zip
nodejs_buildpack 6 true false nodejs_buildpack-offline-v1.0.4.zip
liberty-for-java_v1-8-20141118-1610 7 true false buildpack_liberty-for-java_v1.8-20141118-1610-yp.zip
liberty-for-java_v1-3-20140818-1538 8 true false buildpack_liberty-for-java_v1.3-20140818-1538.zip
sdk-for-nodejs_v1-8-20141104-1654 9 true false buildpack_sdk-for-nodejs_v1.8-20141104-1654-yp.zip
Java App:
cf push appname -b liberty-for-java
or cf push appname -b java_buildpack
Node.js:
cf push appname -b sdk-for-nodejs
or cf push appname -b nodejs_buildpack
Ruby:
cf push appname -b ruby_buildpack
There are a bunch of other languages supported as well.
For a list head over to https://github.com/cloudfoundry-community/cf-docs-contrib/wiki/Buildpacks.
If for example you wanted to use PHP you would do the following.
cf push -b https://github.com/cloudfoundry/php-buildpack.git
If you wanted to do Go you would do the following.
cf push appname -b https://github.com/cloudfoundry/go-buildpack.git

two ways to sort out this issue(Assuming its a node.js app)
Run command like below from cf tool mentioning app name :
cf push testmyapp -b sdk-for-nodejs -n testmyapp -m 128M -c 'node main.js'
P.S- "-n" option is used for required hostname on bluemix
mention app name,service name explicitly in manifest.yml file like below:
applications:
name: testmyapp
host: testmyapp
memory: 128M
command: node main.js
P.S- You need to create manifest.yml explicitly if you are using 2nd method.
If you still getting any error,please provide o/p of "cf logs testmyapp --recent"
Alternatively,you can even directly push your app like below:
For Go application to Bluemix, but need to supply -b with the Go Buildpack URL:
cf push appname -b https://github.com/cloudfoundry/go-buildpack.git
Similarly,you can do for other one's.

Looking at the below error,your app is not able to detect correct type of SDK.
2014-12-16T14:49:48.62+0530 [STG] OUT Staging failed: An application could not be detected by any available buildpack
2014-12-16T14:49:49.37+0530 [API] ERR Encountered error: An app was not succ
essfully detected by any available buildpack
you need to check the correct sdk type and mention it while pushing like below:
cf push myapp -b sdk-for-nodejs -n myapp -m 128M -c 'node main.js'

I had a talk in the last CloudFoundry summit on all kinds of app push errors: their symptoms, how to diagnose and what are the solutions. See https://www.slideshare.net/greensight/10-common-errors-when-pushing-apps-to-cloud-foundry. Hopefully it will be helpful.

Given the above answers are a bit stale here is the latest. Build packs version do go out of support. You should check what version of the build pack you are specifying either on the command line using -b option the command line or in your manifest.yml
See the commands to check these items here in the IBM Cloud Doc ibmcloud cf buildpacks. https://cloud.ibm.com/docs/cloud-foundry-public?topic=cloud-foundry-public-using_buildpacks
To see the build packs that are available by language:
ibmcloud cf buildpacks

Related

IBM Cloud Code Engine: How to check logs when app not active?

I have deployed an app to IBM Cloud Code Engine. It has the minimum instances configured to zero, so truly serverless and only active on demand. Now I wanted to check the logs from the CLI with
ibmcloud ce app logs --name myapp --all
it comes back with this message:
FAILED No instances running for application 'myapp'. Verify that
the application name is correct and it is running
How can I check the application logs after it has run?
The Code Engine application (and job) logs can be seen once Application Logging has been enabled. The logs are then available in a separate IBM Cloud Logging dashboard.
I also found this old blog post exlaining how to enable CLI access to those logs. After enabling it I was able to retrieve the app logs using my CLI / development environment.
Depending on what I am after, I am using one of these three lines to get to the log data / lines:
python3 searchLogDNA.py myconfig.json 12 "search term" | jq
for pretty printing, or
python3 searchLogDNA.py myconfig.json 12 "search term" | jq "._line"
to extract the actual log line from the record, or
python3 searchLogDNA.py myconfig.json 12 "search term" | jq "._line | fromjson`"
to turn the string with JSON data in the log line to actual JSON output.

Can't deploy Puppeteer to IBM Cloud

I'm trying to deploy Puppeteer to IBM Cloud via CF with https://github.com/cloudfoundry/nodejs-buildpack buildpack, but always getting the following error:
/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory
(node:131) UnhandledPromiseRejectionWarning: Error: Failed to launch chrome!
My manifest.yml looks like this:
applications:
- path: .
domain: eu-gb.cf.appdomain.cloud
command: npm start
name: Name
host: Name
memory: 128M
instances: 1
disk_quota: 1024M
buildpack: https://github.com/cloudfoundry/nodejs-buildpack
Puppeteer initialised like this:
const browser = await puppeteer.launch({
headless: true,
defaultViewport: null,
args: ['--no-sandbox', '--disable-setuid-sandbox'],
});
Any ideas, how could this be resolved?
Thanks.
This is what worked for me. I just created a node.js app with npm init command, added Puppeteer via npm i puppeteer command, added index.js with basic Puppeteer sample and then followed two approaches
Approach 1:
Here's my manifest.yml file with buildpack and other parameters defined.
applications:
- name: puppeteer-test
buildpack: https://github.com/cloudfoundry/nodejs-buildpack
command: npm start
disk_quota: 1024MB
memory: 128MB
instances: 1
Also, I have run npm install locally creating the node_modules. cf push will pick the node_modules folder. Make sure you have right permissions on the folders
I ran ibmcloud cf push instead of cf push.
Approach 2
Don't define anything in the manifest.yml. Let Cloud foundry decide the buildpack based on the files.
applications:
- name: puppeteer-test
Then run
ibmcloud cf push
There is a third approach where you define everything in .yml files starting from dependencies to buildpacks. You can follow the instructions mentioned in the post here
Note: As Henrik mentioned, you won't see anything when you visit the yourappname.bluemix.net URL as there is not frontend attached to the node.js app.

Node-red in IBM Bluemix crashes while starting after sleeping (lite account)

After sleeping (in lite account type) node-red, created by node-red starter kit, crashes while starting. It is possible to login in editor for a few seconds and then it crashes with error code "an instance of the app crashed: APP/PROC/WEB: Exite with status 1 (out of memory)". Dashboard (node-red-dashboard) was installed before sleeping and worked correctly.
I tried to restart Node-RED, Stop and Start.
I solved this problem. The problem may be due to the memory overflow in the container Garden. Taking into account that the content is stored in the cache, the application cannot start after the restart process, it issues an Exit status 1 (out of memory) error.
The cache is updated only by pushing the application into the cloud.
An option that was checked for application recovery:
View the name of the database for NodeRED (which stores all information about the Node-RED) in Cloudant, for example, "nodered."
Install to PC Cloud Foundry Command Line Interface - CLI https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
Download from github and unarchive the application's code bluemix-starter https://github.com/knolleary/node-red-bluemix-starter (clone or download -> download zip)
In the downloaded folder add a record to a manifest file (manifest.yml) in the env section, in which set the database name (for example, nodered) in Cloudant to environment variable NODE_RED_STORAGE_DB_NAME. Four spaces must be made before NODE_RED_STORAGE_DB_NAME. It is better to make changes using the Notepad ++ editor.
---
applications:
- memory: 256M
env:
OPTIMIZE_MEMORY: true
NODE_RED_STORAGE_DB_NAME: nodered
command: node index.js --settings ./bluemix-settings.js –v
Save the file after changing.
Run the command line (cmd) and then:
a. go to a folder with a downloaded project, such as Windows
cd c:/node-red-bluemix-starter
b. specify the api endpoint where the application is located, in our case:
cf api https://api.eu-gb.bluemix.net
c. send a registration command in the cloud
cf login
d. specify the mail and password (password is entered without explicit character display)
e. pushing the project by specifying the name of your instance Node-RED, for example NameApp
cf push NameApp

Error pushing changes to cloud foundry

from my local host, I connected to blue mix with
cf api https://api.ng.bluemix.net
I logged in and then I pushed the changes with
cf push
However, in the console,
Uploading MY_PROJECT...
Uploading app files from: /Users/MyName/Documents/MY_PROJECT
Uploading 437.7K, 386 files
Done uploading
FAILED
Error processing app files: Error uploading application.
The resource file mode is invalid: File mode '0444' is invalid.
(venv) My-iMac:MY_PROJECT MyName$
How do I trouble shoot this?
According to this link: https://github.com/cloudfoundry/cli/issues/685 the file mode must be at least 600 so I guess you should "raise" the permissions for your resources folder, even if 444 would be technically ok.
Concerning troubleshooting: the error message is right there in your output. If you need more log output, you can use the command
cf logs APP-NAME
See https://docs.cloudfoundry.org/devguide/deploy-apps/streaming-logs.html for further details.

How to update bluemix application but leaving this application available?

I have Java Liberty Web Application on Bluemix. If I need to update it, the app becomes unavailable for a few minutes. Is it possible to update it without turning it off? For example deploy two applications and reroute to a second one one when first is being updated?
Yep. There best way of doing this currently is via the following steps.
deploy original application on myroute.mybluemix.net
make some code changes
deploy changed application on myroute2.mybluemix.net
map myroute.mybluemix.net to the changed application using cf map-route APP_NAME DOMAIN [-n HOSTNAME]. Original application now has myroute.mybluemix.net and the changed application now has myroute.mybluemix.net & myroute2.mybluemix.net. At this point traffic will be routed equally between the two application versions (assuming they have the same number of instances).
unmap myroute.mybluemix.net from the original application using cf unmap-route APP_NAME DOMAIN [-n HOSTNAME]. All traffic on myroute.mybluemix.net will now all be routed to the newer version.
delete original application using cf delete APP_NAME
(optional) remove myroute2.mybluemix.net using cf unmap-route APP_NAME DOMAIN [-n HOSTNAME]
This seems a bit long winded but it will achieve what you want.
This is known as a blue-green deployment, and there are several cloud foundry plugins which will do it 'automatically':
Bluemix's Active Deploy service
This is new function, so it's in beta at the moment. To make the service available, you can add it from the Bluemix service catalog to your space. If you're running cf locally, you'll need to install the plugin:
cf add-plugin-repo bluemix http://plugins.ng.bluemix.net/
cf install-plugin active-deploy -r bluemix
Once it's available (either with a cf plugin install, or the catalog configuration), and you have routes, you can do
cf push --no-route new-version
cf active-deploy-create old-version new-version
Cloud Foundry community-contributed plugin for blue green deployments
You can install this using
cf add-plugin-repo garage https://garage-cf-plugins.eu-gb.mybluemix.net/
cf install-plugin blue-green-deploy -r garage
Then, to push,
cf blue-green-deploy app_name --smoke-test <path to test script>
The smoke test part is optional, but a good idea.