Issue with deploying NodeJs app on Openode - node.js

I'm trying to deploy a very simple app on Openode. I use VSCode to code the app. I also use the command below:
openode deploy
in the terminal. But every time I get the log below:
[Wed May 04 2022 15:43:23] - [+] Authentication valid.
⠋ Sending files (trial 1) - file=./app.js size=421 operation=M
Sending files (trial 1) - file=./Dockerfile size=400 operation=C
Sending files (trial 1) - file=./package-lock.json size=576070 operation=M
Sending files (trial 1) - file=./package.json size=311 operation=M
⠴ 4/4
⠇ [info] Preparing instance image...
⠦ [info] ----------------------------- REMOTE BUILD OUTPUT ------------------------------
starting build "be7caca6-4d24-4fb8-868a-788fe21724fc"
FETCHSOURCE
Fetching storage object: gs://openode_cloudbuild/source/1651662817.856651- 4ca57dee159a459aad0de20597a0ea87.tgz#1651662818498367
Copying gs://openode_cloudbuild/source/1651662817.856651- 4ca57dee159a459aad0de20597a0ea87.tgz#1651662818498367...
/ [1 files][101.8 KiB/101.8 KiB]
Operation completed over 1 objects/101.8 KiB.
BUILD
Already have image (with digest): gcr.io/cloud-builders/docker
Sending build context to Docker daemon 581.1kB
Step 1/8 : FROM node:16-alpine
16-alpine: Pulling from library/node
...
Digest: sha256:1a9a71ea86aad332aa7740316d4111ee1bd4e890df47d3b5eff3e5bded3b3d10
Status: Downloaded newer image for node:16-alpine
---> e5065cc78074
Step 2/8 : WORKDIR /opt/app
---> Running in 43eba802f064
Removing intermediate container 43eba802f064
---> 36eb952180bb
Step 3/8 : ENV PORT=80
---> Running in 52a96acb666c
Removing intermediate container 52a96acb666c
---> 142b3a4b0300
Step 4/8 : RUN echo 'crond' > /boot.sh
---> Running in 4bd61428068e
Removing intermediate container 4bd61428068e
---> 514493001fc5
Step 5/8 : COPY package*.json ./
---> 47992535fb05
Step 6/8 : RUN npm install --production
---> Running in 483bb82428b1
npm WARN deprecated strip-eof#2.0.0: Renamed to `strip-final-newline` to better represent its functionality.
npm WARN deprecated debug#4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated cli-ux#5.6.7: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated cli-ux#5.6.7: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated cli-ux#5.6.7: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated cli-ux#5.6.7: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated cli-ux#5.6.7: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated cli-ux#5.6.7: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
added 753 packages, and audited 754 packages in 33s
29 packages are looking for funding
run `npm fund` for details
20 vulnerabilities (8 moderate, 12 high)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
npm notice
npm notice New minor version of npm available! 8.5.5 -> 8.8.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.8.0>
npm notice Run `npm install -g npm#8.8.0` to update!
npm notice
Removing intermediate container 483bb82428b1
---> 554d52fb54fd
Step 7/8 : COPY . .
---> 438b64e10f1c
Step 8/8 : CMD sh /boot.sh && npm start
---> Running in 8e1ee006be51
Removing intermediate container 8e1ee006be51
---> ee70ea9d469a
Successfully built ee70ea9d469a
Successfully tagged gcr.io/openode/tert2:tert2--30794--1712208
PUSH
Pushing gcr.io/openode/tert2:tert2--30794--1712208
The push refers to repository [gcr.io/openode/tert2]
...
tert2--30794--1712208: digest: sha256:c10cd20b145af3d939b461a2612779f31ffc9e4ed1cd095e92065b3104941d1f size: 2204
DONE
--------------------------------------------------------------------------------
[info] Deploying instance...
⠼ [error] Deploying container to Cloud Run service [instance-30794] in project [openode] region [europe-west1]
Deploying new service...
Setting IAM Policy..................done
Creating Revision................................................................................................................................................................................................failed
Deployment failed
ERROR: (gcloud.run.deploy) Cloud Run error: The user-provided container failed to start and listen on the port defined provided by the PORT=80
environment variable. Logs for this revision might contain more information.
⠴ [error] Unable to deploy the instance with success
[info] Finalizing...
[info] Stopping instance...
⠴ [info]
*** Final Deployment state: FAILED ***
[info] ...finalized.
As it can be observed in the log, it looks like the main error lays in this part: ERROR: (gcloud.run.deploy) Cloud Run error: The user-provided container failed to start and listen on the port defined provided by the PORT=80 .
I have seen a post discussing the same issue deploying an app, but it didn't help me solve the issue. Though that post doesn't directly discuss the NodeJS.

Related

502 Bad Gateway when hosting a Meteor app on AWS Elastic Beanstalk with Meteor-up

I have a Meteor app I've been trying to deploy to AWS with mup-aws-beanstalk.
Here is my repository This is a basic "Hello world" equivalent of MongoDB, Meteor, React, Node.js app. How to install
This works perfectly fine localy, and runs on http://localhost:3000/. When I try to deploy to AWS with the meteor-up mup-aws-beanstalk plugin, it deploys, but I get a 502 Bad Gateway error.
I'm pretty new to this but I did some research and checked the logs.
Checking the logs, I see that the start script isnt working properly
> mup-meteor-example-deploy-aws#1.0.0 start /var/app/current
> bash ./start.sh
┌──────────────────────────────────────────────────┐
│ npm update check failed │
│ Try running with sudo or get access │
│ to the local update config store via │
│ sudo chown -R $USER:$(id -gn $USER) /tmp/.config │
└──────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────┐
│ npm update check failed │
│ Try running with sudo or get access │
│ to the local update config store via │
│ sudo chown -R $USER:$(id -gn $USER) /tmp/.config │
└──────────────────────────────────────────────────┘
Node version
v12.16.1
Npm version
6.14.0
=> Starting health check server
=> Starting App
/var/app/current/programs/server/node_modules/fibers/fibers.js:90
return fn.apply(this, arguments);
^
Error: $ROOT_URL, if specified, must be an URL
at packages/meteor.js:1328:13
at packages/meteor.js:1343:4
at packages/meteor.js:1508:3
at /var/app/current/programs/server/boot.js:401:38
at Array.forEach (<anonymous>)
at /var/app/current/programs/server/boot.js:226:21
at /var/app/current/programs/server/boot.js:464:7
at Function.run (/var/app/current/programs/server/profile.js:280:14)
at /var/app/current/programs/server/boot.js:463:13
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mup-meteor-example-deploy-aws#1.0.0 start: `bash ./start.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mup-meteor-example-deploy-aws#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
I checked the above problem and other StackOverflow questions mention to make the URL start with http or https, which my does.
Then there is also an error from nginx, there are these lines that keep repeating. I am not sure if these two are related.
This post describes the problem might be because the app isn't running on the server/port combination
HOWEVER, this post states that it might be because Elastic Beanstalk is reading the wrong file first, and therefore not opening up the ports in the first place?
I am not sure how or where to change the port numbers, or if this is a problem with npm.
-------------------------------------
/var/log/nginx/error.log
-------------------------------------
2020/07/13 04:02:02 [error] 4632#0: *148508 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.21.16, server: , request: "GET /aws-health-check-3984729847289743128904723 HTTP/1.1", upstream: "http://127.0.0.1:8039/aws-health-check-3984729847289743128904723", host: "172.31.46.135"
2020/07/13 04:02:06 [error] 4632#0: *148510 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.46.174, server: , request: "GET /aws-health-check-3984729847289743128904723 HTTP/1.1", upstream: "http://127.0.0.1:8039/aws-health-check-3984729847289743128904723", host: "172.31.46.135"
2020/07/13 04:02:17 [error] 4632#0: *148512 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.21.16, server: , request: "GET /aws-health-check-3984729847289743128904723 HTTP/1.1", upstream: "http://127.0.0.1:8039/aws-health-check-3984729847289743128904723", host: "172.31.46.135"
This is my deployment output
PS G:\GitFolder\meteor-example-deploy-aws\.deploy> mup deploy
=> Setting up
=> Ensuring IAM Roles and Instance Profiles are setup
Building App Bundle Locally
WARNING: The output directory is under your source tree.
Your generated files may get interpreted as source code!
Consider building into a different directory instead
meteor build ../output
app/node_modules/semantic-ui-css/semantic.css: warn: There are some #import rules in the middle of a file. This might be a bug, as imports are only valid at the beginning of a file.
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
Unable to resolve some modules:
"#babel/runtime/helpers/createSuper" in /G/GitFolder/meteor-example-deploy-aws/app/imports/ui/layouts/App.jsx (web.browser.legacy)
If you notice problems related to these missing modules, consider running:
meteor npm install --save #babel/runtime
=> Archiving Bundle
10% Archived
20% Archived
30% Archived
40% Archived
50% Archived
60% Archived
70% Archived
80% Archived
90% Archived
100% Archived
=> Uploading bundle
Uploaded 11%
Uploaded 23%
Uploaded 35%
Uploaded 46%
Uploaded 58%
Uploaded 70%
Uploaded 81%
Uploaded 93%
Uploaded 100%
Finishing upload. This could take a couple minutes
=> Creating Version
=> Configuring Beanstalk Environment
Updated Environment
=> Waiting for Beanstalk Environment to finish updating
Env Event: Updating environment mup-env-meteor-example-deploy-aws's configuration settings.
Env Event: Rolling with Additional Batch deployment policy enabled. Launching a new batch of 1 additional instance(s).
Env Event: Batch 1: 1 EC2 instance(s) [i-0b017a1b7f1c7151a] launched. Deploying application version.
Env Event: Environment health has transitioned from Severe to Degraded. 100.0 % of the requests are failing with HTTP 5xx. ELB processes are not healthy on 1 out of 2 instances. Configuration update in progress on 1 instance. 0 out of 2 instances completed (running for 2 minutes). ELB health is failing or not available for 1 out of 2 instances. Impaired services on 1 out of 2 instances.
Env Event: Added instance [i-0b017a1b7f1c7151a] to your environment.
Env Event: Failed to run npm install. Snapshot logs for more details.
Env Event: Retrieving logs prior to instance(s) termination. Logs will be available for an hour in the environment management console and at elasticbeanstalk-us-east-1-966889535256/resources/environments/logs/bundle/e-kvnxyajrem.
Env Event: During an aborted deployment, some instances may have deployed the new application version. To ensure all instances are running the same version, re-deploy the appropriate application version.
Env Event: Failed to deploy configuration.
Env Event: Terminating excess instance(s): [i-0b017a1b7f1c7151a].
Env Event: Command execution completed on all instances successfully.
Env Event: [Instance: i-0b017a1b7f1c7151a] Successfully finished bundling 16 log(s)
=> Deploying new version
=> Waiting for Beanstalk Environment to finish updating
Env Event: Environment health has transitioned from Degraded to Severe. 100.0 % of the requests are failing with HTTP 5xx. Command failed on 1 out of 2 instances. Incorrect application version found on 1 out of 2 instances. Expected version "5" (deployment 10). ELB processes are not healthy on all instances. Application update in progress (running for 42 seconds). ELB health is failing or not available for all instances. Impaired services on 1 out of 2 instances.
Env Event: Rolling with Additional Batch deployment policy enabled. Launching a new batch of 1 additional instance(s).
Env Event: Removed instance [i-0b017a1b7f1c7151a] from your environment.
Env Event: Added instance [i-0733205831e115a28] to your environment.
Env Event: Batch 1: 1 EC2 instance(s) [i-0733205831e115a28] launched. Deploying application version '5'.
Env Event: Unsuccessful command execution on instance id(s) 'i-0733205831e115a28'. Aborting the operation.
Env Event: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
Env Event: [Instance: i-0733205831e115a28] Command failed on instance. Return code: 127 Output: (TRUNCATED)...
/opt/elasticbeanstalk/hooks/appdeploy/pre/45node.sh: line 12: nvm: command not found
/opt/elasticbeanstalk/hooks/appdeploy/pre/45node.sh: line 13: nvm: command not found
/opt/elasticbeanstalk/hooks/appdeploy/pre/45node.sh: line 14: npm: command not found.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/45node.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
Env Event: Retrieving logs prior to instance(s) termination. Logs will be available for an hour in the environment management console and at elasticbeanstalk-us-east-1-966889535256/resources/environments/logs/bundle/e-kvnxyajrem.
Env Event: Excess instance(s) terminated.
Env Event: Terminating excess instance(s): [i-0733205831e115a28].
Env Event: Command execution completed on all instances successfully.
Env Event: [Instance: i-0733205831e115a28] Successfully finished bundling 15 log(s)
Env Event: Environment health has transitioned from Severe to Degraded. 100.0 % of the requests are failing with HTTP 5xx. Command failed on 1 out of 2 instances. Incorrect application version found on 1 out of 2 instances. Expected version "1" (deployment 1). ELB processes are not healthy on 1 out of 2 instances. Application update is aborting. 1 out of 2 instances completed (running for 4 minutes). ELB health is failing or not available for 1 out of 2 instances. Impaired services on 1 out of 2 instances.
App is running at mup-env-meteor-example-deploy-aws.eba-cah6ppkm.us-east-1.elasticbeanstalk.com
=> Finding old versions
=> Removing old versions
=> Updating Beanstalk SSL Config
and this everything in my mup.js file
app: {
// Tells mup that the AWS Beanstalk plugin will manage the app
type: 'aws-beanstalk',
name: 'meteor-example-deploy-aws',
path: 'G:/GitFolder/meteor-example-deploy-aws/app',
env: {
ROOT_URL: 'http://mup-env-meteor-example-deploy-aws.eba-cah6ppkm.us-east-1.elasticbeanstalk.com/',
MONGO_URL: 'mongodb://MYUSERNAME:MYPASSREDACTED#docdb-2020-07-06-07-57-38.cluster-c9vs8fwnppko.us-east-1.docdb.amazonaws.com:27017/?ssl=true&ssl_ca_certs=rds-combined-ca-bundle.pem&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false'
},
auth: {
id: 'AKIA6C...',
secret: 'xCBpL....'
},
minInstances: 1
},
plugins: ['mup-aws-beanstalk']
};

Truffle stuck when deploy smart contract

I have a little problem deploying smart contract with ledger nano s as provider on ropsten. The script just remain stuck at first migration
Starting migrations...
======================
> Network name: 'ropsten'
> Network id: 3
> Block gas limit: 8000029 (0x7a121d)
1_initial_migration.js
======================
Deploying 'Migrations'
----------------------
> transaction hash: 0x1b85c85699b9f40798b5892a7492c303048915e80ac69803f94e617744769865
⠋ Blocks: 211 Seconds: 2829
Operating System: Ubuntu 20
Ethereum client: geth Version:1.9.14-stable
Truffle version (truffle version): 5.1.29
node version (node --version): 10.21.0
npm version (npm --version): 6.14.5
I also posted on github truffle issue

Heroku app deployment successful but Node.js buildpack Times out and terminates nodejs

Heroku app deployment successful but Node.js buildpack Times out and terminates nodejs
Below is the log file
mnyr_proj#0.1.0 heroku-postbuild /tmp/build_be4f28beb225c85ac1653b53b7e76816
npm run serve
npm info it worked if it ends with ok
npm verb cli [
npm verb cli '/tmp/build_be4f28beb225c85ac1653b53b7e76816/.heroku/node/bin/node',
npm verb cli '/tmp/build_be4f28beb225c85ac1653b53b7e76816/.heroku/node/bin/npm',
npm verb cli 'run',
npm verb cli 'serve'
npm verb cli ]
npm info using npm#6.12.0
npm info using node#v12.13.0
npm verb run-script [ 'preserve', 'serve', 'postserve' ]
npm info lifecycle mnyr_proj#0.1.0~preserve: mnyr_proj#0.1.0
npm info lifecycle v mnyr_proj#0.1.0~serve: mnyr_proj#0.1.0
> mnyr_proj#0.1.0 serve /tmp/build_be4f28beb225c85ac1653b53b7e76816
> vue-cli-service serve
INFO Starting development server...
WARNING Compiled with 2 warnings5:36:47 PM
warning
asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
img/fa-brands-400.fb0cbe85.svg (496 KiB)
img/fa-solid-900.9948e588.svg (369 KiB)
js/chunk-3cb9bc02.323e1d11.js (1.52 MiB)
js/chunk-46d6fd27.5c2863c6.js (921 KiB)
js/chunk-vendors.76662662.js (1.39 MiB)
warning
entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
app (1.74 MiB)
css/chunk-vendors.7e449d15.css
js/chunk-vendors.76662662.js
css/app.09d2c403.css
js/app.063310d7.js
App running at:
- Local: http://localhost:8080/
It seems you are running Vue CLI inside a container.
Access the dev server via http://localhost:<your container's external mapped port>/
App is served in production mode.
Note this is for preview or E2E testing only.
-----> Timed out running buildpack Node.js
Terminated
/app/tmp/buildpacks/a104ebb80184ba556a3457859a381585c1c182694d8086bfcdabe39f3fe5857835812b209be5647b385deaddf7afa081b0f0c5d9d1683b767fb8abc0c3b79cc0/lib/monitor.sh: line 1: kill: (2373) - No such process
! Push failed

Bluemix push error

i'm getting an error when I try to push to BlueMix from local.
> node lib/install.js
> optipng-bin#3.1.4 postinstall /tmp/app/node_modules/img-loader/node_modules/imagemin-optipng/node_modules/optipng-bin
✔ optipng pre-build test passed successfully
> pngquant-bin#3.1.1 postinstall /tmp/app/node_modules/img-loader/node_modules/imagemin-pngquant/node_modules/pngquant-bin
> node lib/install.js
✔ pngquant pre-build test passed successfully
> gifsicle#3.0.4 postinstall /tmp/app/node_modules/img-loader/node_modules/imagemin-gifsicle/node_modules/gifsicle
> node lib/install.js
✔ gifsicle pre-build test passed successfully
/tmp/buildpacks/cbed2b9b0603a1febfaafeebb556dd0b/lib/dependencies.sh: line 1: 163 Killed npm install --unsafe-perm --userconfig $build_dir/.npmrc 2>&1
-----> Build failed
Failed to compile droplet
Check our support community to get help on common issues:
http://ibm.biz/bluemixcommunitysupport
If you need additional help and your subscription includes support, submit a ticket so we can help:
http://ibm.biz/bluemixsupport
Exit status 223
Staging failed: Exited with status 223 (out of memory)
Destroying container
Successfully destroyed container
FAILED
Error restarting application: StagingError
It works great locally. I tried increasing memory to 1GB, didn't help either. Please help.

Deploy Meteor App To AMAZON EC2 using MUP Error

I'm trying to use METEOR UP MUP to deploy my Meteor App to AWS AMAZON EC2.
I use different NPM Modules as well as METEOR PACKAGES in my Meteor App. It all works perfectly on my computer.
When I do a mup deploy I get the following errors:
[52.89.165.48] - Uploading bundle
[52.89.165.48] - Uploading bundle: SUCCESS
[52.89.165.48] - Setting up Environment Variables
[52.89.165.48] - Setting up Environment Variables: SUCCESS
[52.89.165.48] - Invoking deployment process
[52.89.165.48] x Invoking deployment process: FAILED
-----------------------------------STDERR-----------------------------------
sseph.h:4:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning (disable : 4251)
^
In file included from ../src/house.cc:1:0:
../src/swisseph.h:4:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning (disable : 4251)
^
In file included from ../src/eclipse.cc:1:0:
../src/swisseph.h:4:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning (disable : 4251)
^
gyp info ok
npm WARN package.json meteor-dev-bundle#0.0.0 No description
npm WARN package.json meteor-dev-bundle#0.0.0 No repository field.
npm WARN package.json meteor-dev-bundle#0.0.0 No README data
stop: Unknown instance:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to localhost port 80: Connection refused
App did not pick up! Please check app logs.
-----------------------------------STDOUT-----------------------------------
> node ./build.js
`linux-x64-v8-3.14` exists; testing
Binary is fine; exiting
ansi-regex#0.2.1 node_modules/ansi-regex
ansi-styles#1.1.0 node_modules/ansi-styles
escape-string-regexp#1.0.3 node_modules/escape-string-regexp
chalk#0.5.1 node_modules/chalk
strip-ansi#0.3.0 node_modules/strip-ansi
supports-color#0.2.0 node_modules/supports-color
has-ansi#0.1.0 node_modules/has-ansi
eachline#2.3.3 node_modules/eachline
type-of#2.0.1 node_modules/type-of
amdefine#1.0.0 node_modules/amdefine
asap#2.0.3 node_modules/asap
meteor-promise#0.4.8 node_modules/meteor-promise
underscore#1.5.2 node_modules/underscore
promise#7.0.4 node_modules/promise
source-map-support#0.3.2 node_modules/source-map-support
semver#4.1.0 node_modules/semver
source-map#0.1.32 node_modules/source-map
fibers#1.0.5 node_modules/fibers
Waiting for MongoDB to initialize. (5 minutes)
connected
AppName start/running, process 12612
Waiting for 15 seconds while app is booting up
Checking is app booted or not?
----------------------------------------------------------------------------
What's causing this?
How do I solve this?
Thank you....it's my first time using AWS EC2...
Make sure your mup.json nodeVersion is up to date with the Node version (0.10.40) required by the latest Meteor version (1.2).
"nodeVersion": "0.10.40",

Resources