From 4a1bfe174aab4fd903eda46b0d7b615d87947f43 Mon Sep 17 00:00:00 2001 From: Flo Date: Sat, 21 Dec 2024 04:09:19 +0100 Subject: [PATCH] __devenv --- README.md | 77 +++++++++++++++++++------------------------------------ down | 7 ++--- stop | 6 ++--- 3 files changed, 33 insertions(+), 57 deletions(-) diff --git a/README.md b/README.md index 860d447..fc63bab 100644 --- a/README.md +++ b/README.md @@ -1,53 +1,28 @@ -Folgende Kommandos müssen abgebildet werden: +# Stack-Up dev-env +## Introduction +This project is the development environment of all stack-up projects. +It simplifies handling different docker-enabled applications and their maintenance. -befehle: -denv - - init -> call script - - update -> call script +## Installation +- Create a .systems file bases on .systems.example: `cp .systems.example .systems` +- Enter all systems in the created file `nano .systems` +- run `./init`. Init will: + - update `.aliases` file, which enables you to switch between your systems easily via `goto-` + - updates `.profile` to use the updated aliases, enables the dev-env binaries (denv, drun, dcom, ...) and add some utility functions + - clones all systems defined in `.systems` + - calls the `bin/script/init` script for all cloned systems. +- Perform init actions on systems +- `./up` to start your containers + - up will also run all the `bin/script/firstRun` scripts, if the `.firstRun` marker is missing - - build -> dcom - - stop -> dcom - - down -> dcom - - up -> dcom - -drun - - docker exec - - examples: - drun composer install # Executes composer install in container associated with current directory - drun weedkeeper-backend composer install # Executes composer install in weedkeeper-backend container - -dcom - - build - - stop - - down - - up - - examples: - dcom build # Executes docker compose build with docker-compose file located in docker/ - dcom weedkeeper-backend build # Executes docker compose build with docker-compose file located in weedkeeper-backend/docker/ - - -dev-env: - bin: - denv - drun - dcom - script: - init - clone - update - - docker: - build - stop - down - up -d - - -system: - .env - script - init - update - firstRun - docker - docker-compose.yml \ No newline at end of file +## Usage +After the installation was performed successfully and you've sourced your ~/.profile file, you'll have access to the following utilities: +- denv + - without a parameter, navigates to the development environment + - if a parameter is specified, denv will try to execute the passed script in the dev-env base folder +- drun + - executes a command on the app container of a system +- dcom + - executes a docker compose command. + - without a parameter, for the system of the current directory + - with a parameter, for the supplied system-id \ No newline at end of file diff --git a/down b/down index 18bcb4f..aafcaf2 100755 --- a/down +++ b/down @@ -3,8 +3,9 @@ ENV_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) source $ENV_DIR/bin/denv_msg -denv_info_msg "Executing down dev-env" -docker compose -f "$ENV_DIR/docker/docker-compose.yml" down + +$ENV_DIR/script/foreachSystem/dcom down echo "" -$ENV_DIR/script/foreachSystem/dcom down \ No newline at end of file +denv_info_msg "Executing down dev-env" +docker compose -f "$ENV_DIR/docker/docker-compose.yml" down \ No newline at end of file diff --git a/stop b/stop index 5615774..e5d424e 100755 --- a/stop +++ b/stop @@ -3,8 +3,8 @@ ENV_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) source $ENV_DIR/bin/denv_msg -denv_info_msg "Executing stop dev-env" -docker compose -f "$ENV_DIR/docker/docker-compose.yml" stop +$ENV_DIR/script/foreachSystem/dcom stop echo "" -$ENV_DIR/script/foreachSystem/dcom stop \ No newline at end of file +denv_info_msg "Executing stop dev-env" +docker compose -f "$ENV_DIR/docker/docker-compose.yml" stop \ No newline at end of file