We are using Plesk to host our production services.
Basically when I deploy application to Plesk using Git, I need to press Restart application within Node page on Plesk GUI and that works well.
But in some cases I need to do that pragmatically, I need to automatically restart Node service. Does Plesk offer such functionality? Maybe, some kind of API that listens to calls or else within Linux shell itself.
When you click Restart App you'll notice a message state Information: The restart.txt file was touched. Application will be restarted after the first request.
You can emulate this action after the deploy by checking Enable additional deploy actions in the git repository options, and touching the same file here (I also run npm install too). Screenshot attached.
Since there was no answer for a while, this is my old workaround that I used for PM2 scripts force reset:
If it's a webserver application, e.g. Express.js, add protected route that can be accessed only within your privatae network (for security reasons) which basically kills main process via process.exit(0) and your webserver will get reseted automatically by PM2 or whichever service you use for it. However, I wouldn't recommend this method for anything above staging.
I have this issue too, and Plesk support don't have an answer for me either.
According to the Plesk blog here: "Moreover, if your app is running in the “development” mode, you don’t need to restart the app every time you modify the contents of a file."
I'm very new to Node so I don't fully understand the implications but I guess if you run the app in development mode, then you won't need to manually restart the Node Application.
The only way I have found that consistently works on Plesk is this command:
touch tmp/restart.txt
Even in development mode, Node does not seem to automatically restart.
What's worse is that it takes about 5-6 seconds before Node finishes restarting, using the touch method.
My takeaway is that a Plesk server is the wrong place to do Node development or testing.
Related
I'm running a Google App Engine production server, using basic_scaling as the scale type. Whenever I update the code and deploy it - using gcloud app deploy - the old version of the code is shutdown.
According to the documentation, that's expected:
The shutdown process might be triggered by a variety of planned and unplanned events, such as:
You manually stop an instance.
You deploy an updated version to the service.
...
I understand that it's easier for most developers that way. But in my case, I'd like to keep the old versions running until the idle_timeout limit is reached. Does anyone know if there's a way to avoid the automatic shutdown and let the old versions to shutdown by themselves?
Per Google's documentation, when you deploy your code, the default flag of --stop-previous-version is used. This forces the previous version to be stopped. If you do not want that, you should explicitly use the --no-stop-previous-version in your deploy command (we also have this as a feature on our App, a GUI for GAE; you check or uncheck a checkbox).
Unfortunately, Google does not provide a way for the service to automatically shut down later. You'll have to manually shut it down and start the other version later.
I need to test my wordpress install which I have set up already and deployed. I have to debug, so waiting 10-15 mins for it to deploy to test one thing isn't going to work.
All they mention in their docs: https://cloud.google.com/appengine/docs/flexible/php/testing-and-deploying-your-app#running_locally
Running locally
"To test your application's functionality before deploying, run your application in your local environment with the development tools that you usually use."
That's it. How can I actually serve my wordpress application? My tools I "usually use" are xampp...very confused.
Can someone help me run my flex env locally to test it?
You may want to take a look at this for the initial tests for your PHP application. You would have to install composer on your shell for it, if you haven't done it already.
Then, for the WordPress application, follow the steps described here to test the Cloud SQL instance that is associated to the app. There is also the possibility to test all the updates you want to apply to the WordPress side. Skip the deploying part until you confirm all your changes work for you, so that you don't have to wait all that time for a deployment.
I am starting to learn Angular and I am employing a MEAN stack. The grey area in my mind is when my angular app is finished and ready to deploy on a server.
Would I still need to use Apache of Nginx to route a domain or subdomain to my app?
I guess the node/express.js is my main question. I have used it when working locally, but when deploying would that run my app on the server side.
Thanks in advance.
You can run Node and your app on the server as-is, single-threaded...provided you took care of telling DNS where to reach the app.
To riff off your nginx question...here are a few of other deployment/config questions that you may consider:
server crashes: sooooo...node isn't at 1.0 yet and apps sometimes do unexpected things and die. tools like forever, supervisor and similar things can auto-restart the server.
logging: tools like morgan, winston and more can provide logging so you can see what was happening on the server before big events (everybody hit the same page, the server crashed every time page XYZ was hit, etc)
load balancing: a node server is single-threaded, single-instance. if you have a super busy site or you are stuck with synchronous stuff (blah!) you'll want to consider how to spin up multiple node instances. nginx and node clustering would be things to consider, but if your app is small, this is probably not a priority over handling crashes and logging
I have a C#/WPF app that uses ClickOnce for deployment. There is a scenario where the app needs to restart (the user changes a database). I do it by:
System.Diagnostics.Process.Start(System.Windows.Application.ResourceAssembly.Location);
System.Windows.Application.Current.Shutdown();
After restart, it seems that the app has issues:
The version becomes 1.0.0.0.
The current database setting is set to default (it is in the application's Properties.Settings).
I don't know that I fully understand the question, but I do know there is an issue with the method you are using to restart the application if it is a ClickOnce application. When you restart the application this way, ApplicationDeployment.IsNetworkDeployed will be false. See this post for a full explanation: http://bit.ly/RKoVBz.
I haven't verified the proper way to restart the application yet, but I'll update this a soon as I do.
I have a WPF (Clickonce) app. I want to find out which users are installing or re-installing the app, and probably write those info in a database for audit.
How can I do that?
The current ClickOnce deployment doesn't provide any server-side hooks for monitoring whatsoever (in fact, the "website" generated by ClickOnce publishing is just a very simple, plain HTML page providing a link/button for downloading and executing the .application or setup.exe, respectively, on the client machine. Everything else is taking place locally).
Now, depending on what you want to log (initial installations, or updates, or both) you have the following options:
Create your own website where user will register before getting access to the install/launch for the app (or maybe you just identify them by IP - depends on your needs) - this allows you to log who first installs the app, but not the automatic updates.
In your application, use the classes in the System.Deployment namespace (notably ApplicationDeployment) to access information about updates etc. whenever your application is run. You can then have your app make calls to a web service that you provide, where you can log any installation / launch action (or even other runtime information, like usage of certain features, exceptions etc).
If you are targeting .NET 4, you can have the log files go to a specific folder. Then when the user runs the application, you can have it copy it to your server and delete it, or write it to a database and delete it. Here's an article explaining how to specify where to put the log from a ClickOnce deployment. Note that it runs when you install, update, or uninstall the application.
http://robindotnet.wordpress.com/2010/05/31/enhanced-logging-in-clickonce-deployment/
The registry settings are in HKCU, so you could have your C/O app actually set the info when it first installs. You'll miss the first install log, but it will write the logs to disk after that.
Also note that the article tells you how to turn on verbose logging. You don't have to do that just to write the log to a folder.