Merge commit '00c4484c7092181729f6f470805bc7d72e8ad17b'

This commit is contained in:
Bjørn Erik Pedersen
2022-11-17 16:16:19 +01:00
217 changed files with 2437 additions and 2821 deletions

View File

@@ -27,7 +27,7 @@ notesforauthors:
The spoiler is that you can deploy your entire website with a command that looks like the following:
```
```txt
hugo && rsync -avz --delete public/ www-data@ftp.topologix.fr:~/www/
```
@@ -45,13 +45,13 @@ sudo apt-get install openssh-client
Then generate your ssh key. First, create the `.ssh` directory in your home directory if it doesn't exist:
```
```txt
~$ cd && mkdir .ssh & cd .ssh
```
Next, execute this command to generate a new keypair called `rsa_id`:
```
```txt
~/.ssh/$ ssh-keygen -t rsa -q -C "For SSH" -f rsa_id
```
@@ -59,7 +59,7 @@ You'll be prompted for a passphrase, which is an extra layer of protection. Ente
To make logging in easier, add a definition for your web host to the file `~/.ssh/config` with the following command, replacing `HOST` with the IP address or hostname of your web host, and `USER` with the username you use to log in to your web host when transferring files:
```
```txt
~/.ssh/$ cat >> config <<EOF
Host HOST
Hostname HOST
@@ -71,13 +71,13 @@ EOF
Then copy your ssh public key to the remote server with the `ssh-copy-id` command:
```
```txt
~/.ssh/$ ssh-copy-id -i rsa_id.pub USER@HOST.com
```
Now you can easily connect to the remote server:
```
```txt
~$ ssh user@host
Enter passphrase for key '/home/mylogin/.ssh/rsa_id':
```
@@ -88,40 +88,40 @@ Now that you can log in with your SSH key, let's create a script to automate dep
Create a new script called `deploy` the root of your Hugo tree:
```
```txt
~/websites/topologix.fr$ editor deploy
```
Add the following content. Replace the `USER`, `HOST`, and `DIR` values with your own values:
```
```bash
#!/bin/sh
USER=my-user
HOST=my-server.com
DIR=my/directory/to/topologix.fr/ # the directory where your web site files should go
hugo && rsync -avz --delete public/ ${USER}@${HOST}:~/${DIR}
hugo && rsync -avz --delete public/ ${USER}@${HOST}:~/${DIR} # this will delete everything on the server that's not in the local public folder
exit 0
```
Note that `DIR` is the relative path from the remote user's home. If you have to specify a full path (for instance `/var/www/mysite/`) you must change `~/${DIR}` to `${DIR}` inside the command line. For most cases you should not have to.
Note that `DIR` is the relative path from the remote user's home. If you have to specify a full path (for instance `/var/www/mysite/`) you must change `~/${DIR}` to `${DIR}` inside the command-line. For most cases you should not have to.
Save and close, and make the `deploy` file executable:
```
```txt
~/websites/topologix.fr$ chmod +x deploy
```
Now you only have to enter the following command to deploy and update your website:
```
```txt
~/websites/topologix.fr$ ./deploy
```
Your site builds and deploys:
```
```txt
Started building sites ...
Built site for language en:
0 draft content