9 ms·
Common Server Setups For Your Web App
- occam65 12y agoAs the "Startup Standards" begin to take shape, these guides prove to be extremely useful for the newcomers out there. Sure in 6-12 months it may become a bit dated (depending on the guide) but if kept up-to-date, they can be a powerful tool for a new company.
- sergiosgc 12y agoWouldn't it be much better to tech the concept of horizontal scalability applied to the application stack? Your server is a stack of interfaces: a frontend cache, a static content server, a dynamic content server and a database. You can horizontally scale each stack layer. Much simpler, applicable to different scenarios. However, this approach won't give you a viral article title like "eight server setups for your app" (replace eight by 2^n where n is the layer count).
- estsauver 12y agoThe one thing I really want from Digital Ocean is a guide that carefully explains how to set up the "private network" piece of the equation. The "orange box" that represents the private network in each of the examples is taken for granted, but for someone coming from an application development perspective that piece isn't trivial to make. EC2 Security groups make that sort of box incredibly easy to make, but DO doesn't have anything like that.
- beigeotter 12y agoThe article on setting up and effectively using the private network for what you're describing is actually now in our pipeline. It will probably be live this or early next week :) You can find our most recently published tutorials in our community here: https://www.digitalocean.com/community/?filter=tutorials https://www.digitalocean.com/community/?filter=tutorials or catch it in our twitter feed (@digitalocean)
- decentrality 12y agoPrivate Networking is available at certain data centers, like NYC2 == yes, vs. SFO1 == not yet. But these apply to your desired documentation: * https://www.digitalocean.com/company/blog/introducing-private-networking/ https://www.digitalocean.com/company/blog/introducing-privat... * https://digitalocean.com/community/articles/how-to-set-up-and-use-digitalocean-private-networking https://digitalocean.com/community/articles/how-to-set-up-an...
- estsauver 12y agoThis "private networking" is private to the every DO droplet in the same datacenter. If you expose a port for private networking in a data center and I get your IP I can access it if I also get a droplet in that data center.
- beigeotter 12y agoAs promised— here's the article that covers that info: https://www.digitalocean.com/community/articles/how-to-isolate-servers-within-a-private-network-using-iptables https://www.digitalocean.com/community/articles/how-to-isola... Let us know in the comments if you have any other suggestions :)
- austinhutch 12y agoThis is awesome! Great content for DigitalOcean to be pushing out as I am probably the exact audience they are looking for when they published this. E.g. I've never gone beyond a shared hosting setup but have been curious to try my luck at learning more of the stack by using the DO platform.
- Volscio 12y agoYeah, I've been googling for tutorials/configs/info on various deployment setups and digitalocean's come up more and more with solid guides. Thanks for sharing the secrets of the somewhat arcane!
- stanmancan 12y agoLinode, Slicehost and Digital Ocean all have pretty good libraries for beginners: https://library.linode.com/ https://library.linode.com/ http://articles.slicehost.com/ http://articles.slicehost.com/ https://www.digitalocean.com/community/articles https://www.digitalocean.com/community/articles
- bttf 12y agoI really enjoy the community-driven articles/tutorials that DigitalOcean provides. They have documentation for a lot of processes that are not readily documented or still emerging.
- beigeotter 12y agoThanks so much! We really appreciate it and are always excited to cover new topics. If you have any suggestions of what you'd like to see in our community, I'd recommend posting them in the comments here: https://www.digitalocean.com/community/articles/digitalocean-community-article-suggestions-and-ideas https://www.digitalocean.com/community/articles/digitalocean...
- ntoshev 12y agoIf you are just starting, you should have the simplest setup - everything on one server - and scale it only when it becomes necessary. Premature scalability adds complexity and slows down your iterations. My setups usually consist of an nginx serving static content and proxying applications requests (doing gzip, etc). The data tier is initially collapsed into the application as described in http://www.underengineering.com/2014/05/22/DIY-NoSql/ http://www.underengineering.com/2014/05/22/DIY-NoSql/ This architecture allows very fast iterations while providing enough performance headroom; it can serve 10k simple (CRUD) http requests per second on a single core.
- jacquesm 12y agoSecond this. For reference: 100K+ users on a very dynamic site served from a single box with some partial caching. The machine is a fair sized one (lots of ram, fast disks, 32 cores) but I see no advantages from using multiple machines where a single one will do. I've seen quite a few places with over-complex setups due to gross inefficiencies in the software they deployed. KISS is good advice, even in 2014.
- TomNomNom 12y ago> I see no advantages from using multiple machines where a single one will do One machine is OK when downtime is OK too. Such situations do exist, so it is sometimes a viable solution. If you're serving traffic to 100K+ users then chances are that's not one of those situations. How are you handling redundancy? Or is possible downtime just an accepted risk?
- neom 12y agoAnd developers who are not full stack focused (more and more developers) - They make early bad architecture decisions and often don't consider downtime in the future of acceptable risk, therefore don't plan for it, therefore build applications that don't scale well. It's fine to say in most instances you don't need more than one server that you can scale "physically" - but it's unfair to suggest you shouldn't consider the risks involved and the (sometimes very rapid) needs at future scale.
- coherentpony 12y agoThat was super helpful. I think I finally understand how serving web applications works. Thanks to whoever wrote this.
- jacquesm 12y ago> I think I finally understand how serving web applications works It's nice to see you got a lot out of the article but this is hardly a complete course on how the web works from the server side. It is more of a quick guide on a number of common server set-ups for mid sized web sites. If you want to learn more about 'how web serving applications work' I suggest you follow one of the how to guides about setting up a web server of your own and serving up a couple of pages. You won't need any extra hardware for this, all the software is 'open source' and won't cost you a dime. Depending on what kind of operating system you normally use you could start with any of these: Windows: http://httpd.apache.org/docs/2.2/platform/windows.html http://httpd.apache.org/docs/2.2/platform/windows.html OS/X: https://discussions.apple.com/docs/DOC-3083 https://discussions.apple.com/docs/DOC-3083 Linux/Ubuntu: https://help.ubuntu.com/10.04/serverguide/httpd.html https://help.ubuntu.com/10.04/serverguide/httpd.html best of luck!
- fideloper 12y agoMay want to update the Ubuntu guide to 14.04 docs: https://help.ubuntu.com/14.04/serverguide/httpd.html https://help.ubuntu.com/14.04/serverguide/httpd.html
- coherentpony 12y ago>It's nice to see you got a lot out of the article but this is hardly a complete course on how the web works from the server side. It is more of a quick guide on a number of common server set-ups for mid sized web sites. If you want to learn more about 'how web serving applications work' I suggest you follow one of the how to guides about setting up a web server of your own and serving up a couple of pages. I actually meant just the hardware aspect of the setup, sorry for the confusion. That said, I'm still super interested in how the actual serving works. The resources you've provided seem to be exactly what I'm looking for. Thanks so much for providing those. My experience is in HPC where 'serving content' actually means 'sending data to other nodes'. The upside of this is that in a compute cluster, all the nodes are, usually, in the same room and are actually located very close together. There's still a lot of networking involved in getting the nodes to communicate, but it's super interesting to me to see how to scale things on the web where nodes are not necessary even located in the same country! The example of having the DB and application servers on different machines is a good example. Anyway, sorry for the digression, and thanks again for the links. It'll be bed-time reading for me :)
- sz4kerto 12y agoI am hosting all of my stuff on a single VPS instance in Docker/lcx containers. It is reasonably easy to migrate stuff out if I need a larger hardware, but it's also very cheap. Regarding scaling: a couple of years ago I ran a database on a single CPU core (because of licensing issues). It stored 50M rows a day and also executed various queries quite quickly. So I seriously doubt that most of us is going to need large clusters.
- Kiro 12y agoWhy do you need Docker for that?
- mkal_tsr 12y agoHow do you figure they need Docker for that? Seems like it's what they chose, not that they had an undying belief that Docker is the One-True-Solution.
- Thaxll 12y ago50M/day on a VPS / single core, I'm having hard time believing...
- brixon 12y agoHe did not say how the data was structured. Someone with simple/skinny indexes would do fine on weaker hardware than someone with complex/wide indexes on the same size dataset.
- sz4kerto 12y agoNo, that wasn't VPS. It's kdb. http://pietrowski.info/2012/12/kdb-high-performance-column-oriented-designed-for-massive-datasets-database/ http://pietrowski.info/2012/12/kdb-high-performance-column-o... "1.126 million inserts per second (single insert)"
- h1karu 12y agoExcellent writeup! Next I'd like to see an article on deployment. What if I want my development team to be able to push code changes regularly to an app cluster via a git-based workflow and have these deploys all occur with zero downtime ? I think that an article which demonstrates how to use modern deployment tools such as ansible or docker to achieve those goals on a commonly used programming environment such as Ruby would serve to lure quite a few developers away from PaaS towards something like Digital Ocean. For now though, those tasks are still "hard" which means that for many developers digital ocean is still hard to use relative to other emerging platforms such as Redhat's Openshift or Heroku. I know there are many shops who would love to jump ship from IaaS to a less expensive platform but they feel the cost of rolling their own zero-downtime clustered deployment infrastructure is not worth the $ savings. I suspect that if IaaS providers were to dedicate resources towards producing more educational material for developers with the aim of demonstrating how to achieve these deployment objectives on all the popular platforms using modern open source tools then loads of PaaS developers would jump ship. For example: How can I use ansible to instantiate 5 new droplets and automatically install a load balancing server on one of them while setting up the Ruby on Rails platform, and ganglia on the remaining ? How can I run a load balancing test suite against the newly created cluster, interpret the results, and then tear the whole thing back down again all with a few keystrokes ? How could this same script allow me to add additional nodes and how does the resulting system allow for the deployment of fresh application code ? How can it be improved to handle logging and backup ? I know that it's possible to create a deployment system to answer the above questions in less than a few hundred lines of ansible + Ruby, so I imagine it could be explained in a short series of blog posts, but you would probably need to hire a well-paid dev-ops guru to produce such documentation. I bet if you ask around on HN... p.s. keep an eye on these: http://deis.io/ http://deis.io/ https://flynn.io/ https://flynn.io/ ^ If either of these become production quality software it could be a game changer for Digital Ocean.
- adventured 12y agoThe effort D.O. puts into their community education is one of my favorite things about them. The few times I've had problems with a droplet configuration, inevitably someone had already posted a solution in the help section.
- falcolas 12y agoVirtually no mention of how the different server setups affect availability - this is very unfortunate. Availability (not to mention disaster recovery) are two things which I think are significantly more important than scaling, and your choice of server setup will affect both.
- Numberwang 12y agoWhat do you mean with availability?
- roryokane 12y agoI think by availability he means uptime. Whether your site is always available, or there are times when your site is down, and how long are they.
- falcolas 12y agoYup: Uptime. In the face of a box rebooting unexpectedly because it's a VPS. In the face of a data center experiencing connectivity issues. In the face of Hurricane Sandy's big brother.
- coreymgilmore 12y agoI propose an alteration to the typical LAMP stack: Replace Apache with Nginx and MySQL with MongoDB. Personally, the reduced resource use of Nginx is nice since I can run on a smaller "box". MongoDB is just a choice depending on the data set, but it does allow for sharding out horizontally without too much effort.
- cookerware 12y agomy current setup on DO, I would like some inputs. website hosted on 1 droplet. additional 1 droplet per every customer is deployed through Stripe and DO api. DO let's you save a snapshot and load it to the droplet. I have a snapshot that is basically a copy of my 'software'. It's a LAMP stack with init script to load the webapp from git repo. Customer logs in at username.mywebapp.com The beauty of this is that I never have to worry about things breaking or becoming a bottle neck. if one customer outgrows themselves, they won't affect other resources. It has linear scalability, new customers, add a new droplet. I don't need to worry about writing crazy deployment scripts although I use paramiko to ssh in to each server when I need to get dirty. The main website is mostly static content. I could host it even on Amazon S3 but currently using cloudflare. Updating the product code requires me to restart the droplet instance. However, I test things out on another staging droplet. Once things work on there, I use the DO api to iterate through all the customer droplets and do a restart.
- ovi256 12y agoThe obvious remark is why do a new webapp deployment per customer instead of a multi-tenant app ? Multi-tenancy requires more code in the web-app to isolate accounts, but it will mutualize and consolidate web servers.
- cookerware 12y agoI did it because a new webapp deployment costs nothing, no extra work involved at all with DO, just add a snapshot and ssh key to a new droplet. If something needs to be consolidated, I just use DO api and paramiko to ssh into each droplet and run new commands. If it's updating the webapp across all customers, it's a matter of issuing restart command to all the droplets via API.
- xur17 12y agoAren't you paying for hosting on each droplet though? Consolidating would save you that money, but I guess this wouldn't have a huge impact if the income per customer is a lot larger than the cost of an additional droplet.
- derengel 12y agonice guide, maybe a setup including redis/memcache would be useful too.
- CSDude 12y agoIt would be very helpful if DigitalOcean sells load balancer too as Linode, because the bandwith limits are for each Droplet which makes it very illogical to use DigitalOcean. Of course, we can use Cloudflare or similar, but still It is a need.
- pyfish 12y agoThanks for the write up. It's the perfect time for me to be reminded about starting simple and changing the architecture as needed. I have prematurely optimized on one project in the past. It was painful. And after all that pain the mythical millions of unique visits never arrived.
- sandGorgon 12y agodoes anyone know what a bare minimum monitoring setup for a single server having nginx, postgres and rails ? I'm far too intimidated by nagios to do anything significant.
- incision 12y agoIf I'm reading correctly that you just want something simple and completely hands off I'd suggest New Relic - absolutely trivial to set up, free for basic server monitoring. 1: http://newrelic.com/ http://newrelic.com/
- Jordan15 12y agoBut GAP only supports some languages... you can't compare