Skip to content

Commit 55652ad

Browse files
committed
Tidy up location of scripts for different OSes and update README
1 parent ba5f85b commit 55652ad

File tree

12 files changed

+83
-8
lines changed

12 files changed

+83
-8
lines changed

README.MD

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ navigate to `local-development` and run `dev_start.sh`.
1111
```bash
1212
git clone [email protected]:ambarltd/courses-v2.git
1313
cd courses-v2/local-development
14-
./dev_start.sh
14+
./scripts/linux/dev_start.sh # if you're on linux
15+
./scripts/linux/dev_start.sh # if you're on mac
1516
```
1617

1718
Now open your browser to `localhost:8080` and try the application out! You will receive
@@ -32,21 +33,27 @@ This example application contains an event sourced financial institution that al
3233

3334
The code for `1.`, `2.`, `3.`, and `4.`, is written in PHP, and lives
3435
at `application/backend-php`. The code for `5.` is written in other languages
35-
to help you understand event sourcing in your preferred language.
36+
to help you understand event sourcing in your preferred language. Currently,
37+
`5.` is available in Java, C#, and Typescript.
3638

3739
By default `5` is deployed with Java. But if you'd like to change that,
3840
simply head to `local-development/docker-compose.yml` and change the
39-
`credit-card-enrollment` to use the directory corresponding to your
40-
preferred language.
41+
`backend-credit-card-enrollment` service to use the directory corresponding
42+
to your preferred language.
4143

4244
## Building More
4345

4446
If you change the code, simply redeploy your Docker containers, and refresh your browser.
4547

4648
```bash
4749
cd courses-v2/local-development
48-
./dev_start.sh
49-
./dev_start_with_data_deletion.sh # use this if you want to delete your existing event store, and projection db
50+
# For Linux
51+
./scripts/linux/dev_start.sh
52+
./scripts/linux/dev_start_with_data_deletion.sh # use this if you want to delete your existing event store, and projection db
53+
# For Mac
54+
./scripts/linux/dev_start.sh
55+
./scripts/linux/dev_start_with_data_deletion.sh # use this if you want to delete your existing event store, and projection db
56+
# Windows support (todo) - feel free to add a Pull Request ;)
5057
```
5158

5259
## Making Sense of the Code
@@ -77,8 +84,7 @@ local-development/ # Local development environment defined with Docker
7784
│ # Needed for projections and reactions as per
7885
│ # https://hub.docker.com/r/ambarltd/emulator
7986
80-
├── dev_start.sh # Starts the application's containers and gives you first steps!
81-
└── dev_shutdown.sh # Stops the application's Docker containers
87+
├── scripts. # Scripts to start/stop the application's containers.
8288
```
8389

8490
## Support
File renamed without changes.
File renamed without changes.

local-development/dev_start_with_data_deletion.sh renamed to local-development/scripts/linux/dev_start_with_data_deletion.sh

File renamed without changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
set -e
3+
4+
docker compose down
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
set -e
3+
4+
docker compose down
5+
docker compose up -d --build --force-recreate
6+
7+
all_services_fully_healthy() {
8+
! docker compose ps --format "table {{.ID}}\t{{.Name}}\t{{.Status}}" | grep -q -E "(unhealthy|starting)"
9+
}
10+
11+
while ! all_services_fully_healthy; do
12+
echo "Waiting for all services to be healthy..."
13+
docker compose ps --format "table {{.ID}}\t{{.Name}}\t{{.Status}}"
14+
echo ""
15+
sleep 5
16+
done
17+
18+
docker compose ps --format "table {{.ID}}\t{{.Name}}\t{{.Status}}"
19+
20+
echo ""
21+
echo "=================================================================="
22+
echo "|| All services are healthy! ||"
23+
echo "=================================================================="
24+
echo ""
25+
26+
echo "=================================================================="
27+
echo "|| You can navigate to localhost:8080 to view your application. ||"
28+
echo "=================================================================="
29+
echo "|| You will receive further instructions in the top menu. ||"
30+
echo "=================================================================="
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "Going into root mode to delete some docker volumes"
5+
sudo echo "Root mode: OK"
6+
docker compose down
7+
sudo rm -Rf data/*
8+
docker compose up -d --build --force-recreate
9+
10+
11+
12+
all_services_fully_healthy() {
13+
! docker compose ps --format "table {{.ID}}\t{{.Name}}\t{{.Status}}" | grep -q -E "(unhealthy|starting)"
14+
}
15+
16+
while ! all_services_fully_healthy; do
17+
echo "Waiting for all services to be healthy..."
18+
docker compose ps --format "table {{.ID}}\t{{.Name}}\t{{.Status}}"
19+
echo ""
20+
sleep 5
21+
done
22+
23+
docker compose ps --format "table {{.ID}}\t{{.Name}}\t{{.Status}}"
24+
25+
echo ""
26+
echo "=================================================================="
27+
echo "|| All services are healthy! ||"
28+
echo "=================================================================="
29+
echo ""
30+
31+
echo "=================================================================="
32+
echo "|| You can navigate to localhost:8080 to view your application. ||"
33+
echo "=================================================================="
34+
echo "|| You will receive further instructions in the top menu. ||"
35+
echo "=================================================================="
File renamed without changes.

local-development/php-backend-scripts/dev_depen_check.sh renamed to local-development/scripts/php-backend-scripts/dev_depen_check.sh

File renamed without changes.

local-development/php-backend-scripts/dev_linter_check.sh renamed to local-development/scripts/php-backend-scripts/dev_linter_check.sh

File renamed without changes.

0 commit comments

Comments
 (0)