ntp should be installed to a web server normally? - webserver

And when there are multiple servers (app servers and db servers), ntp should be installed both servers? and then how to sync the time each servers?
When I insert something with NOW() sql, the time is from db server?
I assume a simple web service using Rail on this app servers.

Yes, you should always install ntp if you can on all and any servers especially production boxes. It will save you hours of pain and troubles later.
This is a quick guide to ntp setup on Linux which should give you some ideas as to how to set up, what the config options do etc.
If you only have two servers in your deployment then I'd suggest you find some 'trusted' low stratum ntp servers that you can use, and apply the same config to both servers.
Make sure you have a minimum of three upstream servers to connect to, ideally five for a robust time domain.
Once you ntp setup and running and your servers are keeping time whenever you ask for the time, it should be the correct time within a small margin of UTC. So in Ruby if you do Time.now.strftime("%Y-%m-%d %H:%M:%S") it will return the hosts time as set/clocked by ntp.

Related

Deploy a WebApp and always keep it running

I have a web application spread over multiple servers and the incoming traffic is handled by HAProxy in order to balance the load. When we do the distribution, we do it at night because the users are much less and therefore we are less in service. To make the distribution we use the following strategy:
we shut down half of the servers
we deploy on servers that are turned off
we reactivate the servers that are turned off
we perform the same procedure on the other servers
The problem is that in any case I turn off the servers we close connections to users. Is there a better strategy for doing this? How could I improve this and avoid disservices and maybe be able to make distributions even during the day?
I hope I was clear. Thanks
I strongly suggest to use health checks for the servers.
Using HAProxy as an API Gateway, Part 3 [Health Checks]
You should have a URL ("/health") which you can use for health check of the backend server and add option redispatch to the config.
Now when you want to maintain the backend server just "remove" the "/health" URL and haproxy automagically routes the user to the other available servers.

Is there a need to reboot Cloud VPS

I am running a web application on DigitalOcean VPS(CentOS 7) from almost 7-8 months and has never rebooted the VPS. I haven't seen any problem in the working or web application or database or mail server. Do I really need to reboot it?
you need to reboot your server after kernel upgrades or some security patches but generally you will never need to reboot any linux distribution.

How to setup postgresql replication when installed on windows server 2016 servers

I realize this is a basic question, and not very specific, but I don't know where to go for this. I am being asked to deploy two web servers onto windows server 2016 onto two hosts for load balancing. The database backend for the two web servers is PostgreSQL with POSTGIS.
I know how to install PostgresSQL.
I also know how to get them going for each host and attach them to their respective web servers.
What I don't know how to do is set them up for multi-master replication. On windows. All solutions I have found so far are Linux-based.
I'm looking for options and ideas.
Thank you.
I've personally never setup replication in a windows environment, working with PostgreSQL you're almost guaranteed some form of Linux environment. That being said, I did find a blog that details how to setup replication between windows servers (read-only secondary). This may not be a full solution for you but hopefully it will help.
https://www.sigterritoires.fr/index.php/en/replicating-a-postgresql-database-in-a-windows-workstation/

Server Monitoring - Open Source Alternative to Pulseway

As title say i'm looking for something like Pulseway.
Basically i need to monitor 3.000 devices. And i was wondering if there is something where i can install an agent on this devices and monitor/command them securely via a web panel.
Thanks for your time
You can try to use Monitis Server/Device monitoring. They have agent for both Linux and Windows systems. We are using it for checking our internal servers performance. BTW you can install agent in one machine and monitor other devices with your internal network using internal uptime monitoring. On one agent you can setup as many monitor as you need. here is more details http://www.monitis.com/server-monitoring

EC2: can I host an http server there?

Does anyone have experience deploying GWT apps to EC2?
If I were to install tomcat or apache on a ec2 instance, could I have users connect directly to a url pointing there?
Would that be cost effective, or would java hosting services be best?
Is there any downside to hosting the edge HTTP server on a regular hosting service and have that direct requests to EC2? Performance ever an issue here?
Other answers are correct but I just wanted to share the fact that we are are developing a product that is 100% EC2/S3 based and also have a pure GWT front end.
We use maven2 for builds and the excellent gwt-maven plugin. This makes it easy to produce a WAR package of our web application as output. We use Jetty but Tomcat would work just as well.
We have pound (a http accelerator/load balancer) running on the VM listening for http & https, which then forwards to requests to lighttpd (static) or jetty (app). This also simplifies SSL certificates because pound handles SSL. I've found Java servers have always been a pain to configure with SSL certs.
Yes, you can host pretty much whatever you want, as you effectively have a dedicated Linux machine at your command.
As I last recall, the basic rate for an EC2 instance, on their "low end box" worked out to around $75/month, so you can use that as a benchmark against other vendors. That also assumed that the machine is up 24x7 (since you pay for it by the hour).
The major downside of an EC2 instance is simply that it can "go away" at any time, and when it does, any data written to your instance will "go away" as well.
That means you need to set it up so that you can readily restart the server, but also you need to offline any data that you generate and wish to keep (either to one of Amazons other services, like S3, or to some other external service). That will incur some extra costs depending on volume.
Finally, you will also be billed for any traffic to the service.
The thing to compare it against is another "Virtual Server" from some other vendor. There is a lot of interesting things that can be done with EC2, but it may well be easier to go with a dedicated Virtual hosting service if you're just using a single machine.
Others have given good answers. I would have to add that you need to spend programmer time getting to know EC2's quirks and addressing them (e.g. with EBS). It's not completely trivial, and though it is useful knowledge to have and may be worth it for that reason alone, if you want to get up and running quickly with just a few servers, you should probably look at other hosted options.
On the other hand, if you plan to scale up massively enough (eventually hosting many servers on EC2) then I would highly recommend it. You have to architect a few things, but you need to do that anyways. The flexibility of on-demand computing, and the generally low price, makes this a killer platform once you reach a certain scale of operation.
You definitely can host an http server in EC2, but you need to take into consideration the following:
As mentioned before the cost can be much higher than alternative hosting solutions
Your instance (the machine you've started in EC2) can go off unexpectedly. There is no guarantee from Amazon for 24x7 availability. This mean that the data you've stored in local storage will be lost and when you've start a new instance, it will get a new IP.
To successfully host a server in EC2, you therefore need to employ some other services from Amazon. You need Elastic IP, so that you can circumvent the new IP address problem. You can also use Elastic Block Storage. This is a service that will allow you to mount in your machine a disk, that will not go away when your instance is lost.