Can not re-deploy after moving 3 apps into one folder - ibm-cloud

I moved 3 Node.js apps into a folder in the Web IDE because I wanted to logically group them, not necessarily to change the deployment.
All three apps have their own URL.
Apparently the deployment now works for all 3 apps combined.
Error after clicking on the deploy-arrow:
"An app was not successfully detected by any available buildpack"
I adapted the launch configuration:
added the services
added "npm start"
Still I get this error.
One of the apps does not have a manifest.yml.
When I click on app.js, I sometimes get the following error (in a big red pop-up window):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <style> body{ margin:0px; padding:0px; background-color: #ffffff; color:#000; font-family:Arial,Verdana,Helvetica,Tahoma,sans-serif; } #content { font-size: 1em; margin-left: 1em; margin-right: 1em; padding: 1em; } h4.basichead { font-family:Arial,Verdana,Helvetica,Tahoma,sans-serif; } p { padding-top: .5em; } ul { line-height: 1.3em; } a:link { color: #c00000 } a:visited { color: #c00000 } #page {
border: 7px; padding: 7px } #box {
....
Log:
Updated app with guid 998e32e6-3f4f-4743-8e36-f8cd4c0961bb ({"name"=>"ACP", "command"=>"PRIVATE DATA HIDDEN", "instances"=>1, "memory"=>1024, "environment_json"=>"PRIVATE DATA HIDDEN"})
Updated app with guid 998e32e6-3f4f-4743-8e36-f8cd4c0961bb ({"route"=>"8e8a376d-479e-4b4f-921e-932e40fd569f"})
Updated app with guid 998e32e6-3f4f-4743-8e36-f8cd4c0961bb ({"console"=>true, "state"=>"STOPPED"})
Got staging request for app with id 998e32e6-3f4f-4743-8e36-f8cd4c0961bb
Updated app with guid 998e32e6-3f4f-4743-8e36-f8cd4c0961bb ({"console"=>true, "state"=>"STARTED"})
-----> Downloaded app package (6.6M)
encountered error: An app was not successfully detected by any available buildpack
Unfortunately I can not move the apps back to the root directory either, for some reason.

You get the error An app was not successfully detected by any available buildpack because Bluemix cannot decide what kind of application you are trying to deploy. Each buildpack has it's own detect script and none of them fit the bill for your project structure of 3 Node.js apps/folders.
I would suggest trying to place a single manifest.yml file at the root of your project (or where you run cf push) that tells cloud foundry your intentions.
You can specify multiple applications to be pushed at once. An example manifest.yml:
---
# this manifest deploys two applications
# apps are in flame and spark directories
# flame and spark are in fireplace
# cf push should be run from fireplace
applications:
- name: spark
host: flint-99
path: ./spark/
- name: flame
host: burnin-77
path: ./flame/
More information about pushing multiple applications to Cloud Foundry Here.

Related

Cloud Build with Github trigger not working: testIamPermissions not found on server

I am trying to implement an automation using Python and Google Cloud Run, and the automation is running well. But to avoid having to manually deploy it everytime, I am tryin to implement Github trigger in Cloud Build.
I created a dockerfile, the yaml file, requirements, etc., just as recommended here and here.
It all starts fine, the dockerfile, yaml and requirements are used properly, but in step 3 I get an error:
Details of the error follows:
Step #2: Status: Downloaded newer image for gcr.io/google.com/cloudsdktool/cloud-sdk:latest
Step #2: gcr.io/google.com/cloudsdktool/cloud-sdk:latest
Step #2: ERROR: (gcloud.run.deploy) HTTPError 404: <!DOCTYPE html>
Step #2: <html lang=en>
Step #2: <meta charset=utf-8>
Step #2: <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
Step #2: <title>Error 404 (Not Found)!!1</title>
Step #2: <style>
Step #2: *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}#media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}#media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}#media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
Step #2: </style>
Step #2: <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
Step #2: <p><b>404.</b> <ins>That’s an error.</ins>
Step #2: <p>The requested URL <code>/v1/projects/[prject-id]/locations/REGION/services/[application]:testIamPermissions</code> was not found on this server. <ins>That’s all we know.</ins>
Step #2:
Finished Step #2
ERROR
ERROR: build step 2 "gcr.io/google.com/cloudsdktool/cloud-sdk" failed: step exited with non-zero status: 1
I believe I granted all required permissions, but I can't seem to resolve the issue.
Figured out the issue: the region was incorrect in the yaml file.

Why does localhost not work inside my VS Code's webviews when connected to remote workspaces?

I have a simple extension that uses VS Code's webview api to load content from a server that my extension spawns. It does this using an iframe that points to localhost:
import * as vscode from 'vscode';
import * as express from 'express';
const PORT = 3000;
export function activate(context: vscode.ExtensionContext) {
// Spawn simple server
const app = express();
app.get('/', (_req, res) => res.send('Hello VS Code!'));
app.listen(PORT)
context.subscriptions.push(
vscode.commands.registerCommand('myExtension.startPreview', () => {
const panel = vscode.window.createWebviewPanel('myExtension.preview', 'Preview', vscode.ViewColumn.One,
{
enableScripts: true
});
panel.webview.html = `<!DOCTYPE html>
<html lang="en"">
<head>
<meta charset="UTF-8">
<title>Preview</title>
<style>
html { width: 100%; height: 100%; min-height: 100%; display: flex; }
body { flex: 1; display: flex; }
iframe { flex: 1; border: none; background: white; }
</style>
</head>
<body>
<iframe src="http://localhost:${PORT}"></iframe>
</body>
</html>`
}));
}
This works fine when the extension runs locally, but when I try running my extension in a remote workspace the iframe is empty:
Why is this happening and how do I fix it?
This is expected when using localhost inside a webview in a remote workspaces. The root cause is that webviews are loaded on the users's local machine, while your extension is running on the remote machine:
There are two possible fixes for this:
Mark your extension as a UI Extension so that it is always run on the local machine.
You can make your extension a UI Extension if it does not need to read files from the workspace or use scripts/tools that would only be installed with the workspace. UI extension's are run on the user's local machine, so the server it spawns is accessible using localhost
Just add "extensionKind": "ui" to your extension's package.json to do this.
Configure portMapping for your webview
The VS Code port mapping API allows you to map a localhost port used inside your webview to an arbitrary port on the machine where your extension is running. This even works if your extension is running remotely.
The port mapping API was added in VS Code 1.34. To use it, pass in a portMapping object when you create the webview panel:
const panel = vscode.window.createWebviewPanel('myExtension.preview', 'Preview', vscode.ViewColumn.One,
{
enableScripts: true,
// This maps localhost:3000 in the webview to the express server port on the remote host.
portMapping: [
{ webviewPort: PORT, extensionHostPort: PORT}
]
});
If your webview uses localhost for any reason, it is a good idea to set portMapping so that it can be properly run anywhere. In practice, you should also consider randomizing which port your server runs on. With port mapping, you don't have change the webview's html for this:
{ webviewPort: 3000, extensionHostPort: RANDOM_PORT_SERVER_WAS_STARTED_ON }
See the VS Code docs for more details

Publishing to Azure Mobile Service with Lets Encrypt certificate gives Runtime Error

I have set up a new Azure Mobile App Service instance which has been working fine. The only thing I can think that I've done to the server side configuration is add a Lets Encrpyt certificate to provide SSL support using the Lets Encrypt Azure Extension.
Now, when I publish, I get a Runtime Error. Looking in the Azure streaming logs, I can see the following every time I hit the application URL:
2017-06-29T13:54:07 Welcome, you are now connected to log-streaming service.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>IIS Detailed Error - 500.0 - Internal Server Error</title>
</head>
<body>
<div id="content">
<div class="content-container">
<h3>HTTP Error 500.0 - Internal Server Error</h3>
<h4>The page cannot be displayed because an internal server error has occurred.</h4>
</div>
<div class="content-container">
<fieldset><h4>Most likely causes:</h4>
<ul> <li>IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.</li> <li>IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.</li> <li>IIS was not able to process configuration for the Web site or application.</li> <li>The authenticated user does not have permission to use this DLL.</li> <li>The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.</li> </ul>
</fieldset>
</div>
<div class="content-container">
<fieldset><h4>Things you can try:</h4>
<ul> <li>Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.</li> <li>Check the event logs to see if any additional information was logged.</li> <li>Verify the permissions for the DLL.</li> <li>Install the .NET Extensibility feature if the request is mapped to a managed handler.</li> <li>Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here. </li> </ul>
</fieldset>
</div>
<div class="content-container">
<fieldset><h4>Detailed Error Information:</h4>
<div id="details-left">
<table border="0" cellpadding="0" cellspacing="0">
<tr class="alt"><th>Module</th><td> AspNetInitializationExceptionModule</td></tr>
<tr><th>Notification</th><td> BeginRequest</td></tr>
<tr class="alt"><th>Handler</th><td> ExtensionlessUrlHandler-Integrated-4.0</td></tr>
<tr><th>Error Code</th><td> 0x00000000</td></tr>
Has anyone come across this problem before?
OK< bit of an obscure and edge case one this, but thought I'd leave it here with the answer in case it helps someone.
I created the site and published it with it all working fine. I then changed the assembly name to fit in with my project naming standards and re-published, without selecting 'DELETE ALL FILES' becuase it would wipe out the Lets Encrypt extension settings. However, this lef the old DLL's hanging around in the \bin directory meaning there were two OWIN startup classes being found!
Deleting the old one fixed the issue.

Why is gcloud failing to access all Google APIs and printing out HTML inside a Compute Engine VM?

When I SSH into a server, running gcloud compute instances list should list the instances but instead I see the following in the terminal:
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 403 (Forbidden)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{
margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images
/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-de
coration:none}a img{border:0}#media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;pad
ding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-r
epeat;margin-left:-5px}#media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/br
anding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/
images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}#media only screen and (-webkit-min-device-pixel-rati
o:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-we
bkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
</style>
<a href=//www.google.com/><span id=logo aria-label=Google></span></a>
<p><b>403.</b> <ins>That’s an error.</ins>
<p>Your client does not have permission to get URL <code>/0.1/meta-data/service-accounts/default/acquire?scope=http
s%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform%20htt
ps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fappengine.admin%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcompute</code> fro
m this server. <ins>That’s all we know.</ins>
I have the correct scopes added to the machine so this should work. It's also peculiar that a command line application tool is printing out HTML (´・ω・`)
Trying to access any other Google API from the VM also fails.
It seems that gcloud is trying to authenticate, but failing to do so, because the service account on the vm is damaged in some way. The error should probably be cleverer in such a circumstance. I will relay it to the teams responsible for the tool.

Css doesn't load at all in Ionic App

this is my index.html
<link href="../../myApp/www/lib/ionic/css/style.css" rel="stylesheet">
and css:
body{
background: darkcyan;
}
and here's what i get in console :
Failed to load resource: the server responded with a status of 404 (Not Found)
what am i missing ? Thanks