Run grunt watch from the startup windows 10 - gruntjs

Is there a way to open the command prompt and run grunt watch from my project directory each time my PC starts? Just trying to automate the automation, have spent a good half hour googling with no luck.

There is one module which installs a node script as a windows service, it's called node-windows (npm, github, documentation). I've used before and worked like a charm.
var Service = require('node-windows').Service;
// Create a new service object
var svc = new Service({
name:'Hello World',
description: 'The nodejs.org example web server.',
script: 'C:\\path\\to\\helloworld.js'
});
// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install',function(){
svc.start();
});
svc.install();
Installing it:
npm install -g qckwinsvc
Installing your service:
> qckwinsvc
prompt: Service name: [name for your service]
prompt: Service description: [description for it]
prompt: Node script path: [path of your node script]
Service installed
Uninstalling your service:
> qckwinsvc --uninstall
prompt: Service name: [name of your service]
prompt: Node script path: [path of your node script]
Service stopped
Service uninstalled

Related

codedeploy stuck on beforeInstall

I want to do a code deploy but don't want to run any hook. My appspec.yaml looks like
version: 0.0
os: windows
files:
- source: output
destination: C:\inetpub\wwwroot
However, the codeDeploy runs successfully till DownloadBundle but get stuck for a while on beforeInstall before failing with the error
before install CodeDeploy agent was not able to receive the lifecycle event. Check the CodeDeploy agent logs on your host and make sure the agent is running and can connect to the CodeDeploy server.
What could be the issue? I've verified code deploy agent is running..
powershell.exe -Command Get-Service -Name codedeployagent
returns
Running codedeployagent CodeDeploy Host Agent Service

How to run a cmd in Windows with Admin priviledges in Salt

I have a simple system that is managed by Saltstack. The minions are Windows Server 2016 machines. I would like to run some command with Admin privileges. How would I achieve that in the .sls for the minion?
run-my-cmd:
cmd.run:
- cwd: C:\temp\
- bg: True
- name: 'some command'
Execute the command using Runas
C:\Users\abcxyz>Runas /profile /user:Administrator "your command"

Appium recorded code not working when launched via nodes

I have successfully installed and run appium desktop. I took to recording my test. The recorder's output code was as follows:
// Requires the webdriverio client library
// (npm install webdriverio)
// Then paste this into a .js file and run with Node:
// node <file>.js
const wdio = require('webdriverio');
const caps = {"platformName":"android","platformVersion":"8.0","deviceName":"Nexus_6_API_26_2","automationName":"UiAutomator2","app":"path/to/my/apk"};
const driver = wdio.remote({
protocol: "http",
host: "127.0.0.1",
port: 4723,
path: "/wd/hub",
desiredCapabilities: caps
});
driver.init()
.element("/some/xpath")
.setValue("Hello World!")
.end();
However this setup after running with node this_test.js will find error
Error: Required option "capabilities" is missing
Therefore I changed desiredCapabilities: caps to capabilities: caps, but after that I get error
TypeError: driver.init is not a function
What can I change to fix this? I have tried reinstalling webdriverio with both npm install -g webdriverio and yarn add webdriverio.
My server is running on 127.0.0.1:4723 with message "The URL '/' did not map to a valid resource" (if that is relevant)
Are you using MAC or Windows machine ? The address for MAC would be different, something like 0.0.0.0:4723/wd/hub

Installing Java/Tomcat via SaltStack using non-root user on Ubuntu

I am able to do following
install salt master, minion (using root user)
login in master machine and execute salt command to install java / tomcat into minion server
result : java/tomcat is installed via root user
What i want to do is
install java / tomcat in minion server by user name 'tomcatuser'
As per my understanding only way of doing this is if i install my minion via tomcatuser.
Is my understanding correct ?
Any other way ?
I think you mix up the saltstack controller and how it control the application configuration.
For salt master and minion to communicate, you need to start both services as root, to control most of the configuration process. Then from there on, you can specify the user and group for application deployment inside your sls configuration.
Now come to your Tomcat/java/whatever package, you can refer to the salt stack configuration, to specify your own user group of the configuration and even startup(with other modification). e.g.
Deploy foo configuration:
file.managed:
- name: /etc/foo.conf
- source:
- salt://foo.conf
- user: foo
- group: users
- mode: 644
Then to startup your tomcat, you can do the similar by using a crontab and specify the user you want (as long as it is not load under service port smaller than 1024) . Or you can check whether salt.states.tomcat is helpful to start the services : https://docs.saltstack.com/en/latest/ref/states/all/salt.states.tomcat.html

Authentication failed with capifony

I'm trying to do a Symfony 2 project deployment web app based on capifony and Symfony2.
It uses Process to trigger my "cap deploy" task and display my output in a web browser.
When in a shell, if I run my "cap deploy" as user www-data (the same as used by Process) , my deployement works fine so there's nothing wrong either with my deploy task nor with my authentication keys.
Though, when I call my task from my web app, capifony tells me it can't authenticate on the remote server.
triggering start callbacks for `deploy'
* executing `deploy:setdomain'
* executing `deploy'
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
triggering before callbacks for `deploy:update_code'
[32m--> Updating code base with checkout strategy[0m
executing locally: "git ls-remote [ myrepo ]"
command finished in 2068ms
* executing "git clone -q -o [ remote server ] [ my repo ]
/var/www/spinfony/releases/20121211100449 && cd /var/www/spinfony/releases/20121211100449 && git checkout -q -b deploy be53233e51a4c542c3bc8603b424e57f988898a4 && (echo be53233e51a4c542c3bc8603b424e57f988898a4 > /var/www/spinfony/releases/20121211100449/REVISION)"
servers: ["[ remote server ]"]
Password: stty: standard input: Invalid argument
stty: standard input: Invalid argument
stty: standard input: Invalid argument
*** [deploy:update_code] rolling back
* executing "rm -rf /var/www/spinfony/releases/20121211100449; true"
servers: ["[ remote server ]"]
** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: [ remote server ] (Net::SSH::AuthenticationFailed: [ user ])
connection failed for: [ remote server ] (Net::SSH::AuthenticationFailed: [ user ])
I'm trying to figure out why capifony seems to expect a password I can't provide since i'm not running it from a shell, whereas when I do run it from a shell, it works fine without asking me anything.
Once again, the same file is called from the same user.
This is a known "bug"
You need to tell capistrano wich key to use
Try adding this to your deploy.rb :
ssh_options[:keys] = %w(/what/ever/.ssh/id_rsa)
Source : http://adam.goucher.ca/?p=1253
When you call your task from a web app, you need to tell it what user to use.
set :user, "www-data"
set :domain, "webserverdomainname.com"

Resources