Commit 467f86da authored by Florent Chehab's avatar Florent Chehab
Browse files

fix(first launch backend container crash):

We now wait for the necessary static files to be generated before collecting the static files in the backend.

Fixes #88
parent 3cc1ee43
Pipeline #36863 passed with stages
in 5 minutes and 40 seconds
# Script to make sure that assets from the frontend have been generated at least
# once so that the backend container doesn't crash on the first launch.
while [ ! -f `dirname $0`/../frontend/webpack-stats.json ]; do
echo "Waiting for frontend static files to be initialized..."
sleep 2
echo "Frontend staticfiles are ready (NB: not necessarly up-to-date)."
......@@ -36,10 +36,11 @@ services:
- POSTGRES_USER=postgres
# Run the django developpement server on image startup.
command: /bin/sh -c "cd backend && ./ collectstatic --noinput && ./ runserver"
command: /bin/sh -c "cd backend && ./ && ./ collectstatic --noinput && ./ runserver"
# Required that the `database` service is up and running.
# Required that the `database` and `frontend` service is up and running.
- database
- frontend
# Service for the postgres database
......@@ -48,8 +48,6 @@ Finally you can start-up all `docker` related *stuff* using the command:
make up--build
**When you launch the project for the first time you'll most likely have the backend container crash due to the lack of some static files. Make sure not to stop the launch process until you see `frontend_1 | ℹ 「wdm」: Compiled successfully` in the console. Then you can stop the command (`CTRL+C`) and do `make up`; you shouldn't have issues thereafter.**
You can look at the `Makefile` to have more information on that last command and the other ones that are available.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment