{"id":131,"date":"2015-01-26T11:30:53","date_gmt":"2015-01-26T11:30:53","guid":{"rendered":"http:\/\/kopijunkie.net\/blog\/?p=131"},"modified":"2015-01-28T22:46:25","modified_gmt":"2015-01-28T22:46:25","slug":"using-rsync-to-deploy-to-hostgator","status":"publish","type":"post","link":"https:\/\/kopijunkie.net\/blog\/2015\/01\/26\/using-rsync-to-deploy-to-hostgator\/","title":{"rendered":"Using rsync to deploy to HostGator"},"content":{"rendered":"<p>Deploying my generated site to my HostGator shared server now is just a matter of using <code>rsync<\/code> in Terminal to sync my local repository&#8217;s <code>dist<\/code> directory contents to the remote server&#8217;s <code>public_html<\/code> directory. Something like this:<\/p>\n<blockquote><p><code><br \/>\nrsync -avz --progress --partial -e 'ssh -p 2222' ~\/path\/to\/dist username@domain.name:\/path\/to\/public_html\/<br \/>\n<\/code><\/p><\/blockquote>\n<p>Here&#8217;s an <a href=\"http:\/\/explainshell.com\/explain?cmd=rsync+-avz+--progress+--partial+-e\" title=\"explainshell.com - rsync -avz --progress --partial -e\">explanation<\/a> of the <code>rsync<\/code> command.<\/p>\n<p>For quite a while, my personal site deployment process was still old school file transfers over FTP despite using continuous integration tools like Hudson and Jenkins at work. I eventually got around to setting up a PHP web hook when the site&#8217;s code base was kept on BitBucket. This was great when my entire repository basically was all the HTML, CSS, JavaScript files needed for the site.  <\/p>\n<p>With my site morphing from a dynamic site with very static content to a pretty much static site with some PHP, setting up PHP web hooks on the Github repo wasn&#8217;t quite suitable for me this time. I only need the generated files that my Gruntfile&#8217;s <code>assemble<\/code> task puts in the <code>dist<\/code> directory every time Grunt runs. <\/p>\n<p>With <code>rsync<\/code>, since I can change what goes where on the fly whenever I need to do a deploy, I could have a subdomain called <code>test.kopijunkie.net<\/code> that points to a <code>test<\/code> subdirectory which has a version of my site with new features from another branch of my site&#8217;s Github repository. Handy for testing things out stuff in the production environment before being deploying to the actual site.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Deploying my generated site to my HostGator shared server now is just a matter of using rsync in Terminal to sync my local repository&#8217;s dist directory contents to the remote server&#8217;s public_html directory. Something like this: rsync -avz &#8211;progress &#8211;partial -e &#8216;ssh -p 2222&#8242; ~\/path\/to\/dist username@domain.name:\/path\/to\/public_html\/ Here&#8217;s an explanation of the rsync command. For quite [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44,19],"tags":[45,22],"class_list":["post-131","post","type-post","status-publish","format-standard","hentry","category-deployment","category-workflow","tag-deployment","tag-development"],"_links":{"self":[{"href":"https:\/\/kopijunkie.net\/blog\/wp-json\/wp\/v2\/posts\/131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kopijunkie.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kopijunkie.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kopijunkie.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kopijunkie.net\/blog\/wp-json\/wp\/v2\/comments?post=131"}],"version-history":[{"count":5,"href":"https:\/\/kopijunkie.net\/blog\/wp-json\/wp\/v2\/posts\/131\/revisions"}],"predecessor-version":[{"id":136,"href":"https:\/\/kopijunkie.net\/blog\/wp-json\/wp\/v2\/posts\/131\/revisions\/136"}],"wp:attachment":[{"href":"https:\/\/kopijunkie.net\/blog\/wp-json\/wp\/v2\/media?parent=131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kopijunkie.net\/blog\/wp-json\/wp\/v2\/categories?post=131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kopijunkie.net\/blog\/wp-json\/wp\/v2\/tags?post=131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}