Open jnm opened 5 years ago
Here's what I've been doing:
kpi$ cat static_shock.sh
rm -fr staticfiles
npm run copy-fonts &&
npm run build &&
./manage.py collectstatic --noinput &&
rsync -aq --delete --chown=www-data "${KPI_SRC_DIR}/staticfiles/" "${NGINX_STATIC_DIR}/"
I run that script inside the kpi
container and regenerates the static files.
update: make sure you restart uWSGI after this (or just restart the whole kpi container). also, purge jsapp/compiled
before rebuilding as stale app-*.js
bundles can hide out there as well.
rm -fr staticfiles
rm -fr jsapp/compiled
npm run copy-fonts &&
npm run build &&
./manage.py collectstatic --noinput &&
rsync -aq --delete --chown=www-data "${KPI_SRC_DIR}/staticfiles/" "${NGINX_STATIC_DIR}/"
here's a script that takes advantage of the up-to-date files in the most recently built Docker image instead of calling npm run build
again. see the echo
text inside the script for a more detailed explanation.
(moved to gist)
@jnm what about calling your script in the --build
commands?
Sounds good!
I would like to test front-end changes to KPI code, e.g. while reviewing PRs. I do not want to use
npm run watch
, because no production build uses this. I would prefer not to have to rebuild and recreate all containers each time I change something in KPI, because this is slow (in excess of 3.5 minutes on my machine).Here's what I tried, to no avail:
kobo-install
;run.py
, instructing it to use developer mode and giving it the paths to the KPI and KoBoCAT source directories I'd just cloned;run.py --build-kpi
;run.py
again, which recreated all containers;:question: Am I doing something wrong, or am I trying to do something we haven't made possible yet?
Here is the (very long) transcript of my shell session:
Starting fresh and cloning the source repositories:
Cloning and running
kobo-install
:Looking for the string
creating your first project
, which I will later change:I make the following change to KPI, outside this shell:
Rebuilding KPI and seeing if the change made it through:
Since no results were found after rebuilding KPI, I'm now using
run.py
with no arguments to recreate all containers:Now looking again for my modification in the compiled static files:
Since there are still no results, here's a sanity check in the source directory:
In case it's helpful: run.conf (formatted).zip