How to get logging working with pm2 and Heroku - heroku

Is there a way to tell pm2 to leave stderr and stdout alone (as opposed to writing to files)?
I'm using pm2 on Heroku using this gist as my model. Everything seems to work perfectly except that I've lost any ability to log from within my app. They don't show up in the Heroku logs and the files that pm2 creates aren't accessible to me on Heroku's file system (or I can't find them).

In your package.json:
"scripts": {
"preinstall": "npm i -g pm2 && pm2 install pm2-logrotate"
}
In your Procfile:
web: pm2 start app.js && pm2 logs all

We just created the official PM2 documentation, here is how to integrate PM2 with Heroku while printing the logs:
http://pm2.keymetrics.io/docs/usage/use-pm2-with-cloud-providers/#heroku-google-app-engine-azure
Alex

Related

Laravel runs dev assets nonmatter what on production server after I ran npm run dev accidentally

I ran npm run dev on the server with Laravel 9 using Vite and Tailwind. Now when I run npm run build it is still trying to load the css and javascript files from a domain 127.0.0.1. I can not get it back to reading the manifest.json in the build folder and loading those files.
npm run build runs without any errors,
however the npm run dev was throwing errors and I killed the process and double cheked using ps aux, and pkill commands.
I am lost.
nvm, for some reason the command
pkill npm
does not work I had to use
kill -9 [process-id]
and it worked.

Heroku - Run Heroku CLI commands from web dashboard

Is it possible to run heroku-cli-commands like heroku regions from the Heroku Dashboard?
I tried to run those in the console, but it did not work..
From the heroku explanation page, as well as the appearance of the console, it seems that you can only run commands that start with heroku run (Example: npm start).
That means you can run commands there for the app, and heroku will pass them to it. Like you could run if the app was running on your computer. But do not run regular heroku cli commands, for example install an add-on, through the dashboard on the website, but only through heroku cli

Why the dist folder in .nuxt is deleted after I executed pm2 for server side rendering?

Currently I am using pm2 and nodejs on windows to deploy nuxt.js project. Below are my steps:
Build project with npm run build
Copy 【.nuxt, static, nuxt.config.js, package.json】 to a new folder call prod01
In prod01 folder, execute npm i to install dependencies and use npm run start to check if everything works fine.
Then, I config nginx, install pm2 and use pm2 start node_modules/nuxt/bin/nuxt.js --name prod01 to start my project. (I've tried a lot of pm2 commands and this works for me)
However, after I use above pm2 start command, the dist folder in .nuxt has been deleted, and all I can see on
because dist in .nuxt was not existed.
Does anyone have any ideas about how this happened? My nuxt.config setting like meta description is still there, and I can open the web pages.
Or is there any solutions except using docker, that can also do server side rendering? Or maybe I should try using docker?
Please help me, thank you!

pm2 to start and keep alive npm run watch for Laravel's Vue?

How to use pm2 to start and keep alive npm run watch for Laravel's Vue?
I need to use pm2 for keep npm run watch on a shared hosting with ssh login.
How to?
I assume that you using NPM and start with npm start, try this command:
pm2 start npm -- start

Trouble Installing IPFS

I am using the instructions given on their site for MacOS- https://ipfs.io/docs/install/#installing-with-ipfs-update
[tutorial][1]
To build demo, clone this repo and run the following command:
$ cd contracts
$ npm install
Running the demo
To run demo, first run testrpc by running:
$ testrpc
Then compile and deploy the solidity contracts:
$ truffle compile
$ truffle migrate
Run an instance of IPFS to enable uploads:
$ ipfs daemon
Finally to build website, run:
$ npm run dev
I reached this last step (npm run dev) and I got an error message saying "npm missing scripts dev"
I am in the contracts directory specified, and installed everything there properly I believe. However, I don't see any dev script in the json package(s) which I believe could be being referenced using the npm run dev command. May this be the problem?
Here are the files wihin the folder contracts-master
app
index.html
javascripts
stylesheets
contracts
**ethpm.json** This one?
img
LICENSE
Lockup.sol
migrations
**package.json** Or this one?
Readme.md
scripts
coverage.sh
coveralls.sh
install.sh
test.sh
truffle.js
Any help / suggestions / learning resources would be appreciated.
Thanks for your time,
Elias
Your error is not because of ipfs. You are running dev mode but error saying that you don't have any scripts dev.If you are deploying smart contracts then you don't need ipfs demon. check package.json
"scripts": {
"dev": "command to run service"
}
Your package.json don't have dev scripts recheck package.json

Resources