Automate setting up bakerydemo to use the Postgres db in services (#15)

* Update the README with instructions on getting bakerydemo to use the PostgreSQL database from the adjacent container
* Corrected formatting in README
* Automated setting up bakerydemo to use the postgres service from our docker-compose
pull/19/head
Cynthia Kiser 2020-10-21 10:25:48 -07:00 zatwierdzone przez GitHub
rodzic 43782a1533
commit 8b8d78f3cc
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 22 dodań i 9 usunięć

Wyświetl plik

@ -20,7 +20,7 @@ cd ~/Development
git clone git@github.com:wagtail/docker-wagtail-develop.git wagtail-dev
# 3. Move inside the new folder.
cd wagtail-dev/
# 4. Run the setup script. This will check out all the dependency repos.
# 4. Run the setup script. This will check out the bakerydemo project and local copies of wagtail and its dependencies.
./setup.sh
# 5. Build the containers
docker-compose build
@ -40,10 +40,10 @@ Here is the resulting folder structure:
Once the build is complete:
```sh
# 6. Run one-time databse setup, which will be persisted across container executions by Docker's Volumes system
setup-db.sh
# 7. Start your container setup
# 6. Start your containers and wait for them to finish their startup scripts.
docker-compose up
# 7. Now in a new shell, run the databse setup script. The database will be persisted across container executions by Docker's Volumes system so you will only need to run this commmand the first time you start the database.
setup-db.sh
# Success!
```
@ -62,11 +62,11 @@ What you can do
```sh
$ docker-compose ps
Name Command State Ports
---------------------------------------------------------------------------------------------------
docker-wagtail-develop_db_1 docker-entrypoint.sh postgres Up 5432/tcp
docker-wagtail-develop_frontend_1 /bin/sh -c cp -r /node_mod ... Up
docker-wagtail-develop_web_1 /bin/bash -c cd /code/wagt ... Up 0.0.0.0:8000->8000/tcp
Name Command State Ports
--------------------------------------------------------------------------
db docker-entrypoint.sh postgres Up 5432/tcp
frontend docker-entrypoint.sh /bin/ ... Up
web ./manage.py runserver 0.0. ... Up 0.0.0.0:8000->8000/tcp
```
### You can open a django shell session

Wyświetl plik

@ -32,3 +32,16 @@ if [ ! -d "libs/Willow" ]; then
else
echo Directory libs/Willow already exists, skipping...
fi
# Set up bakerydemo to use the Postgres database in the sister container
if [ ! -f bakerydemo/bakerydemo/settings/local.py ]; then
echo "Creating local settings file"
cp bakerydemo/bakerydemo/settings/local.py.docker-compose-example bakerydemo/bakerydemo/settings/local.py
fi
# Create a blank .env file in bakerydemo to keep its settings files from complaining
if [ ! -f bakerydemo/.env ]; then
echo "Creating file for local environment variables"
echo "DJANGO_SETTINGS_MODULE=bakerydemo.settings.local" > bakerydemo/.env
fi