Skip to content

Commit d15f84e

Browse files
committed
separate out run dev deps scripts
1 parent a005b68 commit d15f84e

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pip3 install -r requirements.txt
1919

2020
## Development
2121

22-
Run dependencies (Montagu API and DB, Proxy, Packit and a local Redis message queue in docker) with `scripts/run-dependencies.sh`
22+
Run dependencies (Montagu API and DB, Proxy, Packit and a local Redis message queue in docker) with `scripts/run-dev-dependencies.sh`
2323

2424
Dependencies also include a fake smtp server run from a [docker image](https://hub.docker.com/r/reachfive/fake-smtp-server)
2525
to enable development and testing of email functionality. You can see a web front end for the emails 'sent' via this server

scripts/run-dependencies.sh

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,7 @@ docker run -d \
5656
$MONTAGU_PROXY_TAG 443 localhost
5757

5858
# give packit api some time to migrate the db...
59-
# TODO: poll rather than ridiculous sleep
60-
sleep 60
61-
docker logs montagu-packit-db
62-
docker logs montagu-packit-api
59+
sleep 5
6360

6461
# create roles to publish to...
6562
docker exec -i montagu-packit-db psql -U packituser -d packit --single-transaction <<EOF
@@ -75,20 +72,4 @@ DISPLAY_NAME='Test User'
7572
ROLE='ADMIN'
7673
docker exec montagu-packit-db create-preauth-user --username "$USERNAME" --email "$EMAIL" --displayname "$DISPLAY_NAME" --role "$ROLE"
7774

78-
# From now on, if the user presses Ctrl+C we should teardown gracefully
79-
function cleanup() {
80-
docker container stop reverse-proxy
81-
docker container rm reverse-proxy -v
82-
# Same exit code issue for packit stop as packit start....
83-
set +e
84-
hatch env run -- packit stop ./scripts
85-
set -e
86-
# remove db volume manually rather than --volumes flag to packit, to avoid requiring user confirmation
87-
docker volume rm montagu_packit_db montagu_orderly_library montagu_outpack_volume montagu_orderly_logs
88-
docker compose --project-name montagu down -v
89-
}
90-
trap cleanup EXIT
91-
92-
# Wait for Ctrl+C
93-
echo "Ready to use. Press Ctrl+C to teardown."
94-
sleep infinity
75+

scripts/run-dev-dependencies.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
set -ex
3+
4+
./scripts/run-dependencies.sh
5+
6+
# From now on, if the user presses Ctrl+C we should teardown gracefully
7+
function cleanup() {
8+
docker container stop reverse-proxy
9+
docker container rm reverse-proxy -v
10+
# Same exit code issue for packit stop as packit start....
11+
set +e
12+
hatch env run -- packit stop ./scripts
13+
set -e
14+
# remove db volume manually rather than --volumes flag to packit, to avoid requiring user confirmation
15+
docker volume rm montagu_packit_db montagu_orderly_library montagu_outpack_volume montagu_orderly_logs
16+
docker compose --project-name montagu down -v
17+
}
18+
trap cleanup EXIT
19+
20+
# Wait for Ctrl+C
21+
echo "Ready to use. Press Ctrl+C to teardown."
22+
sleep infinity

0 commit comments

Comments
 (0)