Web Development Architecture (FOCUS: Database/CouchDB) - web-services

I had few questions that might be easy for others, but that I couldn't wrap my head around.
In developing a "PRODUCTION LEVEL" full-stack web application(node.js/react/webpack),
1) Where do you set up your database? (when developing, I'm using apache couchdb running on my localhost, but when deployed, is cloud database(cloudant) the only solution? or am i missing something?)
2) Is it recommended to deploy my server(node.js) to either digital ocean/aws/heroku, AND set up a third party database else where? (in my case, I'm have to use either Digital Ocean/Aliyun(Chinese Web Service), but they don't seem to have a database package that comes with couchDB) - What is the practical solution for production level application?
3) If cloud database is the practical solution, What Do I do if there is no database storage center for CouchDB located in China? is there a cloud database storage that universally saves all noSQL data regardless of your type of DB? (mongoDB, couchDB, etc.,)
4) AWS/Heroku provides add-ons where you can connect cloud database to my application, does this make the speed of my application faster? For Digital Ocean, it shows article about setting up CouchDB with their service, but does that mean that database will be available for my users to access? or is that just for development purposes
5) Where and How does "Docker" come in to play to help in my situation?
Sincerely,

I cannot say for CouchDB, but I have hosted multiple web applications on AWS using their RDS Database (MySQL). The service you choose (AWS/DO/Heroku), depends on your application and your requirements (pricing etc).
I don't think AWS has a package for MongoDB, but there is a third party service MongoLabs, which can host the MongoDB Database, I bet there would be some out there for CouchDB too.
Or if you cannot get a third party hosting, consider installing the database on your server itself. Getting a VPS from either DO or AWS and setting it up yourself could be an option in that case. The link you mentioned in your last paragraph would help you here. And yes, if you use that and let node connect to it, you can use it just like any other cloud based database, just that it would be on your server.
I haven't used Docker, so cannot say if and how that could help
UPDATE: (reply to comment)
A VPS is a server in the cloud. You don't set up the database on your local computer, no one can access that. You set up your database on the VPS (in the cloud) and then everyone can access that.
A VPS is like your own clean copy of server (ubuntu/fedora) in the cloud, so you can pretty much do anything on it, like your local computer. So basically your database would also be in the cloud.
There are actually 2 ways you could do that.
Get a VPS, install your database and set up your node.js server on the same VPS. Your node application would access the database on the same VPS.
Get a VPS specially for the database, and set up your node.js on another VPS, this would separate the database and node app on two different servers.

To answer part of your question... if you set up a CouchDB server on Digital Ocean (or on AWS, Azure, Google Cloud etc) it will be available to your production users, not just you. You will want to set up security/firewall to limit who can access your server of course.
Cloudant provide CouchDb as a service, in other words you would not have to install the software or manage a server.
With Digital Ocean/AWS/Azure/Google it is down to you to manage the virtual server and the database/other software on it. You can install CouchDb on any of these services and you can install both NodeJS and CouchDb on the same virtual server if you wish.
Bitnami have a CouchDb package that you can use to deploy CouchDb on to several of the major hosting companies, which makes the setup process easier.
I see that AWS and Azure have data centres in China, but at the moment Digital Ocean do not as far as I am aware. I hope this helps

Related

Nextjs with websockets for chat app deployed on GCP

i had created a small app using nextjs and had deployed it on google cloud run. I was thinking of adding in a chat feature and could not figure out the best way to approach it. All i know is i dont want to use another 3rd party software but just do it with websockets / socket.io.
nextjs says that i can just create the socket server under the /api folder but with cloud run im assuming that might cause issues when there are multiple instances running and ill have to worry about synchronizing the data with like a redis database https://cloud.google.com/run/docs/triggering/websockets#multiple-instances. its just this gets super expensive.
I was thinking what if i just created a new websocket/socket.io server and deployed it on a cheap compute engine as if i understand correct that is just going to be one VM and always up right? and then the nextjs app can just keep running on cloud run and then connect to the compute engine websocket server when they navigate to the chat app. I was then even thinking to move all my database logic over to this application which is hosted on compute engine so the nextjs app can just ask the new server for all the data when it needs to populate the data.
Is there any other better solution or is there issues with this approach im not thinking of? i dont get much traffic so i dont need any crazy strong VM that will cost be a lot hence i was thinking of going this route and this might help me seperate the UI and the backend server. mainly liked nextjs for the SSR content as my FAQ pages and all are SEO friendly over all the additional over head i would have had to do with a react app.

Vue/Laravel: Hosting on AWS

Learning AWS and looking for guidance on how to best put this app onto the web.
I have a fairly straightforward app:
Frontend build in Vue
Backend built in Laravel
In hindsight, I wish I'd just used Inertia within the Laravel app but alas.
Authentication is via JWT and users are stored within the backends connected database.
What I've already tried:
Attempt One
Using Elastic Beanstalk for Laravel hosting
Amplify for the frontend hosting
The issue I faced was EB uses http where as Amplify uses https so I couldn't get the two parts to talk to each other.
I then tried to use Router53 to make the connection (by buying a domain) but couldn't get the connection to work.
Attempt Two
I tried to put everything on an EC2 instance. Unfortunately, that was way too involved and my skillset isn't yet strong enough to progress there. I don't even know if it's even possible.
Conclusion
Anyone can provide direction on how to best host this app? Its just a practice app and I'm just learning.
Thank you for your help!!

AWS - IIS and Windows services and SQL server - Load balancer and High availability

We have a software product made in .Net.
It has one Asp.net website and four Windows services.
Both Asp.net application and Windows services communicates with SQL server installed in same machine.
Right now we have hosted this product in a Windows server 2012 R2. So one server contains one asp.net application, four windows services and a SQL server.
Now we have decided to move this infrastructure to AWS.
Basically we want to get following benefits:
IIS and windows services load balancing.
IIS , windows service, SQL - fail over. So if one server goes down, there will be other one who can continue to serve requests.
So anyone can please provide me some links or other sort of help which can help me to get started as I am new in AWS?
Thank you.
You should read the "Well Architected Framework" from AWS
https://aws.amazon.com/architecture/well-architected/
The site points to each pillar of the framework. There's also one whole whitepaper on the subject, a good read if you're seriously attempting a solution in the cloud.

How to deploy mid sized Django App [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I just finished my Django App. All these months, I have been running the app on a local server using
python manage.py runserver
and it ran on 127.0.0.1 and was accessible only to my computer. Now that I am finished my app, I want it to be accessible to the world. I tried researching how to deploy my django app, and probably like most people in my situation, I am now completely lost. The words 'WSGI, AWS, WebFaction, Domain, Web hosting, Shared hosting, servers, VPS Vendor, RackSpace, Apache2 etc' are all flying around my head.
The first post I cam across was this one:
How to setup Django website in Amazon EC2 hosting?
The post says Amazon EC2 servers are good, but recommends WebFaction / Dreamhost instead. I decide to pick Amazon EC2 instead of WebFaction / DreamHost. I google about Amazon EC2, and then I find myself reading comparisons about AWS and VPS Vendors like RackSpace. I then agree to use Amazon EC2 instead of RackSpace. Then I thought to myself, where exactly do I buy the domain name from? I know that goDaddy is really popular for hosting domians so I look into that and I realize that godaddy doesn't support Django. I google'd which web hosting companies support Django, and I came across WebFaction again. So wait, I use WebFaction to register the domain and Amazon to host the site? I look at the prices for WebFaction and they give prices for bandwidth, disk space, server location etc. I google the price for AWS and they talk about the exact same thing: server location, space etc. At this point, I don't even know if WebFaction and AWS accomplish the same thing and if I am supposed to pick one or the other, or if WebFaction is for simply hosting the domain and AWS for the server? I then decide to research about servers, hoping to come across a post of how Amazon servers work and their relation with domain hosting sites. Instead, I find myself reading about Apache. Hm, so Apache is now another option? I google the relationship between the Apache server and AWS, and find that I can set up Apache on AWS? So do I need WebFaction, AWS and Apache to deploy my Django app?
I tried doing more research about deploying a Django app and came across a post talking about WSGI. It seems as if the more research I do, the more confused I get. So this is where I need your help:
The Django Application is basically a 'Blog' site which allows users to create accounts, upload images, comment and like images, follow other users, make posts (which consist of only text and images), comment on posts and like posts.
The Django Application is directed to an audience of about 1500 users (I'm estimating about 1500 users within the first two months). The application will be put up on the Android and iPhone app store as well (through WebView). My hostOS is windows 8 but I downloaded a VM (which runs Lubuntu) and did all my Django stuff in Lubuntu using Django 1.5, Python 2.7 and had to install PIL and Pillow as well. I used a PostgreSQL database. With all these details, how should I host my site?
I don't want to say 'Which servers should I use' because then some will say 'Amazon', some will say 'DreamHost', some might say 'Buy a domain and then user Amazon' and some might even start talking about WSGI and Apache to make me really confused.
What steps do I need to take to host my 1500 user application? Once the application hits 1500 users and starts going higher than that, then I will think about switching to a larger server, but for the first 1500 users, where should I buy the domain name and host the site? The site needs to be live within the next 3 weeks (so if a VPS vendor or Amazon EC2 is highly recommend, I can take out an entire week to learn about them). I just want to know if there is a more recommended, simpler solution rather than jumping right into a VPS vendor or buying a Domain and using Amazon EC2 server.
Edit: Should this go on ServerFault instead?
There are several layers here that you all need, but it can be confusing at first. To set up a Django site in a production environment, you're going to need:
Server hardware.
Webserver software.
Python connector (WSGI).
Registered domain name with DNS records.
A hosting service gives you access to server hardware. You rent a physical server or a virtual environment on a physical server. Most hosting platforms include domain name registration and managing DNS records, but some might require you to seek these services elsewhere.
In order for the server to actually serve a http response upon receiving a request, it has to run a webserver process. Apache and Nginx are such webservers. WSGI is the standard that allows webservers to communicate with Python applications. You'll need an implementation of this in order to connect to your Django application. Some choices are gunicorn, uWSGI and Apache's mod_wsgi.
With this information you should be able to understand most articles explaining how to deploy a Django application. Everything except the part about WSGI is also applicable to any other website, not just Django.

Webservices with Google Apps Engine or Azure?

Simple problem, actually. I am trying to evaluate the possibilities of Google Apps, using Python as development language. It seems practical to create a web application or web site with it, but how about creating web services?
I am not too interested in solutions to create a SOAP or REST service in Python for Google Apps, since a simple Google search should provide plenty of solutions. I am more interested in experiences and ease of use.
But the real question is: When comparing a web service in Google Apps with web services in the Microsoft Azure environment, which would provide the better performance? The best user experience? I don't care for the actual development languages but need a good comparison of pro's and cons of web services in both the Google App Engine and Microsoft Azure.
Somehow, Azure seems better suited for services while Google seems better for sites. A tough choice...
Would be very interesting to see if both could be combined into a single solution. :-)
Btw, choosing which engine to use also means choosing the proper development environment and programming language. While I'm proficient in .NET and Python and many other languages, the choice for the service engine determines my focus for future projects.
When building services in Windows Azure, they'd simply be processes running in your VM (Windows Server 2008 SP2 or R2 SP1). You can host services easily in any of the three role types:
Web Role (essentially Windows Server with IIS running) - just add a WCF endpoint to IIS or self-host from your own process).
Worker role (Windows Server with IIS not running) - self-host from your own process
VM role (your own Windows 2008 Server VM pushed to Windows Azure) - Host with whatever mechanism you install / set up.
Each VM in Windows Azure may expose a total of 5 endpoints. These can be a combination of input (external facing) and internal endpoint, each port supporting tcp, http, or https. You define endpoints in your vm role's properties.
Internal endpoints are only usable by other VMs in your deployment. You can't see them / access them from anywhere else, including other Windows Azure deployments. Input endpoints are accessible by the outside world.
If you want an app running in Google to access your Windows Azure service, simply connect to the endpoint via ip+port. The one thing you'll want to be aware of is bandwidth usage. Because your Google-hosted app will be in one data center and your Windows Azure service in another, you'll pay ingress / egress for data going in and out of your Windows Azure service (and I'm guessing there's an associated bandwidth charge on the Google side, but I'm not sure).
It's actually pretty simple to set up a service. For .NET-based examples, look at the labs in the Windows Azure Platform Training Kit (this also other good examples, such as setting up your first Windows Azure application). For a python service host, you'll need to execute python.exe from your VM role's OnStart() event handler, passing in your script name (and optionally port number to listen on). For a simple example of launching python.exe, look at Steve Marx's blog post here.
EDIT: If you're looking to host multiple services (e.g. multiple ports), you can choose to host them in a single VM role or in separate roles, to optimize for cost (with the known limit of 5 endpoints) or performance (scale each service independently).