How do I actually deploy my MERN app to my Linode after the Linode is created?
Hello,
I have a MERN website that works perfectly on Heroku and locally, and I want to deploy our website to Linode.
I created my Linode following this guide (with Debian 11):
https://www.linode.com/docs/guides/deploy-mern-with-marketplace-apps/
It then suggests this guide for deploying my React App:
https://www.linode.com/docs/guides/how-to-deploy-a-react-app-on-debian-10/
But I think the guide assumes my terminal is already configured with Linode (similar how I can simply push to Git Hub and Heroku), but I don't know how to do set my terminal up with Linode.
Also, these instructs all say to use "sudo" commands, but my MERN setup uses "npm" throughout the scripts, and I've read that you shouldn't combine the two. Would it be possible to replace any "sudo" references with the "npm" versions of each command? Or do I have to switch everything to "sudo" to use Linode?
6 Replies
You write:
Also, these instructs [sic] all say to use "sudo" commands, but my MERN setup uses "npm" throughout the scripts, and I've read that you shouldn't combine the two. Would it be possible to replace any "sudo" references with the "npm" versions of each command? Or do I have to switch everything to "sudo" to use Linode?
npm is the Node[.js] package manager. You use sudo(1) to temporarily elevate your privileges to those of the super-user. You use npm to install Node[.js] packages. Those two functions are in no way related to each other…and they most certainly not equivalents (you can't substitute one for the other as your OP suggests).
However, installing Node[.js] may require super-user privileges depending on what it is you want to install and where…so
sudo /path/to/npm ...
may be appropriate (again, depending on what you're installing and where).
-- sw
P.S. You install npm on Debian 11 like this:
sudo apt install npm
npm has a boatload of dependencies so don't be surprised if 9 or 10 other packages get installed as well. Here sudo(1) is required because apt(1) writes to areas of the filesystem that require super-user privileges/permissions to do so.
Thank you!
I am using this tutorial:
https://www.youtube.com/watch?v=FTyby51m0hQ&t=165s
I am stuck 6:20 (moving the react app into /var/www/) because of the difference between how we created our apps. It looks like he created his app directly on the server using npx create-reate-app.
However, mine was completed locally and so the mv command won't work until it's on the server.
QUESTION:
1) Should I just manually drag and drop my MERN app to the server through FileZilla, and then run these commands through Putty to activate it?
2) If not, how do I connect my app with the server so that I can run these commands in this video?
I am much better at coding than I am deploying (this is my first website deployment), so this is all very new to me.
If this is as simple as moving my files to the server through FileZilla and then activating build commands through Putty, that would make so much sense and I would feel so confident in all of this. If not, I'm back flailing aimlessly in the dark looking for light switches.
1) Should I just manually drag and drop my MERN app to the server through FileZilla, and then run these commands through Putty to activate it?
That's what I would do. Although, not being a pee-cee user, my workflow would be different (ssh/scp).
-- sw
Thank you good sir!
This is extremely helpful in at least putting it into perspective as before I was following instructions word-for-word without understanding the bigger picture of what's happening.
It's been about an hour and it's still uploading, so I've also been researching how I might be able to simply push the website to Linode from GitHub.
I'll post a separate question for this.
It's been about an hour and it's still uploading, so I've also been researching how I might be able to simply push the website to Linode from GitHub.
Install git(1). For Debian/Ubuntu, you do that with
apt install git
This will install all of git(1)s dependencies too so don't be alarmed if there's a whole bunch of stuff that gets installed.
On GitHub, above your the list of files, is a green dropdown labeled "Code v". Select the button. It will give you a url that you can use to clone the repository:
git clone https://github.com/.../yourproject.git /the/local/path/to/yourproject
That's all there is…
-- sw