Compare commits

..

4 commits

Author SHA1 Message Date
sakrecoer
b74ca38c26 add the example scripts 2026-07-31 11:40:36 +02:00
sakrecoer
05016b454c kill the customized fetch script 2026-07-31 11:40:10 +02:00
sakrecoer
390b7e5c70 we don't track the file that is customized 2026-07-31 11:38:50 +02:00
sakrecoer
5326740484 formatting madness 2026-07-31 11:38:11 +02:00
4 changed files with 29 additions and 3 deletions

2
.gitignore vendored
View file

@ -2,3 +2,5 @@ public
resources resources
.hugo_build.lock .hugo_build.lock
data data
fetch-and-convert.sh
deploy.sh

View file

@ -20,7 +20,7 @@ Hugo is Static Site Generator. It should be available in your packet manager.
Download nak binary from https://github.com/fiatjaf/nak/releases/latest and put it in your path (the dirty way). Note that the example bellow downloads a version that migh be outdated at the time you are reading this. Download nak binary from https://github.com/fiatjaf/nak/releases/latest and put it in your path (the dirty way). Note that the example bellow downloads a version that migh be outdated at the time you are reading this.
#### Example for Linux AMD64 #### Example for Linux AMD64
``` ```bash
wget https://github.com/fiatjaf/nak/releases/download/v0.20.2/nak-v0.20.2-linux-amd64 wget https://github.com/fiatjaf/nak/releases/download/v0.20.2/nak-v0.20.2-linux-amd64
chmod +x nak-linux-amd64 chmod +x nak-linux-amd64
sudo mv nak-linux-amd64 /usr/local/bin/nak sudo mv nak-linux-amd64 /usr/local/bin/nak
@ -142,10 +142,14 @@ chmod +x deploy.sh
Add to crontab (runs every 30 minutes) Add to crontab (runs every 30 minutes)
# Edit crontab # Edit crontab
```bash
crontab -e crontab -e
```
# Add this line: # Add this line:
```bash
*/30 * * * * /path/to/your-cloned-git/deploy.sh */30 * * * * /path/to/your-cloned-git/deploy.sh
```
Alternative: Different intervals Alternative: Different intervals

20
exemple.deploy.sh Normal file
View file

@ -0,0 +1,20 @@
#!/bin/sh
# Configuration
SITE_DIR="/path/to/your-cloned-git"
WEBROOT="/probably/var/www/html"
LOG_FILE="$HOME/nostr-site-deploy.log"
date '+%Y-%m-%d %H:%M:%S' > $LOG_FILE # we wipe the log file from rpevious entries, because no history here is super important
cd $SITE_DIR
/usr/bin/git pull >> $LOG_FILE
/usr/bin/bash fetch-and-convert.sh >> $LOG_FILE
/snap/bin/hugo --cleanDestinationDir --minify >> $LOG_FILE
# Optional and potentially dangerous: the generator will creates a random file name (fingerprint) for css and js to be picked up when you do changes to it. If you don't remove them, over time your directory will bloat. A new file is only created if there are changes.
# This can be dangerous because if you set the webroot wrong, you're going to nuke stuff you wasn't supposed to.
#/usr/bin/rm $WEBROOT/css/*
#/usr/bin/rm $WEBROOT/js/*
/usr/bin/rsync -av $SITE_DIR $WEBROOT/ >> $LOG_FILE

View file

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
# Configuration # Configuration
PUBKEY="setto@basspistol.org" PUBKEY="YOUR_PUBKEY"
RELAY="wss://basspistol.org" RELAY="wss://mega.supercool.relay"
DATA_DIR="data" DATA_DIR="data"
# Clean up old JSON files (optional) # Clean up old JSON files (optional)