1👍
The simplest way of going about this is to simply SCP
your build directory to your server. While this is better than FTP
, it is far from a good solution.
The ‘correct’ way of going about this would be to use something like Travis CI to automate the build process – something like when you push to the master
branch on your repository, you want Travis to automatically pull the changes to the server and build it. This is much better than manual deployment simply because you’re now relying on tools such as Git
for version history, and Travis
which lets you do an arbitrary number of things on each build. This could include linting, running the build against a test suite to make sure no bugs accidentally make it onto your server, and minifying assets.
There are several alternatives as well, such as BitBucket Pipelines and GitLab CI that might be more convenient for you depending on where your repository is hosted. You could also take a look at Jenkins.
1👍
You have some way to ‘build’ project like that.
First you never access and update the file with FTP. You have and use git/svn to have versionning of your project. You build and run test on every changes, and you push the result to the repository.
When the push is done, you will have some ‘hook’ that will be trigger (maybe travis or jenkins). With that, on another server you will run all tests inside the project in an environment which will be the same as the production server. If everything is good, you will deploy the full project on the production server.
To deploy it, the best way is to use your versionning command (git clone the first time, then git pull). If you do it this way, the website may be offline during few seconds. The good thing to do is to build the project inside another folder (or container), build it and then just change the internet redirection