Automatic Deployments On Shared Hosting

In this episode I'm going to show you how to setup automatic deployments on your shared hosting with #cPanel and #Git.
We are going to setup our process so that we have two sites, one is going to be used for production and another for staging. And then using Git we are going to configure post receive hook for our repository so that when master branch is pushed our files end up on Production site, and when the staging branch is pushed the files are going to end up on Staging site. As you will see this is a nice way to setup automatic deployments if you only have access to a shared hosting.
Code used in this video
bit.ly/2MfM17Y
You can support my work on Patreon
/ watchlearn
Follow me on Social Media
Github: github.com/ivandoric
Twitter: / ivan_doric
Instagram: / watchlearntuts
Facebook: / watchlearntutorials

Пікірлер: 66

  • @Montes11985
    @Montes119852 жыл бұрын

    AWESOME ! thank you Master, im new ussing git, and this aplication with yout tutorial its such usefull! hugs from Perú

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    2 жыл бұрын

    Glad I could help 😀

  • @ivanpichkar8192
    @ivanpichkar81924 жыл бұрын

    A few days ago, the first time in my life, I have rent space on this shared hosting provider. I was puzzled because I knew about the deployment process only in theory. But you saved my day. Thank you a lot. You have a new subscriber :)

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    4 жыл бұрын

    Glad I could help ;)

  • @_romeopeter
    @_romeopeter3 жыл бұрын

    Thank you for creating this video. Never thought of this at all. Although I can't implement it on a react or node app, I appreciate knowing that something like this can be done.

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    3 жыл бұрын

    You actually have an example for deploying Node or React apps. github.com/marketplace/actions/ftp-deploy

  • @matthewsmith9272
    @matthewsmith92724 жыл бұрын

    This is a very long overdue video. Great work!

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    4 жыл бұрын

    Thanks :D

  • @sai_charan
    @sai_charan3 жыл бұрын

    Thank you, Ivan!

  • @Cwiet
    @Cwiet3 жыл бұрын

    Thanks for the video! It did help me a lot.

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    3 жыл бұрын

    I'm glad the video helped you. Thanks for watching 😃

  • @janmichaelbesinga3867
    @janmichaelbesinga38673 жыл бұрын

    So accurate. Just exactly what i need. Thank you!

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    3 жыл бұрын

    Glad I could help :)

  • @sagardolui2998
    @sagardolui29983 жыл бұрын

    Great video. Thank you.

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    3 жыл бұрын

    No problem, however better check this video out, it's much better workflow than what is presented in this video. kzread.info/dash/bejne/h4KLq7qSg73Mirw.html

  • @chanmyaemaung
    @chanmyaemaung4 жыл бұрын

    Thanks brother. I've never used it before like that.

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    4 жыл бұрын

    It's much better then deploying your changes via FTP.

  • @sukhpal3y
    @sukhpal3y3 жыл бұрын

    nicely explained video. achieved my task. thank you very much

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    3 жыл бұрын

    I'm glad this video helped you. 😃

  • @rapsontembo9391
    @rapsontembo9391 Жыл бұрын

    great video indeed

  • @rajshrishrimal2653
    @rajshrishrimal26534 жыл бұрын

    Superb video 💥🎉🎆

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    4 жыл бұрын

    Thanks ;)

  • @cvallejoec
    @cvallejoec4 жыл бұрын

    This video is Gold! Thank you a lot. Please can you make a video uploading a React project to Shared Hosting with this Git workflow?

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    4 жыл бұрын

    I did this video: kzread.info/dash/bejne/l5aLrMSbhbeahKQ.html , you can do the same thing for Next.js apps or React apps, however, as you will see in this video this approach is far from ideal. It may work better for you, if you have a better hosting, but I would not host node apps on shared hosting just yet.

  • @SuvroImran
    @SuvroImran3 жыл бұрын

    Thank you so much

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    3 жыл бұрын

    No problem, glad I could help 😀

  • @zoltanrakottyai
    @zoltanrakottyai2 жыл бұрын

    Thanks for sharing this! This was a huge "missing piece of the puzzle" how to deploy to shared hosting.

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    2 жыл бұрын

    Yeah, but I made a better video about the same thing, so I recommend following that: kzread.info/dash/bejne/h4KLq7qSg73Mirw.html

  • @zakharg
    @zakharg4 жыл бұрын

    👍👍👍

  • @christianherrero3778
    @christianherrero37783 жыл бұрын

    Awesome

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    3 жыл бұрын

    Thanks, however check this episode out, it's even more awesome 😀 and it works better: kzread.info/dash/bejne/h4KLq7qSg73Mirw.html

  • @christianherrero3778

    @christianherrero3778

    3 жыл бұрын

    @@WatchandLearnTutorials Ohh thanks!!

  • @manassehbundi3062
    @manassehbundi30623 жыл бұрын

    hey How would you do for a python app/django app? Whenever i change a branch both staging and master subdomain reflect the same thing.

  • @jorgenash3452
    @jorgenash34523 жыл бұрын

    This approach is adviced for medium/big project? thankz

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    3 жыл бұрын

    I would use it on any size project, using FTP do deploy your site is outdated and also not exactly secure. I think this is much better, if your hosting supports it of course.

  • @MegaOnerb
    @MegaOnerb3 жыл бұрын

    Amazing tutorial as always, let me ask can I use this to deploy wordpress sites? And do you know something about wordpress migration database like laravel?

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    3 жыл бұрын

    You can of course. However, the database is always going to be a pain point with WP unfortunately. Git is just for files, and you will have to deploy your DB by hand. WP doesn't have migrations. And even if it did, it wouldn't help, because most of the options and configurations are written in database.

  • @khnaz35
    @khnaz359 ай бұрын

    I was closely following this tutorial and noticed that when setting up the Git Version Control repository, you chose to create it directly using cPanel's management tools, as opposed to cloning it from an externally hosted Git repository. What if I want to integrate with my private Git repository? What would be the method in that scenario?

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    7 ай бұрын

    You can take a look at this video: kzread.info/dash/bejne/h4KLq7qSg73Mirw.html maybe that could help.

  • @kamalsharma2839
    @kamalsharma2839 Жыл бұрын

    Can we do this on hostinger hpanel and with React/nextJS with Sanity projects?

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    Жыл бұрын

    Maybe if you are building completely static site, otherwise you would need some kind of build step, which this action does not cover.

  • @peterle90789
    @peterle90789Ай бұрын

    My branch is "production" on git repo, the branch on cpanel is master. It is not sync

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    Ай бұрын

    Better check out this video: kzread.info/dash/bejne/h4KLq7qSg73Mirw.html

  • @designninjaacademy
    @designninjaacademy2 жыл бұрын

    Can this also work with private repo ?

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    2 жыл бұрын

    Of course 😀

  • @TheReisners
    @TheReisners3 жыл бұрын

    HELP!? thanks for your great tutorial. I am running into a problem. i have two branches... master/dev. dev controls dev.mysite.com and master controls prod.mysite.com. my branches are clean and committed before i perform any checkouts.... yet when i push a committed change on the DEV i often get "failed to push some refs"... "working directory has unstaged changes"... yet it GIT STATUS says my working tree is clean... do you have any idea or tips (or a video) on how to work clean between both branches on the same git repo? its great to be able to have different files controlled in the same repo. I'm fairly new to git... thank you so much

  • @TheReisners

    @TheReisners

    3 жыл бұрын

    one more note if it helps... i find when i pull after switching branches (even if they are clean and no changes) helps prevent this type of error...

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    3 жыл бұрын

    @@TheReisners I don't know, sorry. This video is just to show that something like this can be done, but I found out that Git on shared hosting, and running node.js apps on shared hosting have problems. So I would advise to use something like Github and Github actions for this. I will try to make a video about it.

  • @saketshukla4856
    @saketshukla48563 жыл бұрын

    i am not getting post-receive inside hooks. i am getting all this --applypatch-msg.sample fsmonitor-watchman.sample pre-applypatch.sample pre-merge-commit.sample pre-push.sample pre-receive.sample commit-msg.sample post-update.sample pre-commit.sample prepare-commit-msg.sample pre-rebase.sample update.sample--- please help anyone

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    3 жыл бұрын

    You can just create that file yourself.

  • @Abhisheka9292
    @Abhisheka9292 Жыл бұрын

    you don't have showed ssh connection to local

  • @gt-tech
    @gt-tech2 жыл бұрын

    First of all nice tutorial..nice work! I am curious if its possible when to upload on github automatic push and on server..with that example that made i need to add a remote repository of github and push the code..and after another remote repo with ssh for server. so i need to push second time to server.. can i make one push to github and github push automatic to ssh repo server?? thanks, happy coding!

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    2 жыл бұрын

    Not sure if it's exactly what you need, but take a look at this episode: kzread.info/dash/bejne/h4KLq7qSg73Mirw.html here I'm using github actions to deploy to shared hosting, it's a better way then what I did in this video. So maybe you can use that to acomplish what you need.

  • @gt-tech

    @gt-tech

    2 жыл бұрын

    @@WatchandLearnTutorials i check your video..thats better solution for me! but you sync file with ftp and package SamKirkland / FTP-Deploy-Action. it is posible to sync with something else? like ssh?

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    2 жыл бұрын

    @@gt-tech For my site I used this guide: itnext.io/deploy-next-js-apps-using-github-actions-6322261757bc but I'm deploying it to Digital Ocean so I can install whatever I need, which may not be the case for shared hosting. And this is going through ssh and git. So essentially whenever I publish something to master, the server does git pull of the new version. So there is no need for FTP.

  • @gt-tech

    @gt-tech

    2 жыл бұрын

    @@WatchandLearnTutorials thats better but its only for frontend frameworks javascript? or its possible to use for backend php frameworks? nothing change digital ocean or other provider! all its VMs so its the same! what OS do you have at yor vm and use that guide? Thank for help!

  • @kv_clips
    @kv_clips3 жыл бұрын

    git push is not happening

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    3 жыл бұрын

    If you want help with something please include more information. "git push is not happening" means nothing to me.

  • @kv_clips

    @kv_clips

    3 жыл бұрын

    @@WatchandLearnTutorials Buddy, first of all, when I create git repo in GIT Version Control in cpanel , my git repo shows an error "System could not found any branch in your repository". 2nd issue is , I can clone remote repo but whenever I try to push to remote server nothing happen. By Nothing, I mean no prompt for username and password appear. Solve my issues please???

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    3 жыл бұрын

    @@kv_clips I would suggest that you ignore this video and try to make a setup like in this video: kzread.info/dash/bejne/h4KLq7qSg73Mirw.html it solves the same problem, but in much nicer and more elegant way. Also, here you should not have any trouble with git, because your repo will be hosted on GitHub. Git on shared hosting can be pain in the a** as you can see for yourself, somewhere it works, somewhere it doesn't it all depends on the hosting.

  • @tiffany-user
    @tiffany-user2 жыл бұрын

    Эх, были бы субтитры на русском)

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    2 жыл бұрын

    I don't know Russian so probably not. 😀

  • @sahilxd440

    @sahilxd440

    2 жыл бұрын

    @@WatchandLearnTutorials u tallk like russian where u originated frm?

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    2 жыл бұрын

    @@sahilxd440 I'm from Croatia.

  • @maccosolutions
    @maccosolutions3 жыл бұрын

    Great tutorial! You showed how to do this if you have a simple website hosted on the main domain (on a VPS). But how you suggest dealing with a website that already has multiple subdomains? I have 8 subdomains (for different aspects of the business) and each one requires a staging and dev environment, but I don't want to do crm.staging.domain(dot)com for each subdomain. Each subdomain also requires direct access to the server's SQL database, so the staging sites can't(?) be on a separate server/domain (Correct me if I am wrong). What are your thoughts (or anyones' thoughts) on how you would get around this?

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    3 жыл бұрын

    Well first of all if your staging and other sites are on subdomains, they can also be on the same server, so that means that they would be able to access the DB without a problem. Even if they are on separate server, you can still access the DB, you just have to allow access to the port of the DB. Usually that is 3306 I think, or something like that. Also you need to have multiple subdomains for staging servers, I don't know how you would get around that. Now since you are dealing with a lot of sites and subdomains, you would really need a dev ops guy or girl to setup everything right. This is not a trivial functionality that you are looking for. And also I don't think this should be done on a shared hosting, using some VPS platform or something like AWS or Digital Ocean would be much better for that. Also you can take a look at this video kzread.info/dash/bejne/h4KLq7qSg73Mirw.html , it's an updated version of this one, so that may also give you some ideas on how to handle this.

Келесі