# What's the best deployment routine?

**URL:** <https://discourse.gohugo.io/t/whats-the-best-deployment-routine/31193>\
**Category:** Uncategorized\
**Created:** [February 12, 2021, 4:38pm UTC](https://discourse.gohugo.io/t/whats-the-best-deployment-routine/31193 "2021-02-12T16:38:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![vistad](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/vistad/32/20509_2.png) [@vistad](https://discourse.gohugo.io/u/vistad)\
**Post date:** [February 12, 2021, 4:38pm UTC](https://discourse.gohugo.io/t/whats-the-best-deployment-routine/31193/1 "2021-02-12T16:38:54Z")

</div>

I so far didn’t master the “hugo deploy” - and used to tar.gz the public dir and scp it to my Apache VPS.  
But my tar is 77Mb, where pictures are 75Mb and the rest is 2Mb.  
So I attempted to leave the old pictures (they stay the same) and upload only the rest of the files throught the same procedure - tar, scp, untar.  
I did, but the website did not start. I wonder what was the reason?  
Maybe Hugo creates a sort of check and didn’t connect the pictures directory that was already there?

Is it possible to upload only certain files - or one should upload the whole website every time?

How hugo deploy works? Does it upload files one by one? I’m afraid it should take one hour compared to uploading a tar.gz file.

---

<div class="post-metadata">

**Author:** ![Troy](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@Troy](https://discourse.gohugo.io/u/Troy)\
**Post date:** [February 12, 2021, 5:23pm UTC](https://discourse.gohugo.io/t/whats-the-best-deployment-routine/31193/2 "2021-02-12T17:23:36Z")

</div>

Have you tried using [rsync](https://gohugo.io/hosting-and-deployment/deployment-with-rsync/)?

I think there is no “best deployment routine”. It all depends on your project (Do you host your project on GitHub? What kind of server do you have?).

In my case I deploy locally and upload via rsync. It works fast and without problem. The problem with your routine is that you always have to upload the whole project whereas rsync automatically uploads only the changes. Let’s say you change one picture than rsync only changes one picture on your server.

---

<div class="post-metadata">

**Author:** ![vistad](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/vistad/32/20509_2.png) [@vistad](https://discourse.gohugo.io/u/vistad)\
**Post date:** [February 12, 2021, 6:56pm UTC](https://discourse.gohugo.io/t/whats-the-best-deployment-routine/31193/3 "2021-02-12T18:56:57Z")

</div>

Wow, thank you @Troy, that’s a good idea! I will try it - that’s exactly what I want!  
rsync works like a charm!

---

<div class="post-metadata">

**Author:** ![frjo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/frjo/32/18626_2.png) [@frjo](https://discourse.gohugo.io/u/frjo)\
**Post date:** [February 12, 2021, 9:02pm UTC](https://discourse.gohugo.io/t/whats-the-best-deployment-routine/31193/4 "2021-02-12T21:02:33Z")

</div>

Here is my deploy script with rsync over ssh.

```auto
#!/usr/bin/env sh

hugo --cleanDestinationDir && rsync -e 'ssh -ax' --archive --delete --verbose --compress --human-readable --exclude '.DS_Store'

```

---

<div class="post-metadata">

**Author:** ![vistad](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/vistad/32/20509_2.png) [@vistad](https://discourse.gohugo.io/u/vistad)\
**Post date:** [February 12, 2021, 9:21pm UTC](https://discourse.gohugo.io/t/whats-the-best-deployment-routine/31193/5 "2021-02-12T21:21:53Z")

</div>

Thank you @frjo!

---

<div class="post-metadata">

**Author:** ![dnorman](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/dnorman/32/20571_2.png) [@dnorman](https://discourse.gohugo.io/u/dnorman)\
**Post date:** [February 12, 2021, 10:11pm UTC](https://discourse.gohugo.io/t/whats-the-best-deployment-routine/31193/6 "2021-02-12T22:11:25Z")

</div>

just be careful with --delete if you have any other files in the web directory. my site has stuff going back for 20 years, and I just rsync without --delete so none of the non-Hugo stuff gets nuked on publish. (my web directory is huge-ish so I don’t want to keep the whole thing locally on my laptop to rsync up)

---

<div class="post-metadata">

**Author:** ![frjo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/frjo/32/18626_2.png) [@frjo](https://discourse.gohugo.io/u/frjo)\
**Post date:** [February 12, 2021, 11:00pm UTC](https://discourse.gohugo.io/t/whats-the-best-deployment-routine/31193/7 "2021-02-12T23:00:50Z")

</div>

Good point about “–delete”!

---

<div class="post-metadata">

**Author:** ![Grob](https://avatars.discourse-cdn.com/v4/letter/g/f14d63/32.png) [@Grob](https://discourse.gohugo.io/u/Grob)\
**Post date:** [February 16, 2021, 10:16am UTC](https://discourse.gohugo.io/t/whats-the-best-deployment-routine/31193/8 "2021-02-16T10:16:04Z")

</div>

Just a tiny addition:

`rsync` provides some practical short flags, see `man rsync`.

This is what I use:

```auto
rsync -aP source destination

```

`-a` stands for “archive”, `-P` comes in handy when you transfer some large files.

---

<div class="post-metadata">

**Author:** ![vistad](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/vistad/32/20509_2.png) [@vistad](https://discourse.gohugo.io/u/vistad)\
**Post date:** [February 16, 2021, 11:30am UTC](https://discourse.gohugo.io/t/whats-the-best-deployment-routine/31193/9 "2021-02-16T11:30:25Z")

</div>

Thank you! 👍
