How do you run lite-server as a Windows service? - lite-server

I am trying to set up lite-server as a Windows service so that it starts automatically when the machine starts. I am trying to do this via NSSM.
I install as follows:
nssm install <servicename> lite-server
Then, since I see it complaining in the event viewer about the directory it's running from, I add this:
nssm set <servicename> AppDirectory <serviceDirectory>
If I run lite-server directly from the command line it works.
However, if I start the Windows service installed as above, it fails, and in the event viewer I get:
Failed to start service . Program lite-server couldn't be launched. CreateProcess() failed: The system cannot find the file specified.
I have tried:
Adding the path to %APPDATA%\npm to the system path to make sure lite-server can be found.
Installing the service under my own username.
It didn't work. What do I need to do to run lite-server as a Windows service?

please try with same config
path: C:\Users\{username}\AppData\Roaming\npm\lite-server.cmd
startup directory : bs-config.json config file path
screenshot like this

Related

AWS CodeDeploy deployment failed at event ApplicationStop

I am trying to set up auto-deployment from GitHub to AWS, using EC2.
I set Role with CodeDeployServiceRole auto policy
After following the Tutorial: Use AWS CodeDeploy to Deploy an Application from GitHub, my deployment fails at the ApplicationStop event, after trying for couple of minutes with error code HEALTH_CONSTRAINT. I'm not sure how to troubleshoot the issue/where to look.
These are few hints of how you can navigate your way
Logs as mentioned in comments in /var/log/aws/codedeploy-agent
As AWS support recommend you can add for one time --ignore-application-stop-failures so it will skip that step in case it failed last time and see، because the application stop Lifecycle event uses the appspec file from the last successful build so if that one is corrupted somehow this step will fail in the following builds
(not recommended) you can delete the file, that CodeDeploy uses to keep track of the previous successful deployment in the following path /opt/codedeploy-agent/deployment-root/deployment-instructions/
Check the latest logs at /var/log/aws/codedeploy-agent
If your deployment is failing at ApplicationStop event, then most likely the issue is your EC2 instance does not have the necessary permissions to get the artifacts from S3 bucket.
Your EC2 instance must have an IAM role attached which gives it enough permissions to download the artifacts from S3 bucket
Your EC2 must be started with an IAM role. So you may have to reboot your instance after attaching the role to it.
From your configuration, looks like you have provided permissions to CodeDeploy to perform certain actions on your EC2. You may want to check if your EC2 also has the necessary permissions to download packages from S3 bucket.
Another reason for this error is that the CodeDeploy Service is not running on your machine. On Windows machines, Code Deploy Service terminates sometimes, and as a result, the deployment is not downloaded on the machine. Nothing appears in the logs either.
Run services.msc and check the code deploy agent service. If it is not running, start it and retry the deployment.
I had the same issue and solved it by solving codedeploy-agent that wasn't working on my EC2 instance.
sudo service {httpd/apache2} status
Something might have cause the agent not to run properly
Hope it will help
I had the same issue. You also need to make sure that your EC2 instance has code-deploy-agent installed.
Follow the below aws guide. It worked for me.
AWS guide to install code agent in linux server
Check if the codedeploy-agent is running.
sudo service codedeploy-agent status
if not running then use below command to run
sudo service codedeploy-agent start
If you are using aws Windows server, check the logs at :
C:\ProgramData\Amazon\CodeDeploy\log\codedeploy-agent-log.txt
AWS Docs
To check if the codedeployagent running in windows. Open powersheel command window and run these command.
powershell.exe -Command Get-Service -Name codedeployagent
Better to stop and start again.
powershell.exe -Command Stop-Service -Name codedeployagent
powershell.exe -Command Start-Service -Name codedeployagent
Or Restarting also works
powershell.exe -Command Restart-Service -Name codedeployagent
For me I had to uninstall the codedeployagent on windows by uninstalling and deleting old files of codedeploy.
Run the below command in powershell one by one to uninstall.
wmic
product where name="CodeDeploy Host Agent" call uninstall /nointeractive
exit
After this delete the codedeploy folder at this location.
C:\ProgramData/Amazon/CodeDeploy/
Now install codedeployagent on windows.
Start the codedeployagent again.
powershell.exe -Command Start-Service -Name codedeployagent

How do I read a file from the local file system from inside a meteor app?

I have a meteor app that needs to periodically read a file located on the host's file system, outside of the app package. I am using node's fs to accomplish this, and it works fine on my (macOS) development machine.
However, when I run mup deploy to deploy it to my (Ubuntu 14) server, mup returns the following error after starting meteor:
Error: ENOENT: no such file or directory, open '/home/sam/data/all_data.json'
at Object.fs.openSync (fs.js:652:18)
at Object.fs.readFileSync (fs.js:553:33)
Does anyone know why this might be happening?
you should follow mup documentation closely. Have you seen volumes setup in mup config? Try this to solve your issue.
Reason: mup runs app in docker without any access to host file system unless specified. Volumes setup does this for you with mup deployment.
Below is the part of mup config from http://meteor-up.com/docs.html, Everything Configured, read more to get a better idea.
name: 'app',
path: '../app',
// lets you add docker volumes (optional). Can be used to
// store files between app deploys and restarts.
volumes: {
// passed as '-v /host/path:/container/path' to the docker run command
'/host/path': '/container/path',
'/second/host/path': '/second/container/path'
},
The user you have that is running your meteor build on the server needs to have access to that folder - read access. I would store the file in a different directory than the home one, because you don't want to mess it up. Either way doing something like chmod -R 444 /home/sam/data should give read access to any user for all files in that directory. You are probably running meteor as your local user(sam?) in development mode on your macOS, but the built up gets run as meteor or some other user on ubuntu, because of mup and forever.

Sonatype Nexus only starting in console mode

I installed Nexus 3.6.0-02 on Redhat 7.4.
I am able to get Nexus to start in console mode by running the command: ./nexus run
If I try and start nexus as a service per the following documentation, nothing happens.
https://help.sonatype.com/display/NXRM3/Run+as+a+Service
If I run the command ./nexus start, the application does not start and there is nothing written into any nexus logs indicating why it failed to start.
The install and sonatype-work directories are all owned by the user who I have configured Nexus to run as.
Any ideas as to where to look or troubleshoot to figure this problem out.
Thanks
In my case I am using nexus 3 . I resolved this by deleting lock file placed inside nexus3 folder of sonatype folder and restart it by nexus start command.
Make sure the "run_as_user" configured in $install_dir/bin/nexus.rc has permissions to write to the installation directory and the work directory. And make sure they have a login shell, that is required for the startup script to work.

Missing value auth-url required for auth plugin password

I am trying to install openstack using devstack on ubuntu 16.04.
I followed the following link.
https://docs.openstack.org/developer/devstack/guides/single-machine.html
When I run
sudo openstack service list
, it prompt the following error.
Missing value auth-url required for auth plugin password
Make sure you are logged into horizon and download the rc file (right corner). After that do source admin-openrc.sh
Note that you have to download the rc file of the project you are working on
This should do. keystonerc_admin file is generated at the end of openstack packstack installation
source keystonerc_admin
always run admin-openrc file before running any openstack command
eg.
$source admin-openrc
then run whatever openstack command you want to run
eg.
$openstack --debug server list
Take rocky version of OpenStack Keystone as an example. https://docs.openstack.org/keystone/rocky/install/keystone-openrc-rdo.html#using-the-scripts
You can create an admin-openrc.sh (If you are installing OpenStack Keystone for the first time.) and put environment params. And source this file before you run any "openstack" command. This resolves the issue.
I put the admin-openrc.sh in directory /usr/share/keystone/admin-openrc.sh for a recommend.

Web Deploy script error - msdeploy.exe is not found on this machine

I'm trying to execute a web deploy script on a clean build Windows Server 2008 R2 machine and getting the following error:
ERROR: The system was unable to find the specified registry key or
value. msdeploy.exe is not found on
this machine. Please install Web
Deploy before execute the script.
The package was created in VS2010 and executes fine on my development box (as always!). If I import the package on the server through IIS everything works fine.
Web Deploy has been installed on the server through the Web Deployment Tool 2.1 via the Web P.I and I've verified the inclusion of msdeploy.exe. I'm running the script through the "IIS Extensions/Web Deploy Command Line" start menu item so I'm guessing that the correct paths should be set. I've also tried it as Administrator with the same error.
Any help greatly appreciated.
Copied from here:
There is an error with the way Microsoft’s Web Deploy 2.1 application creates command line packages from Visual Studio 2010.
If you create a package to publish and then try to run the msdeploy.exe command line publishing tool it on a production server running IIS then you may receive the following error:
ERROR: The system was unable to find the specified registry key or
value. msdeploy.exe is not found on this machine. Please install Web
Deploy before execute the script.
Assuming that you actually have installed Web Deploy from http://www.iis.net/download/WebDeploy then the error may be caused by an incorrect registry path variable in the .cmd file that Visual Studio creates.
Open up the .deploy.cmd file that is part of your deployment package in a text editor and look for the following code block:
if "%MSDeployPath%" == "" (
for /F "usebackq tokens=2*" %%i in
(`reg query "HKLM\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\1" /v InstallPath`)
do (if "%%~dpj" == "%%j" (
set MSDeployPath=%%j
If you have installed Web Deploy 2.0 or higher, then the error is caused by the registry query to HKLM\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\1. If you open up regedit on your production server you’ll find that the appropriate key is actually HKLM\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\2.
Change the reference in the.deploy.cmd file and you’ll be able to successfully run the deployment package.
I have the same problem. Installed WebDeploy_2_10_amd64_en-US. Running the Deploy Command Line I get the same erorr. However, in IIS (version 7) I could use an option import application. With this option (right side of the window in the actions toolbar) I was able to import the application deployment package zip file. All settings were imported correctly except for the application pool. I only had to adjust that and everything was running fine.

Resources