docs: add section on dev services
This commit is contained in:
14
README.md
14
README.md
@@ -116,21 +116,23 @@ docker compose exec step step ca provisioner update acme \
|
|||||||
--x509-default-dur=2160h
|
--x509-default-dur=2160h
|
||||||
```
|
```
|
||||||
|
|
||||||
### Use the preconfigured services
|
### Create a shell script to start/stop general services
|
||||||
|
|
||||||
If you use the preconfigured services, you can add the following snippet to you `.bashrc`/`.zshrc` to easily start, stop, and manage the services.
|
I often use `dbgate` to interact with databases. For services like that i setup a `services/compose.yml` inside this directory where I define each service i use with a custom profile so that i can start and stop them individually.
|
||||||
|
|
||||||
|
If you use the preconfigured services, you can add the following snippet to you `.bashrc`/`.zshrc` to easily start, stop, and manage the services. Make sure to update the `PROJECT_DIR` variable to point to the correct directory.
|
||||||
```shell
|
```shell
|
||||||
dev () {
|
dev () {
|
||||||
PROJECT_DIR="$HOME/Projects/dev/services"
|
PROJECT_DIR="$HOME/Projects/dev/services"
|
||||||
case "$1" in
|
case "$1" in
|
||||||
(start) shift
|
(start) shift
|
||||||
docker compose -f "$PROJECT_DIR/docker-compose.yml" --profile "$@" up -d ;;
|
docker compose -f "$PROJECT_DIR/compose.yml" --profile "$@" up -d ;;
|
||||||
(restart) shift
|
(restart) shift
|
||||||
docker compose -f "$PROJECT_DIR/docker-compose.yml" --profile "$@" restart ;;
|
docker compose -f "$PROJECT_DIR/compose.yml" --profile "$@" restart ;;
|
||||||
(stop) shift
|
(stop) shift
|
||||||
docker compose -f "$PROJECT_DIR/docker-compose.yml" --profile "$@" down --remove-orphans ;;
|
docker compose -f "$PROJECT_DIR/compose.yml" --profile "$@" down --remove-orphans ;;
|
||||||
(logs) shift
|
(logs) shift
|
||||||
docker compose -f "$PROJECT_DIR/docker-compose.yml" --profile "$@" logs -f ;;
|
docker compose -f "$PROJECT_DIR/compose.yml" --profile "$@" logs -f ;;
|
||||||
(*) echo "Usage: dev {start|restart|stop|logs} [services...]" ;;
|
(*) echo "Usage: dev {start|restart|stop|logs} [services...]" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user