|
| 1 | +#!/usr/bin/env bash |
| 2 | +# Fully resets the local OpenLibrary Docker environment. |
| 3 | +# |
| 4 | +# Been away for a while? Getting strange errors you weren't getting before? |
| 5 | +# Sometimes changes are made to the docker configs which could cause your |
| 6 | +# local environment to break. This script does a full reset so that you |
| 7 | +# have the latest of everything. |
| 8 | +# |
| 9 | +# Usage (run from the root of the openlibrary repo): |
| 10 | +# ./scripts/fully_reset_environment.sh |
| 11 | +# |
| 12 | +# WARNING: This is destructive. All local volumes and databases will be wiped. |
| 13 | +# See docker/README.md for more context. |
| 14 | + |
| 15 | +set -euo pipefail |
| 16 | + |
| 17 | +# Stop the site |
| 18 | +docker compose down |
| 19 | + |
| 20 | +# Build the latest oldev image, without cache, whilst also pulling the latest olbase image from docker hub. |
| 21 | +# This can take from a few minutes to more than 20 on older hardware. |
| 22 | +docker compose build --pull --no-cache |
| 23 | + |
| 24 | +# Remove any old containers/images |
| 25 | +# If you use docker for other things, and have containers/images you don't want to lose, be careful with this. But you likely don't :) |
| 26 | +docker container prune --filter label="com.docker.compose.project=openlibrary" --force |
| 27 | +docker image prune --filter label="com.docker.compose.project=openlibrary" --force |
| 28 | + |
| 29 | +# Remove volumes that might have outdated dependencies/code |
| 30 | +docker volume rm \ |
| 31 | + openlibrary_ol-build \ |
| 32 | + openlibrary_ol-nodemodules \ |
| 33 | + openlibrary_ol-postgres \ |
| 34 | + openlibrary_ol-vendor \ |
| 35 | + openlibrary_solr-data \ |
| 36 | + openlibrary_solr-updater-data |
| 37 | + |
| 38 | +# Bring it back up again |
| 39 | +docker compose up -d |
0 commit comments