I'm creating a an app using react as the frontend and strapi as the backend with a mongobd database.
So I have two folders at the root of the app client and server
Is it possible to deploy both folders like this on heroku.
I have read in another tutorial that
If deploying your backend to a provider that does not persist storage
on the server like Heroku, the default Strapi local server upload will
not work as your files on the server are automatically wiped
periodically.
Just trying to find the best way to deploy this app
It just so happens that I just build a project like this. For the frontend I used Gatsby and Strapi for the CMS. I deployed the Strapi app on Heroku (and used a Postgresql database - you can add this as a plugin from the Heroku dashboard, or do the same with MongoDB) and the Gatsby app on Netlify (same thing you can do with a React app).
It's true that by default Heroku wipes your data once a day (I think), but since are connecting your app to Mongo that shouldn't be an issue. Just add the DB variables to the respective fields in your Heroku app's dashboard.
I like to keep the front and backend separate myself, so I would deploy them as separate repos, either on Heroku or anywhere else.
Related
I have created a website using react and firebase and hoisted on firebase. After making changes I want them to be visible on my website. What is the process for the same so that the website is not deployed on a different link ?
Most likely you deployed the web site to Firebase Hosting by running some variant of:
firebase deploy
To update it you can simply run the same command again.
I have a MERN Project that i have done and now i want to deploy it, the thing is i never deployed a project, so my question is : i have seen youtube videos about deploying with heroku, and my project has 3 folders ( backend(has the api requests) backend folder , frontend Frontend folder and dashboard dashboard folder ), i need my dashboard to stay on local, and the frontend to be deployed, do i need the backend folder deployed with it ?
The answer is Yes. You have to deploy your backend in order to be accessible on the internet for your users when visiting the frontend app.
You can run your dashboard frontend locally if it doesn't have to be accessible on the internet, and you are or someone else is the only user that is going to use it.
However, don't forget to update your two frontend apps to use the production backend URL (something like https://some-domain-name.com) that you are going to deploy instead of the URL that you use during development (http://localhost:<PORT>).
I am very new to deploy Django and AWS. So now I would like to deploy my separate project (drf + react) to AWS.
So How can I deploy the separate project to AWS?
EC2 vs Elastic BeanStalk which one is better for that kind of environment?
I already search for one day but I found nothing useful information and found the similar thing but I don't understand like that=>
Deploying Separate React Frontend and Django DRF API
You asked a difficult question. I think I can make it bit easy for you.
First let's look at the differences in the options.
Serving the front end app
Option1: Django to serve react app
In this option, the Django app will serve your app in a route for e.g /app/. Basically the route /app will load react app's index.html. it's that simple.
In order for this to work, you need to build your react app using npm run build and copy the files to Django's static folder. good so far?
One of the benefits option 1 gives, option 2 doesn't is, you can use the same domain for backend and frontend for e.g www.example.com.
Option 2: deploy front end in S3
You still need to build the react app using npm run build, but you will not copy that to Django, in other words, you don't want to Django to serve your front end app, you want s3 to serve the static website. this method requires a separate subdomain or domain to host the react app.
Thats is the only difference between the options. Your frontend app will make api calls to the Django api, thats same for both options.My preferred option is option 2 to reduce complexity.
Deployment
I would pick elasticbeanstalk because it's easy to start with. You can do everything in the elasticbeanstalk console from load balancer to SSL, Healthcheck, Changing EC2 Keypair for EC2 Instance etc. Deployment is very easy. It supports multiple environments, You can use one AWS account for your test and production environments.
My project contains two apps. Backend – springboot and a frontend - React.
I am using the spring-boot app only as a rest API to fetch data from the database. The React app frontend will call the API. Up until now, we were using only one environment (Windows) so production build was one jar that actually contains both apps and a tomcat. That was quite simple so by adding a proxy in the package.json file to point to the backend and some maven(frontend-maven-plugin) plugin the building process is simple.
Now we need to change the system architecture so each app will be hosts on a different windows machine.
I was trying to use express to host the react app but I am struggling with the proxy setup for the backend (spring) app from the express server. All the tutorials that I found actually using the express server as the backend API but I need the express server only for hosting the production build.
Is there a good tutorial that shows how to set up this type of architecture in production env.
Thank you
I want set up a fullstack app with strapi and react. All tutorials i've seen say to deploy frontend on netlify and backend to something like heroku. Is there a posibility to deploy full app at one hosting?
I mean user entering website will get react app and backend will be running at onother port on the same hosing
You can host both the front end(react) and backend(strapi) on heroku.
they can be hosted as two different individual apps running on different dynos and they can even be hosted as a single app together.
see this answer:
How to deploy Strapi backend and ReactJS frontend to a single Heroku app
You definitely can deploy both on the same server, the question is whether you should do that.
What if your system has another client, like mobile app? Or what if you have more than one API server, and several databases (e.g. mongo and redis)? You don't want to put all of them on a single server, do you? By deploying them separately you can benefit from horizontal scaling, i.e. you upgrade your hosting plan on particular server whenever it needs more resources, without affecting another nodes. Divide and rule!
If you still want to deploy React and back-end on the same server, the better place for that would be something like DigitalOcean. On single droplet you can place as many servers as you want and configure them to launch on different ports.