diff options
author | Dante Catalfamo | 2020-06-18 01:05:45 -0400 |
---|---|---|
committer | Dante Catalfamo | 2020-06-18 01:05:45 -0400 |
commit | 6fef9a0e26098f83fae5f4d7c1d2caeb2a953d3d (patch) | |
tree | c70920d7681bdc72c4cee0c3e199f2d0e785b282 /content | |
parent | 78666e520d3e15d85b18a3467f870af120d5b9ff (diff) | |
download | blog-6fef9a0e26098f83fae5f4d7c1d2caeb2a953d3d.tar.gz blog-6fef9a0e26098f83fae5f4d7c1d2caeb2a953d3d.tar.bz2 blog-6fef9a0e26098f83fae5f4d7c1d2caeb2a953d3d.zip |
Work on blog setup post more
Diffstat (limited to 'content')
-rw-r--r-- | content/posts/how-this-blog-works/index.org | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/content/posts/how-this-blog-works/index.org b/content/posts/how-this-blog-works/index.org index fa1acb2..aa1f329 100644 --- a/content/posts/how-this-blog-works/index.org +++ b/content/posts/how-this-blog-works/index.org @@ -176,3 +176,45 @@ through how I run by blog. #+END_SRC ** Local machine + + This is the script used to deploy the website. It's placed in the + root of the hugo git repository. + + #+BEGIN_SRC shell + #!/bin/sh + + cd '$(dirname "$0")' + hugo + rsync -va --progress --rsync-path="/usr/bin/openrsync" public/ blog@lambda.cx:/var/www/htdocs/lambda.cx/blog + #+END_SRC + + Going through it line by line: + + - ~cd '$(dirname "$0")'~ Changes to the script's directory. This is + used in case you're running it from somewhere else. + - ~hugo~ Compile the website into static files located in the + =public= directory. + - ~rsync -va --progress --rsync-path="/usr/bin/openrsync" public/ + blog@lambda.cx:/var/www/htdocs/lambda.cx/blog~ This one is bigger + so I'll break it down. + - =rsync= A command that synchronizes files between two directories + - =-v= Be verbose, this is optional but I like it + - =-a= Stands for "archive": copy recursively, keep + permissions, etc. See the =rsync= man page if you're curious. + - =--progress= Show progress, also optional + - ~--rsync-path="/usr/bin/openrsync"~ This line is very important + for OpenBSD servers. OpenBSD has its own =rsync= implementation + called =openrsync=. Without this argument, =rsync= will connect + to the server, see that the =rsync= command doesn't exist, and + fail. + - =public/= Specify which folder we want to sync. The trailing + =/= is important. Without it =rsync= will copy the folder + instead of the folder's contents, which is what we want. + - =blog@lambda.cx:/var/www/htdocs/lambda.cx/blog= Login to user + =blog= on server =lambda.cx=, syncing files with the + =/var/www/htdocs/lambda.cx/blog= directory. + + The reason to use =rsync= here instead of something like =scp= is + that =rsync= won't copy files it doesn't need to, so if 3/4 of + the files didn't change when you updated the blog, it won't waste + time re-uploading them. |