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

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

Related

Failure/timeout invoking Lambda locally with SAM

I'm trying to get a local env to run/debug Python Lambdas with VSCode (windows). I'm using a provided HelloWorld example to get the hang of this but I'm not being able to invoke.
Steps used to setup SAM and invoke the Lambda:
I have Docker installed and running
I have installed the SAM CLI
My AWS credentials are in place and working
I have no connectivity issues and I'm able to connect to AWS normally
I create the SAM application (HelloWorld) with all the files and resources, I didn't change anything.
I run "sam build" and it finishes sucessfully
I run "sam local invoke" and it fails with timeout. I increased the timeout to 10s, still times out. The HelloWorld Lambda code only prints and does nothing else, so I'm guessing the code isn't the problem, but something else relating to the container or the SAM env itself.
C:\xxxxxxx\lambda-python3.8>sam build Your template contains a
resource with logical ID "ServerlessRestApi", which is a reserved
logical ID in AWS SAM. It could result in unexpected behaviors and is not recommended.
Building codeuri:
C:\xxxxxxx\lambda-python3.8\hello_world runtime: python3.8 metadata:
{} architecture: x86_64 functions: ['HelloWorldFunction'] Running
PythonPipBuilder:ResolveDependencies Running
PythonPipBuilder:CopySource
Build Succeeded
Built Artifacts : .aws-sam\build Built Template :
.aws-sam\build\template.yaml
C:\xxxxxxx\lambda-python3.8>sam local invoke Invoking
app.lambda_handler (python3.8) Skip pulling image and use local one:
public.ecr.aws/sam/emulation-python3.8:rapid-1.51.0-x86_64.
Mounting C:\xxxxxxx\lambda-python3.8.aws-sam\build\HelloWorldFunction
as /var/task:ro,delegated inside runtime container Function
'HelloWorldFunction' timed out after 10 seconds
No response from invoke container for HelloWorldFunction
Any hints on what's missing here?
Thanks.
Mostly, a lambda function gets timed out because of some resource dependency. Are you using any external resource, maybe db connection or some REST API call ?
Please put more prints in lambda_handler(your function handler), before calling any resource, then you might know where exactly it is waiting. Also increase the timeout to 1 minute or more because most of the external resource call over HTTPS will have 30 secs timeouts.
The log suggests that either the container wasn't started, or SAM couldn't connect to it.
Sometimes the hostname resolution on Windows can be affected by hosts file or system settings.
Try running the invoke command as follows (this will make the container ports bind to all interfaces):
sam local invoke --container-host-interface 0.0.0.0
...additionally try setting the container-host parameter (set to localhost by default):
sam local invoke --container-host-interface 0.0.0.0 --container-host host.docker.internal
The next piece of puzzle is incorporating these settings into VSCODE. This can to be done in two places:
create samconfig.toml in the root dir of the project with the following contents. This will allow running sam local invoke from the terminal without having to add the command line argument:
version=0.1
[default.local_invoke.parameters]
container_host_interface = "0.0.0.0"
update launch configuration as follows to enable VSCode debugging:
...
"sam": {
"localArguments": ["--container-host-interface","0.0.0.0"]
}
...

Google PHP AppEngine - Deployment Issue with PHP file not being uploaded

I have a very simple PHP app that allows a User to enter names of Cities or Zip-codes into a search box, and the User gets auto-complete suggestions based on data stored in my Google CloudSQL server.
index.html - Renders a simple search box where users can enter search keys and they get auto-complete suggestions. Accomplished via Twitter's typeahead.js library (jQuery plugin).
city.php - PHP file that acts as a translation layer. Receives request from the browser and initiates connection to my Google CloudSQL server where I have a simple database with some city and zipcode data. Returns the data back to the browser as an array.
This works on my local Mac OS X Apache server. I am trying to get this setup to work on Google PHP AppEngine. I created an app.yaml file that looks like this:
runtime: php55
api_version: 2
threadsafe: true
handlers:
- url: /
static_files: index.html
upload: index.html
- url: /(.*)
static_files: www/\1
upload: (.*)
- url: /(.+\.php)$
script: \1
This is where I run into an issue. When I run gcloud app deploy from my local folder (which houses index.html, city.php, and app.yaml), I get the following message in the logs.
Some files were skipped. Pass `--verbosity=info` to see which ones.
You may also view the gcloud log file, found at
[/Users/arjunshah/.config/gcloud/logs/2016.11.13/12.31.04.137587.log].
When I run gcloud app deploy with log verbosity, I see the following:
INFO: Could not find any remote repositories associated with [/Users/arjunshah/Documents/autocomplete]. Cloud diagnostic tools may not be able to display the correct source code for this deployment.
File upload done.
INFO: Manifest: [{'app.yaml': {'sourceUrl': 'https://storage.googleapis.com/staging.ashah-146101.appspot.com/abbe3c7fc03eb43497686990488c54e2ae0533ea', 'sha1Sum': 'abbe3c7fc03eb43497686990488c54e2ae0533ea'}, 'index.html': {'sourceUrl': 'https://storage.googleapis.com/staging.ashah-146101.appspot.com/1865620cc55de1902c2a9636df601f532cb2657a', 'sha1Sum': '1865620cc55de1902c2a9636df601f532cb2657a'}, 'city.php': {'sourceUrl': 'https://storage.googleapis.com/staging.ashah-146101.appspot.com/64999cc8da06416a54be99c43e6e017aa0c1d01a', 'sha1Sum': '64999cc8da06416a54be99c43e6e017aa0c1d01a'}}]
Updating service [default]...
INFO: Previous default version [ashah-146101/default/20161113t122802] is an automatically scaled standard environment app, so not stopping it.
The index.html page loads fine, but when I try to enter names of cities (that I know are in the database), I see the following error in the Google Browser Inspect Element console.
Failed to load resource: https://ashah-146101.appspot.com/city.php?query=P the server responded with a status of 404 ()
Please help!

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.

Google cloud datalab deployment unsuccessful - sort of

This is a different scenario from other question on this topic. My deployment almost succeeded and I can see the following lines at the end of my log
[datalab].../#015Updating module [datalab]...done.
Jul 25 16:22:36 datalab-deploy-main-20160725-16-19-55 startupscript: Deployed module [datalab] to [https://main-dot-datalab-dot-.appspot.com]
Jul 25 16:22:36 datalab-deploy-main-20160725-16-19-55 startupscript: Step deploy datalab module succeeded.
Jul 25 16:22:36 datalab-deploy-main-20160725-16-19-55 startupscript: Deleting VM instance...
The landing page keeps showing a wait bar indicating the deployment is still in progress. I have tried deploying several times in last couple of days.
About additions described on the landing page -
An App Engine "datalab" module is added. - when I click on the pop-out url "https://datalab-dot-.appspot.com/" it throws an error page with "404 page not found"
A "datalab" Compute Engine network is added. - Under "Compute Engine > Operations" I can see a create instance for datalab deployment with my id and a delete instance operation with *******-ompute#developer.gserviceaccount.com id. not sure what it means.
Datalab branch is added to the git repo- Yes and with all the components.
I think the deployment is partially successful. When I visit the landing page again, the only option I see is to deploy the datalab again and not to start it. Can someone spot the problem ? Appreciate the help.
I read the other posts on this topic and tried to verify my deployment using - "https://console.developers.google.com/apis/api/source/overview?project=" I get the following message-
The API doesn't exist or you don't have permission to access it
You can try looking at the App Engine dashboard here, to verify that there is a "datalab" service deployed.
If that is missing, then you need to redeploy again (or switch to the new locally-run version).
If that is present, then you should also be able to see a "datalab" network here, and a VM instance named something like "gae-datalab-main-..." here. If either of those are missing, then try going back to the App Engine console, deleting the "datalab" service, and redeploying.

Undeploying apps in JBoss Application Server from the command line

Are there any simple ways to see what wars have been deployed in Jboss AS and undeploy some of them? I want to do this from the command line.
I tried using jmx but I keep getting exception saying "org.jboss.util.NestedRuntimeException: jmx not bound;" I'd prefer to do it in a way where I don't have to stop and start the application server.
You can approach this in three ways in JBoss Application Server 7:
Management Console
Management CLI
Deployment folder
Management Console
Being a GUI, the Management Console is the most visual of the three, and you can see the list of deployed applications under the Deployment window. You have the option to Disable and Remove the deployed applications listed here. This screenshot is from AS7.0.2, and some windows have and will change with the addition of tabs, but the general functionality remains the same.
Management CLI
The Management Command Line Interface is a new addition to AS7. The CLI exposes a lot of low-level functionality, and is a powerful tool once you get familiar with the commands and operations. As you might expect, you can run help to show the commands, or run <commandname> --help for more information on a specific command. Two useful commands are deploy and undeploy, so let's look at their help information. I'll give Linux examples, but you can insert your flavour of OS as required.
Here's deploy:
[standalone#localhost:9999 /] deploy --help
SYNOPSIS
deploy (file_path [--name=deployment_name] [--runtime_name=deployment_runtime_name] [--force] | --name=deployment_name) [--server-groups=group_name (,group_name)* | --all-server-groups]
DESCRIPTION
Deploys the application designated by the file_path or enables an already existing
but disabled in the repository deployment designated by the name argument.
If executed w/o arguments, will list all the existing deployments.
ARGUMENTS
file_path - the path to the application to deploy. Required in case the deployment
doesn't exist in the repository.
The path can be either absolute or relative to the current directory.
--name - the unique name of the deployment. If the file path argument is specified
the name argument is optional with the file name been the default value.
If the file path argument isn't specified then the command is supposed to
enable an already existing but disabled deployment, and in this case the
name argument is required.
--runtime_name - optional, the runtime name for the deployment.
--force - if the deployment with the specified name already exists, by default,
deploy will be aborted and the corresponding message will printed.
Switch --force (or -f) will force the replacement of the existing deployment
with the one specified in the command arguments.
--server-groups - comma separated list of server group names the deploy command should apply to.
Either server-groups or all-server-groups is required in the domain mode.
This argument is not applicable in the standalone mode.
--all-server-groups - indicates that deploy should apply to all the available server groups.
Either server-groups or all-server-groups is required in domain mode.
This argument is not applicable in the standalone mode.
-l - in case none of the required arguments is specified the command will
print all of the existing deployments in the repository. The presence of the -l switch
will make the existing deployments printed one deployment per line, instead of
in columns (the default).
And here's undeploy:
[standalone#localhost:9999 /] undeploy --help
SYNOPSIS
undeploy name [--server-groups=group_name (,group_name)* | --all-relevant-server-groups] [--keep-content]
DESCRIPTION
Undeploys the deployment with the given name and, depending on the arguments, removes
its content from the repository.
If the deployment name isn't specified, prints the list of all the existing deployments.
ARGUMENTS
name - the name of the deployment to undeploy.
--server-groups - comma separated list of server group names the undeploy command should apply to.
Either server-groups or all-relevant-server-groups is required in the domain mode.
This argument is not applicable in the standalone mode.
--all-relevant-server-groups - indicates that undeploy should apply to all the server groups
in which the deployment is enabled.
Either server-groups or all-relevant-server-groups is required in domain mode.
This argument is not applicable in the standalone mode.
--keep-content - by default undeploy, besides disabling the deployment, also removes its
content from the repository. The presence of --keep-content will only disable
the deployment w/o removing its content from the repository.
This argument can be used in both standalone and domain modes.
-l - in case the deployment name isn't specified, the presence of the -l switch
will make the existing deployments printed one deployment per line, instead of
in columns (the default).
The CLI In Action
Running the deploy or undeploy command without any arguments will list all the applications available. So your workflow to log in to the CLI and undeploy an application would be like this (simplified):
Change directory from EAP_HOME to the bin folder:
[user#home EAP_HOME]$ cd bin
Run the CLI logon script:
[user#host bin]$ ./jboss-admin.sh
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
Instruct the API to connect (this can also be passed at runtime as ./jboss-admin.sh --connect).
[disconnected /] connect
Connected to standalone controller at localhost:9999
Run the undeploy command to display available applications.
[standalone#localhost:9999 /] undeploy
test.ear
Run the undeploy command to undeploy the application. In this case, the test.ear.
[standalone#localhost:9999 /] undeploy test.ear
Successfully undeployed test.ear.
Deployment Folder
If you are running an instance of AS7 as a development tool, and are using the deployment folder, you can simply delete the application. You will notice that a marker file is created, such as test.ear.failed, to signify the status of the application deployment.
With JBoss Application Server it's possible handle deployment with plain file operations on wars/ears in deploy dir.
Just ls to enumerate, delete to undeploy, copy to deploy and touch to redeploy. No server restart required.
Also for the newest version of JBoss Application Server 7 you can use CLI.
You can also try CLI GUI. The Deployments-->Undeploy menu option provides a pick list of deployments. A couple of clicks and you are done.
See https://community.jboss.org/wiki/AGUIForTheCommandLineInterface
You dont have to restart the JBOSS server if you remove the WAR and EAR the application gets undeployed .
The article (http://docs.jboss.org/jbossas/docs/Clustering_Guide/4/html/clustering-intro-farm.html ) gives the perfect explanation of how it works.
Let all know if you have any questions about it .
We have been doing the development on Jboss the same way in our DEV , QA and Prod environment and have not faced any issues with it so-far.