diff --git a/1deployMatsenApi.sh b/1deployMatsenApi.sh index e859a77..169c8f0 100644 --- a/1deployMatsenApi.sh +++ b/1deployMatsenApi.sh @@ -3,6 +3,13 @@ TARGET_PATH="/var/www/crm-api/httpdocs" GIT_PATH="/var/www/matsen-git-repository/matsen-tool-be" +create_directories() { + # Erstelle notwendige Verzeichnisse falls sie nicht existieren + mkdir -p ${TARGET_PATH}/config + mkdir -p ${TARGET_PATH}/public + mkdir -p ${TARGET_PATH}/var/cache +} + copy_files() { cd ${GIT_PATH} sudo GIT_SSH_COMMAND="ssh -i /home/service-spawntree/.ssh/id_rsa -p 1122" git pull @@ -12,6 +19,9 @@ copy_files() { CONFIG_DIRS="packages routes" ROOT_DIRS="bin migrations src" + # Erstelle zuerst alle notwendigen Verzeichnisse + create_directories + rm -rf ${TARGET_PATH}/composer.lock rm -rf ${TARGET_PATH}/composer.json cp -rf ${GIT_PATH}/composer.json ${TARGET_PATH} @@ -31,8 +41,10 @@ copy_files() { cp -rf ${GIT_PATH}/$dir ${TARGET_PATH}/ done + # Stelle sicher, dass der public Ordner existiert + mkdir -p ${TARGET_PATH}/public rm -rf ${TARGET_PATH}/public/index.php - cp -rf ${GIT_PATH}/public/index.php ${TARGET_PATH}/public + cp -rf ${GIT_PATH}/public/index.php ${TARGET_PATH}/public/ echo "$(tput setab 2)Files have been copied$(tput sgr 0)" }