I'm running a NodeJS app on Google Compute Engine using Custom Runtimes with Google App Engine. That uses a Dockerfile and app.yaml, and all I do is just gcloud preview app deploy app.yaml --set-default.
When my app crashes, I have to manually stop and start the app module using gcloud preview app modules stop default --version 12345678 and gcloud preview app modules start default --version 12345678 manually from my own computer.
Note this is different from restarting VM instance. It's about restarting the app module. Docs here https://cloud.google.com/sdk/gcloud/reference/preview/app/modules/start
Is there a way to automate the process, maybe by specifying some restartOnFailure spec in the app.yaml or Docker file, so Docker will restart an app on crash?
Related
The pipelines and releases seem to work finely as they get the artifact deployed on the app service or so it seems as the output error happens on start of the PM2 process.
I haven't found anything on this error on google, and don't know if there is a way to update PM2 on the app service machine as PM2 itself suggests.
These are the logs.
Error message
summary image
I was expecting the app to work and no longer show an application error as I fixed both build and release pipelines.
This is a picture of the important bit of info of the error as its really long
Check the below steps to run nextjs with PM2.
First create a nextJS app.
Run npm run dev command to run the app in development.
Deploy the app to Azure Linux App Service.
Open the SSH of the Azure App Service to run the PM2 commands.
We can open directly with the below URL.
Path to SSH - https://YourDeployedAppName.scm.azurewebsites.net/
OR
Navigate to the deployed Azure Linux App => Advanced Tools => Go => SSH.
Run the below command to install PM2.
npm install pm2 -g
Thanks #Azure OSS Developer Support for the commands.
In Configuration section => General Settings add the Startup command.
pm2 start site/root/index.js --name mynpmnextapp
Your path may differ for the index.js file.
My app entry point is index.js.For some apps it can be server.js.Change it according to your app.
cannot find module `../build/output/log'
Make sure you are not running the PM2 with the output folder. As mentioned above it has to be the entry point either server.js or index.js based on your code files.
don't know if there is a way to update PM2 on the app service
In the KUDU Console use npm install pm2#latest -g to update the PM2.
References taken from MSDoc and npmjs.
I've created a web app service with B1 tier pricing in linux/python3.7
I've hooked up my Azure git to the deployement center, the application builds correctly, I've edited the start command to python -m streamlit run app.py --server.port 8000 --server.address 0.0.0.0. The app launches, I can access to the URL, but streamlit is stuck into Please wait...
I've tried to enable WebSockets, since some people said it was the issue. I could not found the option in the Portal, so I had to use the command az webapp config set --web-sockets-enabled true --name MyAppName --resource-group MyResourceGroup. In the output json, I can see the option enabled.
"webSocketsEnabled": true,
I tried to enable/disable all kind of options in the configuration Portal, but nothing is working. Any idea on what I am doing wrong?
(The app works in local mode, and I don't have access to Docker on my local computer, so I can not use this option to build my docker image)
EDIT 1:
In the chrome console, I get an error:
WebSocket connection to '' failed: WebSocket is closed before the connection is established.
But WebSocket is enabled, or at least from what my previous commands says
After reproducing from my end, I could able to reproduce the same error when the webapp is deployed with python 3.9.
RESULTS:
But when I re-deployed a new Web app with Runtime version- Python 3.10 the error was resolved. The below code works fine when the streamlit app runs locally.
import streamlit as st
st.set_page_config(page_title="My Test app", page_icon=":tada", layout="wide")
# --- HEADER SECTION ----
st.subheader("Hi, I am test app :wave:")
st.title("A test app to test streamlit")
st.write("I am passionate py developer")
st.write("[Learn More >](https://streamlit.io/)")
Python -m streamlit run app.py
RESULTS:
Deployed the same to a new app service on azure with Runtime stack Python version 3.10, OS Linux and SKU B1 Pricing tier (Basic).
Note- Free tier is not supported for Streamlit app atleast B1 or above is mandatory.
Deploy the local code of censusapp in Azure App Service via VS code.
After the code is deployed > Try accessing the website you will receive an application error, to resolve that. Let’s add python -m streamlit run app.py --server.port 8000 --server.address 0.0.0.0> in the startup command in the Configuration.
Disable HTTPS Only to OFF and set the configuration settings as below:-
NOTE: Even if you set this settings to OFF> you can browse your website with https://
After these settings are added and validated, follow the below steps
Browse your website
Wait until the website loads
Now you can see that the error doesn't show up anymore and the website runs successfully in the browser.
Make sure that if your Web app is running on lower Python version than 3.10 Please re-create a new Web App on Azure with runtime stack python 3.10 to resolve this issue.
I'm trying to deploy an Angular CLI app to Azure App Service on Linux OS, using Azure Dev Ops - but no success. I get Image 1. No error in the server or application logs.
This is what I done so far:
Built the Angular CLI app using DevOps Build and placed the resulted "dist" folder to the "drop" folder. See below (Image 2) the tasks that compose my build. This is working fine and creating the expected files.
Created a release in DevOps, deploying all the dist files in the wwwroot folder in the Azure App Service in Linux. Shown below are both, the wwwroot folder (left) and my local dist folder (right) after I run a ng build --prod.
I have the suspicion that I need to kickstart the angular by feeding some time of command when doing the deployment. I have tried running "ng serve --host 0.0.0.0" but that didn't work.
Check the Azure App Service > Linux section on this page. Essentially, you have to serve the app. You can configure this with a ecoysystem.config.js PM2 file in the root directory, with this inside.
module.exports = {
apps: [
{
script: "npx serve -s"
}
]
};
I also added npx serve -s in the App Service Configuration > General Settings > Startup Command
See also: https://burkeholland.github.io/posts/static-site-azure
I had to give the npx serve -s as the startup command
Then set the Runtime Stack with node framework 10.16 (NODE|10.16). See below
Then everything started working.
If you still want to use App Service - Web App you can just the Windows OS instead of Linux.
Here are the parameters I Used:
Since the output of building angular is a static web app, IIS will serve the site right away.
When using Linux App Service container, you may also select PHP stack containing Apache2 Server. Since, Angular files are static ones (JS, CSS, HTML), so you just need some web server to serve this content.
Example configuration:
If you look at the default 'Deploy Node.js App to Azure App Service' release template, it uses the 'Deploy Azure App Service' task and adds the following commands to the task. this might help you out.
There is a subtle and big difference between the Linux and Windows App service: IIS - which in Windows is actively looking to serve any app, whereas in Linux you have to spin up something on your own to serve it - Express for example.
After some research I discovered that I don't need a full App service dedicated to run a static app (such as Angular or React). It can be done just as efficiently and much cheaper with something like Storage. -> https://code.visualstudio.com/tutorials/static-website/getting-started
I had the same problem on Azure App Service with Linux and Node, solved it using below startup command
pm2 serve /home/site/wwwroot --no-daemon --spa
Can any one help me understand gcloud app deploy? I tried deploying an application but it gave me the error:
ERROR: (gcloud.app.deploy) Error Response: [13] An internal error
occurred while creating a Google Cloud Storage bucket.
Thanks,
-VR
gcloud is google sdk command to interact with its cloud services, you can read more about it here https://cloud.google.com/sdk/gcloud/
you can run gcloud commands either by installing gcloud sdk or from a gcloud shell where sdk is pre-installed.
gcloud app deploy looks for app.yaml which can be configured based on this documentation https://cloud.google.com/appengine/docs/flexible/nodejs/configuring-your-app-with-app-yaml
To address the error try running this command gcloud config set app/use_deprecated_preparation True; and give a try.
once we run gcloud app deploy --version v1 a version of the application is created and can be accessed by the corresponding url from version column.
one can even login to the running instance of VM by accessing respective instance ssh.
this command will tar ball the folder containing app.yaml and will be used to create the running nodejs instance; the entire deployment depends on PORT being used as part of NodeJS application for running production instance, and a proper package.json which will have all the dependencies listed and contains a start script to run the application.

I am trying to deploy an existing ember-nodejs application into bluemix environment. I tried the following steps.
bluemix api https://api.ng.bluemix.net
bluemix login -u username -o org_name -s space_name
cf push app_name
I also tried the above command with an ember build pack from the list of
compatible CF build packs
cf push app_name -b https://github.com/cloudfoundry-community/cf-docs-contrib/wiki/Buildpacks
Uploading is successful, but the application doesnt start up. Is there a recommended way of deploying ember-node js application?
Update
It was a memory issue. I removed the other running apps and tried the cf push command again. The node modules got installed and the application also started without any fuss.
According to the user, this was actually a memory issue. Once he stopped the other running apps, his node modules were installed and the application started without any further errors. There are no issues specific to deploying ember-nodejs applications in the Bluemix environment.