Prepare for note deployment.

This commit is contained in:
Sergio Martínez Portela 2022-10-18 01:16:14 +02:00
parent 7ddf926fa7
commit b214a8148a
4 changed files with 33 additions and 11 deletions

View File

@ -24,6 +24,10 @@ EXTENSIONS = [
".org.txt",
]
WATCH = True
if os.getenv('WATCH_AND_REBUILD', '1') == '0':
WATCH = False
MIN_HIDDEN_HEADLINE_LEVEL = 2
INDEX_ID = "ea48ec1d-f9d4-4fb7-b39a-faa7b6e2ba95"
SITE_NAME = "Código para llevar"
@ -237,8 +241,12 @@ def main(src_top, dest_top):
db = create_db(os.path.join(dest_top, 'db.sqlite3'))
docs = regen_all(src_top, dest_top, db=db)
logging.info("Initial load completed in {:.2f}s".format(time.time() - t0))
if not WATCH:
logging.info("Build completed in {:.2f}s".format(time.time() - t0))
return 0
logging.info("Initial load completed in {:.2f}s".format(time.time() - t0))
## Updating
for event in notifier.event_gen(yield_nones=False):
(ev, types, directory, file) = event
@ -506,4 +514,4 @@ if __name__ == "__main__":
exit(0)
logging.basicConfig(level=logging.INFO, format="%(levelname)-8s %(message)s")
main(sys.argv[1], sys.argv[2])
exit(main(sys.argv[1], sys.argv[2]))

View File

@ -1,8 +0,0 @@
#!/usr/bin/env bash
set -eu
cd "$(dirname "$0")/.."
cd static
scp homepage.html root@codigoparallevar.com:/mnt/vols/misc/codigoparallevar/index.html

22
scripts/upload.sh Normal file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -eu
cd "$(dirname "$0")/.."
# Upload homepage
cd static
scp homepage.html root@codigoparallevar.com:/mnt/vols/misc/codigoparallevar/index.html
# Build notes
cd ../scripts
WATCH_AND_REBUILD=0 python3 generate.py ~/.logs/brain ../_gen/notes
# Upload notes
cd ../_gen
rsync -HPaz static/ --delete-after --exclude='*.html' root@codigoparallevar.com:/mnt/vols/misc/codigoparallevar/static/
rsync -HPaz notes/ --delete-after --exclude='xapian' --exclude='*.sqlite3' root@codigoparallevar.com:/mnt/vols/misc/codigoparallevar/notes/
rsync -HPaz notes/db.sqlite3 root@codigoparallevar.com:/mnt/vols/misc/codigoparallevar-api/
# Restart API server
ssh root@codigoparallevar.com docker restart notes-api-server

View File

@ -47,7 +47,7 @@ function _codigoparallevar_enable_search_box(selector, options) {
const DEBOUNCE_TIME = 500; // Milliseconds
const MIN_LENGTH = 3;
const SEARCH_ENDPOINT = 'http://localhost:3001/api/search';
const SEARCH_ENDPOINT = 'https://api.codigoparallevar.com/api/search';
let debounceWaiter = null;
let currentQuery = null;