How to run dart server on background? - dart

how to run my dart server forever when terminal is closed? Is there any package like pm2
I use for node js:
pm2 start index.js

You can do the some in dart, what you need is the to run your dart program entry point let saya pm2 start main.dart you can add other pm2 arguments options as per https://pm2.keymetrics.io/docs/usage/quick-start/

Related

Electron-forge with webpack devServer

I have created an app with electron-forge using npx create-electron-app electron --template=webpack.
I then did npm install webpack-dev-server
In my webpack.renderer.config.js I started to add a devServer section with proxy and before sections, but when I use npm run start these are ignored.
npm run start runs electron-forge start and that's where I think the problem is as I do not have direct access to the webpack call so as to get webpack serve ...
What is needed to get the webpack dev-server running with electron?
webpack-dev-server is already used by Electron-Forge, as indicated in Electron-forge Webpack documentation
In development we spin up webpack-dev-server instances to power your renderer processes, in prod we just build the static files.
For renderer : it refresh for you.
For main, as indicated in the documentation, you have to type "rs" in the terminal to "reload" the app.
For the main process, just type rs in the console you launched electron-forge from and we will restart your app for you with the new main process code.
If you want to access the webpack log server : http://localhost:9000/ (9000 is the default loggerPort in plugins-webpack config)
// forge.config.js (or package.json)
plugins: [
['#electron-forge/plugin-webpack',
{
// Renderer server port
port: 3000,
// Webpack logger port
loggerPort: 9000,
mainConfig: './webpack...',
...
}
],

Is there a way to see in cypress electron browser some logging?

I am using cypress to test my web site. Everything works great but there is one page that opens fine when I am running the test using chrome but if I try to run that against headless or regular electron the lhes simply don’t open.
I am assuming that there must be something on my code that is not working on the chromium version that electron uses (61) that do works the version that chromes uses (75).
Is there a way to debug or check some logging on what is not being able to execute? The console for electron does not display anything.
Any ideas?
You can show console.log messages from Electron by enabling a subset of DEBUG logs.
Like so:
Windows:
npm i -g cross-env
cross-env DEBUG=cypress:server:browsers:electron cypress run...
macOS or Linux:
DEBUG=cypress:server:browsers:electron cypress run...
After adding these two env variables Cypress started showing console.log output on the terminal:
ELECTRON_ENABLE_LOGGING=true DEBUG=cypress:electron $(npm bin)/cypress run ...

Electron package no window

I run electron-packager to make a distributable from my app, but when I start the App.app, no window is shown, only the top menu.
Question: How do I best debug / troubleshoot this?
The app starts a web server and makes a tcp connection to another server. The html for the electron app is served from the local web server.
This is the output when building:
$ npx electron-packager ./ App --overwrite
Packaging app for platform darwin x64 using electron v1.8.4
Wrote new app to /Users/user/www/app/App-darwin-x64
I tried to run the node app manually in package, but got this:
$ cd App-darwin-x64/App.app/Contents/Resources/app/
$ npm start
electron not found
From package.json:
"devDependencies": {
"electron": "^1.8.4",
"electron-packager": "^12.0.1"
},
$ node -v
v8.11.1
You can't run the app like that, you need to run it without the Content/Resources/app, as thats not where its stored. You need to run it from App-darwin-x64/App.app. You also don't call npm-start, as that's only called for running in dev.
Maybe try having a look at some example electron apps with build processes, try electron-vue as that has some good examples

Doing AEM Quick Install once when building a docker image

I have this docker file:
FROM flurdy/oracle-java7
COPY aem-quickstart-5.6.1.jar /aem-quickstart-5.6.1.jar
COPY license.properties /license.properties
RUN java -jar /aem-quickstart-5.6.1.jar -unpack
EXPOSE 4502 4502
ENTRYPOINT ["/crx-quickstart/bin/quickstart"]
My intention was to have AEM do all it's startup work with this line:
RUN java -jar /aem-quickstart-5.6.1.jar -unpack
By that I mean all the unpacking and installing of the AEM bundles. But all that line does is extract some start/stop scripts.
How can I tell AEM quick start to install all bundles and then shutdown, so I can do that work once at image build time, and have a quick startup time when the image is run.
instead of unpack run aem normally, you can pass a listener-port argument to the startup command and monitor progress, when startup is complete - issue a shutdown.
here is a python based implementation - https://github.com/awadheshv/aem_6-1_docker/blob/master/base/aemInstaller.py

Starting Erlang service at boot time (using Relx for creating release)

I have a server written in Erlang, compiled with Rebar, and I make a release with Relx. Starts nicely with
/root/rel/share3/bin/share3 start
The next step is to start when the server boots.
I have tried different approaches, the last one is using the /etc/init.d/skeleton where I changed the following
NAME=share3
DAEMON=/root/rel/share3/bin/share3
DAEMON_ARGS="$1"
After that, I run update-rc.d, but I have not gotten it too work. (Ubuntu 14.04)
The service runs until the machine reboots, and I need to login and start it again.
For Windows, it is really elegant, since it can create the Windows service.
Ubuntu uses upstart as init system, so you could try something like that:
description "Start my awesome service"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
exec /root/rel/share3/bin/share3
You have to place this script in /etc/init/ directory with '.conf' extension like '/etc/init/share3.coinf'. To start it invoke sudo start share3.
At last, I solved it!
I have told to relx to place the result at /home/mattias/rel. The script from relx is /home/mattias/rel/share3/bin/share3
Replace the row
SCRIPT_DIR="$(dirname "$0")"
by (you need to fix the path /home/mattias/rel)
HOME=/home/mattias
export HOME
SCRIPT_DIR="/home/mattias/rel/share3/bin"
Copy the file to /etc/init.d/share3 using
sudo cp ~/rel/share3/bin/share3 /etc/init.d/
Test that it works using
/etc/init.d/share3 start
and
/etc/init.d/share3 stop
In order to make it start at boot, install sysv-rc-conf
sudo apt-get install sysv-rc-conf
Enable boot at start using
sudo sysv-rc-conf share3 on
and disable
sudo sysv-rc-conf share3 off
Alternatives are welcome.

Resources