2017-07-31 12:41:47 +00:00
|
|
|
#!/bin/bash -x
|
|
|
|
|
2018-06-06 02:21:26 +00:00
|
|
|
IMAGE_NAME=${1:-symposion_app}
|
2017-07-31 12:41:47 +00:00
|
|
|
|
2018-04-18 22:02:43 +00:00
|
|
|
if [ -e ./symposion-tools ]; then
|
|
|
|
pushd ./symposion-tools
|
|
|
|
./save_db_from_docker.sh
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
2018-06-06 02:21:26 +00:00
|
|
|
docker image build -f docker/Dockerfile -t ${IMAGE_NAME} --target symposion_dev .
|
2017-07-31 12:41:47 +00:00
|
|
|
docker container stop symposion
|
|
|
|
docker container rm symposion
|
2018-06-06 02:21:26 +00:00
|
|
|
docker container create --env-file docker/laptop-mode-env -p 28000:8000 -v $(pwd):/app/symposion_app --name symposion ${IMAGE_NAME}
|
2017-07-31 12:41:47 +00:00
|
|
|
docker container start symposion
|
Improved handling of static/build and css generation
When the container is mounted, the local contents of . obscure
/app/symposion_app in the image.
Generally speaking, this is handy for development, as it means that
local changes are detected and used immediately without needing to
restart the container.
However, it breaks in the specific case of the sass->css
generation. Prior to this change, the css is generated only after the
first time a page is hit. The generated file is placed in
static/build; however, due to the obscuration, this generated file
isn't visible to the running process.
The next time the container is built, the pre-existing static/build
directory is copied into the container as it's being built; then,
later, that version is what gets served.
This change adds the needed libraries to pre-generate the css as part
of the image build, and runs compilescss to do this, prior to the
collectstatic step.
It also adds a second collectstatic into the make_dev_container
script, so that the visible static/build directory should ahve the
same contents as the obscured static/build directory. It also expands
the .dockerignore file to make sure these files aren't copied into the
image in future.
I'm not sure if this is the right thing to do, as changes to this
directory will be ignored, which could be confusing. Perhaps never
being able to see these generated files is better?
2018-06-06 02:11:51 +00:00
|
|
|
## When we started the container and mounted . into /app/symposion_app, it hides the static/build directory
|
|
|
|
## As a kludge, re-run collectstatic to recreate it
|
|
|
|
## Possible alternative here: don't mount all of ., just mount the bits that we'd live to have update live
|
|
|
|
docker exec symposion ./manage.py collectstatic --noinput -v 0
|
2017-07-31 12:41:47 +00:00
|
|
|
docker exec symposion ./manage.py migrate
|
2018-06-04 08:51:03 +00:00
|
|
|
docker exec symposion ./manage.py loaddata ./fixtures/{conference,sites,sitetree,proposal_base,flatpages}.json
|
2017-07-31 12:41:47 +00:00
|
|
|
docker exec symposion ./manage.py create_review_permissions
|
2018-04-18 21:10:33 +00:00
|
|
|
#docker exec symposion ./manage.py populate_inventory
|
|
|
|
#docker exec symposion ./manage.py loaddata ./fixtures/miniconf-fixtures/*.json
|
2018-06-27 06:48:26 +00:00
|
|
|
|
2017-10-16 09:05:30 +00:00
|
|
|
if [ -e ./symposion-tools ]; then
|
|
|
|
pushd ./symposion-tools
|
2018-04-18 21:10:33 +00:00
|
|
|
./fixture_to_docker.sh fixtures/dev_dummy_superuser.json
|
|
|
|
./fixture_to_docker.sh fixtures/????_*.json
|
2017-09-17 03:54:27 +00:00
|
|
|
popd
|
|
|
|
else
|
2018-06-27 06:48:26 +00:00
|
|
|
docker exec -it symposion ./manage.py createsuperuser --username admin1 --email root@example.com
|
2017-09-17 03:54:27 +00:00
|
|
|
fi
|
2018-06-27 06:48:26 +00:00
|
|
|
docker exec symposion ./manage.py loaddata -v3 ./fixtures/cfp_teams_test.json
|
2017-07-31 12:41:47 +00:00
|
|
|
|
2017-08-01 05:23:50 +00:00
|
|
|
set +x
|
|
|
|
echo "Now you can log into http://localhost:28000/admin"
|
2018-06-27 06:48:26 +00:00
|
|
|
echo "Username: admin1 Password: the one you just typed twice"
|
2017-08-01 05:23:50 +00:00
|
|
|
echo "If you need to test as a non-admin user, create one at"
|
|
|
|
echo "http://localhost:28000/admin/auth/user/add/ - then log out"
|
|
|
|
echo "and log back in at http://localhost:28000"
|
2017-09-13 07:11:56 +00:00
|
|
|
|