Deploying full stack applications query - amazon-web-services

i finished creating my first full stack application using Spring boot, ReactJS and MySQL, I'd now like to deploy this application but I'm unsure on some things and would like clarity.
What is the best approach, do I package my spring boot and react code into a single jar and deploy the entire thing? Do i deploy my backend api and mysql separately and put my frontend on something like netlify? What other approaches are there?
Can i deploy and host the backend and database myself on my VPS and have it available on the internet or do i need to host it on a cloud service or something else. If so, what are the general steps needed to do that. (as well as pricing fees)
I'd like to know some more about devops, what else should I be learning if I want to head down this route?
At the moment I have about $100 credits on Azure and would like to test deploying a full stack app, but I'd also like to know the process without a cloud service.

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.

Can an Azure Web App consist exclusively of azure web jobs

I am working on a solution that requires many continuously running web jobs. I don't want to package these with any of the Web Apps that are part of our product for reasons of isolation and performance.
I guess some Azure Dev Ops work is involved, but my question is do I have to create Web app with no code, like a Weather Forecast type of project in order to deploy my web jobs.
You are correct. Azure does not have any standalone resource for webjobs. You can create an empty webapp and use that to host your webjobs. Or, you can check out Azure Function app which is quite similar to web jobs as it also utilizes WebJobs SDK but have some additional features as well as constrains. Chris has explained more in details in his answer.

How can I invoke a desktop app from Google Cloud Platform services?

I'm building a desktop client app (win/linux/mac) with a backend hosted in GCP (I'm considering other cloud platforms too). The desktop app should be minimalistic and provide access to local machine resources to the backend. And I'm looking for a way to invoke my app from the server (when some event occurs) and then the app would do some work on a local machine. Here's what I've tried so far.
Google Cloud Pub/Sub. Seems like it does what I need, but to make it work I have to create a service account, generate JSON key and store it locally, which is not good. I can restrict the service account access permissions, of course, but still it doesn't look good to me. Maybe there are other ways to auth my app running at the end user machine? I want to keep my desktop app minimal (ideally without UI, just an "agent" console process / Windows service). Maybe I could consider a login screen to connect the app with the backend, if that solves the problem, but I don't want to overcomplicate.
Google Cloud Run + SignalR / WebSockets. This solution also looks good, but it has one significant disadvantage. As long as there's at least one open WebSocket the Cloud Run instance is considered active and therefore billed. There are other difficulties related to scalability and container instances synchronization too.
What do you think about the options above, and what are the other possibilities? Am I left with REST API and polling for updates? I'm quite new to the cloud stuff so any help is appreciated. Thanks!
If you want to be able to invoke your local app from Google Cloud, you need 2 things
The first one, to register your app on Google Cloud, with, preferably, a auth mecanism (can be an API key for example). Like this, the GCP backend know where to call you app (which IP/port) and how (the auth mechanism)
The second is to have your app up and running and listen external communication. HTTP is the easiest way. Wait a HTTP call on the IP/port defined during the registration, check the auth and perform the process.
You can store the data (location and the auth) in firestore for example, and use Cloud Run to perform the HTTP call.
You can also inverse the solution and to poll (long polling or regular poll) the backend from the local app when it is running.
The 2 approach are possible, the second one slightly easier but can be challenging to manage the security.

Does previewing/publishing an application created using App Maker need GCP account as well?

I am very new to GCP and G-Suite. I wanted to understand one basic thing:
If I create an application (to be used within a domain) using App Maker, do I also need access to GCP?
I have done lots of googling [https://support.google.com/a/answer/9142070?hl=en] but couldn't find answer to this.While watching to one video on AppMaker I realised that- I can create application which could interact with G-Suite apps but we can not preview/publish this application without having account/access to GCP as "previewing" an app actually deploys the app on App Engine which is part of GCP. Also "publish" would definitely be doing the same.
Can any one help me in understanding this? I want to start my page development in App Maker and want to spend money on GCP later, this is doable only when preview is not dependent on GCP?
Any quick reference would be appreciated.
Regards.
App Maker is dependant on GCP products: Google Cloud SQL and Google App Engine; Although, the latter one is not being charged. This information is located in the official documentation.
App Maker apps usually store data in Cloud SQL, a Google Cloud Platform (GCP) service that delivers fully managed SQL databases in the cloud.

Web Development Architecture (FOCUS: Database/CouchDB)

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