Management tool additions
* Command to build packages locally * Help message * Start/Stop/Restart commands * Select production/development environements * clean pkgs/repo commands
This commit is contained in:
parent
b24edf2ac1
commit
0598c5c9be
|
@ -1 +1,2 @@
|
||||||
data/
|
data/
|
||||||
|
.piston_env
|
|
@ -1,4 +1,4 @@
|
||||||
version: '3.2'
|
version: "3.2"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
api:
|
api:
|
||||||
|
@ -19,6 +19,6 @@ services:
|
||||||
repo: # Local testing of packages
|
repo: # Local testing of packages
|
||||||
build: repo
|
build: repo
|
||||||
container_name: piston_repo
|
container_name: piston_repo
|
||||||
command: ['dart-2.12.1'] # Only build dart
|
command: ["--no-build"] # Don't build anything
|
||||||
volumes:
|
volumes:
|
||||||
- .:/piston
|
- .:/piston
|
||||||
|
|
77
piston
77
piston
|
@ -1,23 +1,72 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
PISTON_ENV=$(cat .piston_env || echo dev)
|
||||||
|
|
||||||
|
docker_compose(){
|
||||||
|
if [ -f "docker-compose.$PISTON_ENV.yaml" ]; then
|
||||||
|
docker-compose -f "docker-compose.$PISTON_ENV.yaml" "$@"
|
||||||
|
else
|
||||||
|
docker-compose "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
dev)
|
help)
|
||||||
shift
|
echo "=== Piston Management ==="
|
||||||
docker-compose -f docker-compose.dev.yaml "$@"
|
echo "Current Environment: $PISTON_ENV"
|
||||||
;;
|
echo
|
||||||
prod)
|
echo "Commands:"
|
||||||
shift
|
echo " select <environment> Select the environment"
|
||||||
docker-compose -f docker-compose.yaml "$@"
|
echo " docker_compose <args...> Interact directly with the docker-compose for the selected environment"
|
||||||
|
echo
|
||||||
|
echo " start Starts piston"
|
||||||
|
echo " stop Stops piston"
|
||||||
|
echo " restart Restarts piston"
|
||||||
|
echo
|
||||||
|
echo " update Fetches and applies latest updates"
|
||||||
|
echo
|
||||||
|
echo " <args..> Passthrough to piston cli tool"
|
||||||
|
echo
|
||||||
|
echo "Development Commands:"
|
||||||
|
|
||||||
|
if [ $PISTON_ENV == dev ]; then
|
||||||
|
|
||||||
|
echo " clean-pkgs Clean any package build artifacts on disk"
|
||||||
|
echo " clean-repo Remove all packages from local repo"
|
||||||
|
echo " build-pkg <package> <version> Build a package"
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
echo " Switch to developement environment for more info"
|
||||||
|
echo " > piston switch dev"
|
||||||
|
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
||||||
|
select) echo "$2" > .piston_env ;;
|
||||||
|
docker_compose) shift; docker_compose "$@";;
|
||||||
|
|
||||||
|
restart) docker_compose restart ;;
|
||||||
|
start) docker_compose up -d ;;
|
||||||
|
stop) docker_compose down ;;
|
||||||
|
|
||||||
update)
|
update)
|
||||||
git pull
|
git pull
|
||||||
docker-compose pull api
|
docker_compose pull
|
||||||
docker-compose up -d api
|
docker_compose up -d
|
||||||
;;
|
;;
|
||||||
clean-pkgs)
|
|
||||||
git clean -fqXd packages
|
clean-pkgs) git clean -fqXd packages ;;
|
||||||
;;
|
clean-repo) git clean -fqXd repo ;;
|
||||||
*)
|
|
||||||
node cli/index.js "$@"
|
build-pkg)
|
||||||
|
PKGSLUG="$2-$3"
|
||||||
|
echo "Building $PKGSLUG"
|
||||||
|
echo "Ensuring latest builder image"
|
||||||
|
docker build repo -t piston-repo-builder
|
||||||
|
docker run -v "$(realpath $(dirname "$0")):/piston" piston-repo-builder --no-server $PKGSLUG
|
||||||
;;
|
;;
|
||||||
|
*) node cli/index.js "$@" ;;
|
||||||
esac
|
esac
|
Loading…
Reference in New Issue