diff --git a/.gitignore b/.gitignore
index ed1c07c..3ba31a3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
cron/
var/
+
diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 13566b8..0000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
-# Editor-based HTTP Client requests
-/httpRequests/
-# Datasource local storage ignored files
-/dataSources/
-/dataSources.local.xml
diff --git a/.idea/dev.iml b/.idea/dev.iml
deleted file mode 100644
index 3a10ba3..0000000
--- a/.idea/dev.iml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 8cc3e82..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/php.xml b/.idea/php.xml
deleted file mode 100644
index 9ef07eb..0000000
--- a/.idea/php.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 7f13aa8..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.profile b/.profile
new file mode 100644
index 0000000..b1ff785
--- /dev/null
+++ b/.profile
@@ -0,0 +1,27 @@
+# set GIT branch in bash
+parse_git_branch() {
+ git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
+}
+PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ '
+
+# ssh setup
+SSH_ENV="$HOME/.ssh/agent-environment"
+function start_agent {
+ echo "Initialising new SSH agent..."
+ /usr/bin/ssh-agent | sed 's/^echo/#echo/' >"$SSH_ENV"
+ echo succeeded
+ chmod 600 "$SSH_ENV"
+ . "$SSH_ENV" >/dev/null
+ /usr/bin/ssh-add;
+
+ ssh-add ~/.ssh/gitea_ssh
+}
+
+if [ -f "$SSH_ENV" ]; then
+ . "$SSH_ENV" >/dev/null
+ ps -ef | grep $SSH_AGENT_PID | grep ssh-agent$ >/dev/null || {
+ start_agent
+ }
+else
+ start_agent
+fi
diff --git a/bin/denv b/bin/denv
index 978286c..675c2b0 100755
--- a/bin/denv
+++ b/bin/denv
@@ -1,12 +1,16 @@
#!/bin/bash
-ENVIRONMENT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/../../
+ENV_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/../" &> /dev/null && pwd )
denv() {
if [ ! -z $1 ]
then
- $ENVIRONMENT_DIR/$1
+ if [[ "$1" == "setup" ]]; then
+ echo "SETUP IS ONLY ALLOWED ONCE AFTER CLOING THE ENVIRONMENT!!!"
+ exit 0
+ fi
+ $ENV_DIR/$1
else
- cd $ENVIRONMENT_DIR
+ cd $ENV_DIR
fi
}
\ No newline at end of file
diff --git a/bin/dexec b/bin/dexec
new file mode 100755
index 0000000..6f54b8d
--- /dev/null
+++ b/bin/dexec
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+denvexec() {
+ if [ $# -lt 1 ]; then
+ echo "Verwendung: denvexec "
+ return 1
+ fi
+
+ local DOCKER_COMMAND="$@"
+ local ENV_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd )
+
+ echo ""
+ echo "Directory: ${ENV_DIR}"
+
+ #MAC
+ if [[ "$OSTYPE" == "darwin"* ]]; then
+ docker compose -f "${ENV_DIR}/docker/docker-compose-mac.yml" $DOCKER_COMMAND
+ echo "done"
+
+ #LINUX
+ elif [[ "$OSTYPE" == "linux-gnu" ]]; then
+ docker compose -f "${ENV_DIR}/docker/docker-compose.yml" $DOCKER_COMMAND
+ echo "done"
+ else
+ echo "Dieses Skript wird auf deinem Gerät nicht unterstützt"
+ exit 1
+ fi
+}
+
+dexec() {
+ if [ $# -lt 2 ]; then
+ echo "Verwendung: dexec "
+ return 1
+ fi
+
+ local systemPart="${1%-*}" # before "-" e.g. auth / bee / etc
+ local typePart="${1##*-}" # after "-" e.g. backend / frontend
+ local SYSTEM_DIR="$typePart/$systemPart"
+ shift # removes first argument
+ local DOCKER_COMMAND="$@"
+ local ENV_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd )
+
+ echo ""
+ echo "Directory: ${ENV_DIR}/systems/${SYSTEM_DIR}"
+
+ local DOT_ENV_PATH="${ENV_DIR}/systems/${SYSTEM_DIR}/.env"
+
+ #SET ENV VARIABLES FROM .ENV
+ if [ -e "$DOT_ENV_PATH" ]; then
+ export $(grep -v '^#' "$DOT_ENV_PATH" | xargs)
+ fi
+
+ #MAC
+ if [[ "$OSTYPE" == "darwin"* ]]; then
+ docker compose -f "${ENV_DIR}/systems/${SYSTEM_DIR}/docker/docker-compose-mac.yml" $DOCKER_COMMAND
+ echo "done"
+
+ #LINUX
+ elif [[ "$OSTYPE" == "linux-gnu" ]]; then
+ docker compose -f "${ENV_DIR}/systems/${SYSTEM_DIR}/docker/docker-compose.yml" $DOCKER_COMMAND
+ echo "done"
+
+ else
+ echo "Dieses Skript wird auf deinem Gerät nicht unterstützt"
+ exit 1
+ fi
+
+ #UNSET ENV VARIABLES FROM .ENV
+ if [ -e "$DOT_ENV_PATH" ]; then
+ unset $(grep -v '^#' "$DOT_ENV_PATH" | sed -E 's/(.*)=.*/\1/' | xargs)
+ fi
+}
\ No newline at end of file
diff --git a/bin/drun b/bin/drun
index bf43fef..e4b806d 100755
--- a/bin/drun
+++ b/bin/drun
@@ -1,28 +1,33 @@
#!/bin/bash
drun() {
- # Überprüfen, ob die richtige Anzahl Argumente übergeben wurden
if [ $# -lt 2 ]; then
- echo "Verwendung: drun "
+ echo "Verwendung: drun "
return 1
fi
- # Container-Namen extrahieren
local CONTAINER_NAME="$1"
shift # Das erste Argument entfernen
-
- # Den Rest der Argumente als Befehlszeichenfolge zusammenfügen
local COMMAND="$@"
-
- # Container-ID mithilfe des Container-Namens finden
local CONTAINER_ID=$(docker ps -qf "name=$CONTAINER_NAME-app")
- # Überprüfen, ob der Container gefunden wurde
if [ -z "$CONTAINER_ID" ]; then
echo "Container '$CONTAINER_NAME' wurde nicht gefunden."
return 1
fi
- # Befehl im Container ausführen
docker exec -it "$CONTAINER_ID" $COMMAND
}
+
+_drun_completion() {
+ local cur prev opts
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ opts="start stop restart status"
+
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+}
+
+complete -F _drun_completion drun
\ No newline at end of file
diff --git a/bin/script/exec b/bin/script/exec
deleted file mode 100755
index f12a32e..0000000
--- a/bin/script/exec
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-
-COMMAND="$@"
-SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
-
-echo "Execute ${COMMAND} in denv"
-
-#MAC
-if [[ "$OSTYPE" == "darwin"* ]]; then
- docker compose -f "${SCRIPT_DIR}/../../docker/docker-compose-mac.yml" $COMMAND
-
-#LINUX
-elif [[ "$OSTYPE" == "linux-gnu" ]]; then
- docker compose -f "${SCRIPT_DIR}/../../docker/docker-compose.yml" $COMMAND
-
-else
- echo "Dieses Skript wird auf deinem Gerät nicht unterstützt"
- exit 1
-fi
diff --git a/bin/script/foreachSystem b/bin/script/foreachSystem
index 96b9f45..4bc4f98 100755
--- a/bin/script/foreachSystem
+++ b/bin/script/foreachSystem
@@ -1,20 +1,30 @@
#!/bin/bash
-EXEC_DIR=$(pwd)
-FILE_TO_EXECUTE=$1
+COMMAND="$@"
+ENV_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/../.." &> /dev/null && pwd )
-if [ ! -z $1 ]
-then
- echo "Execute " $1 " in each system"
-else
- echo "Execute foreachSystem failed, because no parameter was provided"
- exit
+source ${ENV_DIR}/bin/dexec
+
+if [ $# -lt 1 ]; then
+ echo "Verwendung: foreachSystem up -d"
+ return 1
fi
-for SYSTEM in systems/*/*/ ; do
- echo "executing ${FILE_TO_EXECUTE} in ${SYSTEM}"
- cd $SYSTEM
- ./bin/script/$FILE_TO_EXECUTE
- cd $EXEC_DIR
+for SYSTEM in $ENV_DIR/systems/*/*/ ; do
+ relative_path="${SYSTEM#*/systems/}"
+ relative_path="${relative_path%/}"
+
+ typePart="${relative_path%/*}" # before "/" eg. backend / frontend
+ systemPart="${relative_path##*/}" # after "/" eg. bee / auth / etc
+ SYSTEM_CODE="$systemPart-$typePart"
+ DENV_COMMAND="dexec"
+
+ if [[ "$COMMAND" == "init" ]]; then
+ $ENV_DIR/systems/$typePart/$systemPart/bin/script/init
+ elif [[ "$COMMAND" == "update" ]]; then
+ $ENV_DIR/systems/$typePart/$systemPart/bin/script/update
+ else
+ $DENV_COMMAND $SYSTEM_CODE $COMMAND
+ fi
done
diff --git a/bin/script/prune b/bin/script/prune
deleted file mode 100755
index 4118be6..0000000
--- a/bin/script/prune
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-
-docker stop $(docker ps -aq)
-
-docker system prune -f
-
-docker network create homepage
-
-./pull
-./bin/script/init
diff --git a/bin/script/pull b/bin/script/pull
index 8b6c798..884fda5 100755
--- a/bin/script/pull
+++ b/bin/script/pull
@@ -2,13 +2,9 @@
EXEC_DIR=$(pwd)
-echo "Execute git pull in each system"
-
-#echo "denv"
-#git pull
+echo "Execute git pull in each system"
for SYSTEM in $EXEC_DIR/systems/*/*/ ; do
- echo $SYSTEM
cd $SYSTEM
git pull
cd $EXEC_DIR
diff --git a/bin/script/setup b/bin/script/setup
deleted file mode 100755
index 239688b..0000000
--- a/bin/script/setup
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-
-echo $OSTYPE
-
-#MAC
-if [[ "$OSTYPE" == "darwin"* ]]; then
- home="$HOME"
-
-#LINUX
-elif [[ "$OSTYPE" == "linux-gnu" ]]; then
- home="$HOME"
-else
- echo "Dieses Skript wird nicht unter macOS oder Linux unterstützt."
- exit 1
-fi
-
-script_path=$(pwd)
-environment=$(basename $script_path)
-
-echo "source ~/$environment/bin/script/denv" >> ~/.profile
-echo "source ~/$environment/bin/script/drun" >> ~/.profile
-echo "source ~/$environment/bin/script/git" >> ~/.profile
-
-echo Running in $script_path
-echo environment = $environment
-
-# $1 = frontend/backend
-# $2 = repo name
-fetch_repository() {
- if [ ! -d "$1" ];
- then
- echo "Create $1"
- mkdir -p "$1"
- fi
-
- cd $1
-
- if [ ! -d "$2" ];
- then
- gh repo clone TheFlawww/$2-$1 $2
- fi
-
- cd $script_path
-}
-
-
-#fetch all backends
-fetch_repository backend weedkeeper
-
-#fetch all frontends
-fetch_repository frontend weedkeeper
-
-# initialize
-./bin/script/init
diff --git a/bin/script/upgrade b/bin/script/upgrade
deleted file mode 100755
index d58e39a..0000000
--- a/bin/script/upgrade
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-
-SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
-
-$SCRIPT_DIR/pull
-source $SCRIPT_DIR/../source
-
-drun weedkeeper-backend composer da
-drun weedkeeper-backend composer install
-drun weedkeeper-backend composer dmm
-drun weedkeeper-backend composer console rbac:update
-
-drun weedkeeper-frontend npm i
-drun weedkeeper-frontend npm run build
diff --git a/bin/source b/bin/source
deleted file mode 100755
index fee2747..0000000
--- a/bin/source
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
-
-source $SCRIPT_DIR/denv
-source $SCRIPT_DIR/drun
-source $SCRIPT_DIR/git
diff --git a/build b/build
index 4f129c9..b17aaaf 100755
--- a/build
+++ b/build
@@ -1,4 +1,10 @@
#!/bin/bash
-./bin/script/exec build
-./bin/script/foreachSystem build
+SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
+
+source $SCRIPT_DIR/bin/denv
+source $SCRIPT_DIR/bin/dexec
+source $SCRIPT_DIR/bin/drun
+
+denvexec build
+$SCRIPT_DIR/bin/script/foreachSystem build
diff --git a/cron/.gitignore b/cron/.gitignore
new file mode 100644
index 0000000..d6b7ef3
--- /dev/null
+++ b/cron/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/docker/.gitignore b/docker/.gitignore
index ec19369..87489b1 100644
--- a/docker/.gitignore
+++ b/docker/.gitignore
@@ -1 +1,3 @@
letsencrypt/*
+docker-compose-mac.yml
+docker-compose.yml
\ No newline at end of file
diff --git a/docker/docker-compose.yml b/docker/docker-compose-mac.yml.dist
similarity index 85%
rename from docker/docker-compose.yml
rename to docker/docker-compose-mac.yml.dist
index b34894d..bf5e33a 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose-mac.yml.dist
@@ -1,12 +1,12 @@
networks:
- weedkeeper:
- name: weedkeeper
+ template:
+ name: template
services:
traefik:
image: traefik:v3.0
networks:
- - weedkeeper
+ - template
command:
- "--providers.docker=true"
- "--entrypoints.web.address=:80"
@@ -24,4 +24,4 @@ services:
- "./letsencrypt:/letsencrypt"
- "/var/run/docker.sock:/var/run/docker.sock"
labels:
- - "traefik.http.routers.traefik.rule=Host(`traefik.weedkeeper.de`)"
+ - "traefik.http.routers.traefik.rule=Host(`traefik.template.local`)"
diff --git a/docker/docker-compose.yml.dist b/docker/docker-compose.yml.dist
new file mode 100644
index 0000000..bf5e33a
--- /dev/null
+++ b/docker/docker-compose.yml.dist
@@ -0,0 +1,27 @@
+networks:
+ template:
+ name: template
+
+services:
+ traefik:
+ image: traefik:v3.0
+ networks:
+ - template
+ command:
+ - "--providers.docker=true"
+ - "--entrypoints.web.address=:80"
+ - "--entrypoints.web.http.redirections.entrypoint.to=websecure"
+ - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
+ - "--entrypoints.websecure.address=:443"
+ - "--certificatesresolvers.le.acme.tlschallenge=true"
+ - "--certificatesresolvers.le.acme.email=florian_feistel@outlook.de"
+ - "--certificatesresolvers.le.acme.storage=/letsencrypt/acme.json"
+ ports:
+ - "80:80"
+ - "443:443"
+ - "8080:8080"
+ volumes:
+ - "./letsencrypt:/letsencrypt"
+ - "/var/run/docker.sock:/var/run/docker.sock"
+ labels:
+ - "traefik.http.routers.traefik.rule=Host(`traefik.template.local`)"
diff --git a/docker/install b/docker/install
new file mode 100755
index 0000000..e7877af
--- /dev/null
+++ b/docker/install
@@ -0,0 +1,13 @@
+sudo apt-get update
+sudo apt-get install ca-certificates curl gnupg
+sudo install -m 0755 -d /etc/apt/keyrings
+curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
+sudo chmod a+r /etc/apt/keyrings/docker.gpg
+echo \
+ "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
+ "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
+ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
+sudo apt-get update
+sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
+sudo apt install docker-compose -y
+sudo usermod -aG docker $USER
diff --git a/down b/down
index ef738dc..b8a9117 100755
--- a/down
+++ b/down
@@ -1,4 +1,10 @@
#!/bin/bash
-./bin/script/exec down
-./bin/script/foreachSystem down
+SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
+
+source $SCRIPT_DIR/bin/denv
+source $SCRIPT_DIR/bin/dexec
+source $SCRIPT_DIR/bin/drun
+
+$SCRIPT_DIR/bin/script/foreachSystem down
+denvexec down
\ No newline at end of file
diff --git a/init b/init
index 4523edf..4c67f44 100755
--- a/init
+++ b/init
@@ -1,4 +1,33 @@
#!/bin/bash
-./bin/script/exec init
-./bin/script/foreachSystem init
+SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
+
+source $SCRIPT_DIR/bin/denv
+source $SCRIPT_DIR/bin/dexec
+source $SCRIPT_DIR/bin/drun
+
+EXIT=0
+
+# Check docker-compose.yml file
+if [ ! -f "$SCRIPT_DIR/docker/docker-compose.yml" ]
+then
+ cp "$SCRIPT_DIR/docker/docker-compose.yml.dist" "$SCRIPT_DIR/docker/docker-compose.yml"
+ EXIT=1
+fi
+
+# Check docker-compose-mac.yml file
+if [ ! -f "$SCRIPT_DIR/docker/docker-compose-mac.yml" ]
+then
+ cp "$SCRIPT_DIR/docker/docker-compose-mac.yml.dist" "$SCRIPT_DIR/docker/docker-compose-mac.yml"
+ EXIT=1
+fi
+
+
+if [ $EXIT -eq 1 ]
+then
+ echo "docker-compose files created, please change variables and call init again"
+ exit 1
+fi
+
+denvexec up -d
+$SCRIPT_DIR/bin/script/foreachSystem init
diff --git a/python/capture-thermometer-data.py b/python/capture-thermometer-data.py
deleted file mode 100644
index bca7d2c..0000000
--- a/python/capture-thermometer-data.py
+++ /dev/null
@@ -1,37 +0,0 @@
-import asyncio
-import json
-from datetime import datetime
-from bleak import BleakScanner
-
-async def handle_discovery(device, advertisement_data):
- if device.address == "DB:17:6C:7D:81:F6":
- keys = list(advertisement_data.manufacturer_data.keys())
- humKey = keys[len(keys)-1]
- battery = humKey & 0xFF
- temperature = (humKey >> 8)/10.0
- if humKey < 32767: #If Key is bigger than a smallint, temperature is lower than one byte (256)
- temperature = temperature + 25.6
-
- data = {}
- data['temp'] = temperature
- data['battery'] = battery / 256.0;
- data['humid'] = advertisement_data.manufacturer_data[humKey][1]
- data['timestamp'] = datetime.now().strftime("%d.%m.%Y %H:%M:%S")
-
- jsonString = json.dumps(data)
- with open("/home/flo/local-weedkeeper/systems/backend/weedkeeper/var/temperature.data", "a") as dataFile:
- dataFile.write(jsonString+",\n")
- #print(jsonString)
- await scanner.stop()
-
-async def scan():
- global scanner
- scanner = BleakScanner(handle_discovery)
- await scanner.start()
- await asyncio.sleep(10)
- await scanner.stop()
-
-async def main():
- await scan()
-
-asyncio.run(main())
diff --git a/setup b/setup
new file mode 100755
index 0000000..e5ebc32
--- /dev/null
+++ b/setup
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+# THIS SCRIPT NEEDS TO BE EXECUTED FIRST AFTER CLONING THE ENVIRONMENT AND SHALL NEVER BE EXECUTED AGAIN
+# IT SETS UP THE ENVIRONMENT IN THE PROFILE TO ENABLE CORE COMMANDS LIKE denv drun dexec
+
+# MAC
+if [[ "$OSTYPE" == "darwin"* ]]; then
+ home="$HOME"
+
+# LINUX
+elif [[ "$OSTYPE" == "linux-gnu" ]]; then
+ home="$HOME"
+
+else
+ echo "Dieses Skript wird auf deinem Gerät nicht unterstützt"
+ exit 1
+fi
+
+ENV_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
+
+echo "Setup dev-env..."
+
+echo "Adding sourcing of environment commands to .profile"
+echo "" >> ~/.profile
+echo "# denv commands setup" >> ~/.profile
+echo "source $ENV_DIR/bin/denv" >> ~/.profile
+echo "source $ENV_DIR/bin/drun" >> ~/.profile
+echo "source $ENV_DIR/bin/dexec" >> ~/.profile
+echo "source $ENV_DIR/bin/git" >> ~/.profile
+
+echo "appending dev-env .profile to .profile"
+echo "" >> ~/.profile
+cat .profile >> ~/.profile
diff --git a/stop b/stop
index 82d3ba7..1f53670 100755
--- a/stop
+++ b/stop
@@ -1,4 +1,10 @@
#!/bin/bash
-./bin/script/exec stop
-./bin/script/foreachSystem stop
+SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
+
+source $SCRIPT_DIR/bin/denv
+source $SCRIPT_DIR/bin/dexec
+source $SCRIPT_DIR/bin/drun
+
+$SCRIPT_DIR/bin/script/foreachSystem stop
+denvexec stop
diff --git a/up b/up
index 7f3abc8..a206eaf 100755
--- a/up
+++ b/up
@@ -1,4 +1,10 @@
#!/bin/bash
-./bin/script/exec up -d
-./bin/script/foreachSystem up
+SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
+
+source $SCRIPT_DIR/bin/denv
+source $SCRIPT_DIR/bin/dexec
+source $SCRIPT_DIR/bin/drun
+
+denvexec up -d
+$SCRIPT_DIR/bin/script/foreachSystem up -d
diff --git a/update b/update
new file mode 100755
index 0000000..c0193e6
--- /dev/null
+++ b/update
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
+
+source $SCRIPT_DIR/bin/denv
+source $SCRIPT_DIR/bin/dexec
+source $SCRIPT_DIR/bin/drun
+
+EXIT=0
+
+# Check docker-compose.yml file
+if [ ! -f "$SCRIPT_DIR/docker/docker-compose.yml" ]
+then
+ cp "$SCRIPT_DIR/docker/docker-compose.yml.dist" "$SCRIPT_DIR/docker/docker-compose.yml"
+ EXIT=1
+fi
+
+# Check docker-compose-mac.yml file
+if [ ! -f "$SCRIPT_DIR/docker/docker-compose-mac.yml" ]
+then
+ cp "$SCRIPT_DIR/docker/docker-compose-mac.yml.dist" "$SCRIPT_DIR/docker/docker-compose-mac.yml"
+ EXIT=1
+fi
+
+
+if [ $EXIT -eq 1 ]
+then
+ echo "docker-compose files created, please change variables and call update again"
+ exit 1
+fi
+
+denvexec up -d
+$SCRIPT_DIR/bin/script/foreachSystem update