While I spend most of my career on the Microsoft stack as a full-stack web developer - I have, on occasion, made my way into the *NIX side of things.. built out a FreeBSD web server here, played with Caldera Linux once over there, and am currently doing some web deployment using a Google cloud VM that is running Ubuntu...
TL,DR So, if I forked a repo onto my GitHub account- all for the purposes of then cloning it into my Ubuntu server where I'll then compile and run the web application..
What is the professionally expected location that I should put that 'cloned' source code? I googled around a bit to get a better grasp of what the various linux directories are for.. but.. I need a good SO answer... so... where would you put it?
/usr/src/MyGitRepos
..that sounded good to me.. but.. what would you do?
What is the professionally expected location
If as you say you're deploying an app that's compiled from source, then there's no such location. In a professional environment your sources don't go on the servers.
From most professional to "it works" solutions:
Build system packages outside of your production environment. That means you have a repository of both previously deployed versions and have a package manifest including both build and runtime dependencies. That means you can rebuild your app the same way every time. For installation, install the built package. (this applies to deb, rpm, etc.)
Build tarballs with binaries in a predictable environment (developer's box). That means you run (for example, if you're using autotools) ./configure --prefix=/opt/your_app && make install DESTDIR=/tmp/somedirectory
- now you can pack the /tmp/somedirectory/opt/your_app
contents, copy it to a server and unpack it to /opt/your_app
.
Clone it wherever (your home directory), then build, then install in the destination. Popular destinations are /opt/app_name
and /usr/local
.
The solution depends on how professional the deployment really is, how many servers you've got, have you got test/production environment, etc.
I wouldn't say there is a standard assumed place, especially if the server is specifically for this application. Putting a folder for it in the /home/user directory should be fine even, or organising it any way you see fit from that point:
/home/user/app-goes-here/app.js
Just keep it simple :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With