feat: manage forge with one command (#14)

This commit is contained in:
Stephan Lüscher 2023-05-04 17:05:33 +00:00
parent 258a1ce7f7
commit 83379a0d72
No known key found for this signature in database
GPG key ID: 445779060FF3D3CF
3 changed files with 50 additions and 6 deletions

View file

@ -55,6 +55,12 @@ You can use the the user `ublue` and password `ublue` to login.
> At the moment there's only a dummy project included. Tasks for real life usage > At the moment there's only a dummy project included. Tasks for real life usage
> will be included soon. > will be included soon.
## Firing Up the Forge ## Handling the forge
To heat up the forge run `./setup.sh`. You can use the `forge.sh` to **setup**, **heat-up** and **cool-down** the forge.
| Command | Description |
| ---------------------- | -------------------------------------------- |
| `./forge.sh setup` | Setup the forge for the first time or update |
| `./forge.sh heat-up` | Start the forge |
| `./forge.sh cool-down` | Stop the forge |

42
forge.sh Executable file
View file

@ -0,0 +1,42 @@
#!/bin/bash
# Functions
function setup {
echo -e "${YELLOW}Heating up the forge for the first time..${ENDCOLOR}"
podman play kube forge-pod.yml --build --replace && podman logs --color -f ublue-os_forge-setup.ublue.local
echo -e "${GREEN}Done. Happy forging!${ENDCOLOR}"
}
function up {
echo -e "${YELLOW}Heating up the forge..${ENDCOLOR}"
podman pod start ublue-os_forge
echo -e "${GREEN}Done. Happy forging!${ENDCOLOR}"
}
function down {
echo -e "${YELLOW}Cooling down the forge..${ENDCOLOR}"
podman pod stop ublue-os_forge --ignore
echo -e "${GREEN}Done. Have a nice day${ENDCOLOR}"
}
# Bash colors
RED="\e[31m"
YELLOW="\e[33m"
GREEN="\e[32m"
ENDCOLOR="\e[0m"
# Main
case "$1" in
setup)
setup
;;
heat-up)
up
;;
cool-down)
down
;;
*)
echo "Invalid argument: please provide 'heat-up', 'cool-down', or 'setup'"
;;
esac

View file

@ -1,4 +0,0 @@
#!/bin/bash
# Setup Universal Blue Forge
podman play kube forge-pod.yml --build --replace && podman logs --color -f ublue-os_forge-setup.ublue.local