Vue/Laravel: Hosting on AWS - amazon-web-services

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!!

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 I deploy the Django Rest Framework project on Firebase?

We are developing an application using Vue.js and Django. The essence of the application: accept user requests from the form, send them for approval to the backend and send an answer to the frontend. On the localhost everything is already organized and working. Now our frontend is on firebase and I want to deploy my backend part somewhere. So, can I use firebase for deploying my part? Š’ecause I met different ambiguous answers to this question
You cant, I guess you are using Django Rest Framework with Vue.js. So you need deploy your back-end to some machine. You can choose any hosting which can propose you Linux machine. GoogleCloud, DigitalOcean, AWS, Heroku and a lot of others..
I like AWS (In your case as a new user you can run free EC2 for 12-month, if you do not need a lot of performance)

Can a Django project be hosted in Firebase? If yes, give me an idea

I know to host my Django projects in pythonanywhere or something else. But, I need to know is that possible to host a Django project in Firebase Hosting Services.
Firebase Hosting only supports static content. It does not give you a way to run any backend code. You can use Firebase Hosting to proxy some requests to a Cloud Functions backend, but Cloud Functions provides its own way of handling HTTP requests.

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

Can I deploy CakePHP web application and BottlePy base WebServices API on same server?

I have a CakePHP based web application deployed on Apache (LAMP stack). Now I am doing a Web Services API using bottlePy that will expose services to be consumed by an Android application. The thing is both the applications will be working of the same MySql DB tables and reading/writing to the same. The reason its been done this way is because the CakaPHP based application is already available and was done a while back. Now we have a need to do an Android app and hence need to expose a Web Services API and since I am more comfortable with Python I would rather use. But before I dive deep in this direction I wanted to get answer to the following:
Can I have both the CakePHP web app and BottlePy based Web Services API served from the same Apache server? If not what will be an alternate?
Will two different apps accessing the same MySQL DB cause any issues in terms of locks, data integrity etc?
Anything else I need to be careful about?
So, I have implemented it anyways and it has been working great. I guess that answers the question, that yes it can be done.
I have both cakephp and bottlepy app served from same apache server.
I havent seen any issues and data gets written from both cakephp web app and bottlepy web api connected to android app.
Getting cakephp and bottlepy served from same apache server was a bit tricky but I got it working. I am not a webserver expert so dont know if the problems I faced were trivial or I solved something difficult. In either case it is working. If you face similar issues, let me know and I will post a detailed reply on how I did the setup.