From e99e111032da262cceca28eac434a4b65bff4a78 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 19 Nov 2024 17:01:28 +0100 Subject: [PATCH] envirnment and update scirpt --- matsen-tool/1deployMatsenFE.sh | 65 ------------------- matsen-tool/1localdeployMatsenFE.sh | 38 +++++++++++ matsen-tool/2deployMatsenFE.sh | 36 ++++++++++ .../src/environments/environment.prod.ts | 4 +- 4 files changed, 76 insertions(+), 67 deletions(-) delete mode 100644 matsen-tool/1deployMatsenFE.sh create mode 100644 matsen-tool/1localdeployMatsenFE.sh create mode 100644 matsen-tool/2deployMatsenFE.sh diff --git a/matsen-tool/1deployMatsenFE.sh b/matsen-tool/1deployMatsenFE.sh deleted file mode 100644 index 0b66506..0000000 --- a/matsen-tool/1deployMatsenFE.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -export PATH=/opt/plesk/php/8.2/bin:$PATH; - -cd /var/www/vhosts/spawntree.de/git_repo_clones/matsen-tool-fe/ -sudo git pull - -echo "$(tput setab 2)matsen frontend has been PULLED$(tput sgr 0)" - -rm -rf /var/www/vhosts/spawntree.de/matsen.spawntree.de/httpdocs/composer.lock -#cp -rf /var/www/vhosts/spawntree.de/git_repo_clones/matsen-tool-fe/httpdocs/composer.lock /var/www/vhosts/spawntree.de/matsen.spawntree.de/httpdocs -rm -rf /var/www/vhosts/spawntree.de/matsen.spawntree.de/httpdocs/composer.json -cp -rf /var/www/vhosts/spawntree.de/git_repo_clones/matsen-tool-fe/composer.json /var/www/vhosts/spawntree.de/matsen.spawntree.de/httpdocs - -rm -rf /var/www/vhosts/spawntree.de/matsen.spawntree.de/httpdocs/config -cp -rf /var/www/vhosts/spawntree.de/git_repo_clones/matsen-tool-fe/config /var/www/vhosts/spawntree.de/matsen.spawntree.de/httpdocs - -rm -rf /var/www/vhosts/spawntree.de/matsen.spawntree.de/httpdocs/bin -cp -rf /var/www/vhosts/spawntree.de/git_repo_clones/matsen-tool-fe/bin /var/www/vhosts/spawntree.de/matsen.spawntree.de/httpdocs - -rm -rf /var/www/vhosts/spawntree.de/matsen.spawntree.de/httpdocs/migrations -cp -rf /var/www/vhosts/spawntree.de/git_repo_clones/matsen-tool-fe/migrations /var/www/vhosts/spawntree.de/matsen.spawntree.de/httpdocs - -rm -rf /var/www/vhosts/spawntree.de/matsen.spawntree.de/httpdocs/src -cp -rf /var/www/vhosts/spawntree.de/git_repo_clones/matsen-tool-fe/src /var/www/vhosts/spawntree.de/matsen.spawntree.de/httpdocs - -rm -rf /var/www/vhosts/spawntree.de/matsen.spawntree.de/httpdocs/public/index.php -cp -rf /var/www/vhosts/spawntree.de/git_repo_clones/matsen-tool-fe/public/index.php /var/www/vhosts/spawntree.de/matsen.spawntree.de/httpdocs/public - -echo "$(tput setab 2)Files have been copied$(tput sgr 0)" - -cd /var/www/vhosts/spawntree.de/matsen.spawntree.de/httpdocs -composer update --no-scripts - -echo "$(tput setab 2)COMPOSER UPDATED updated$(tput sgr 0)" - -php /var/www/vhosts/spawntree.de/matsen.spawntree.de/httpdocs/bin/console doctrine:migrations:migrate - -echo "$(tput setab 2)DATABASE SCHEMA updated$(tput sgr 0)" - -cd /var/www/vhosts/spawntree.de/ -sudo chmod 777 matsen.spawntree.de -cd /var/www/vhosts/spawntree.de/matsen.spawntree.de/ -sudo chmod 777 -R * - -cd /var/www/vhosts/spawntree.de/matsen.spawntree.de/httpdocs/var/cache/ -rm -R * - -php /var/www/vhosts/spawntree.de/matsen.spawntree.de/httpdocs/bin/console cache:clear -php /var/www/vhosts/spawntree.de/matsen.spawntree.de/httpdocs/bin/console cache:warmup - -echo "$(tput setab 2)CACHE HAS BEEN CLEARED$(tput sgr 0)" - -cd /var/www/vhosts/spawntree.de/matsen.spawntree.de/httpdocs/var/ -chmod 777 -R * -chmod 777 cache/ * -chmod 777 cache/ - -#service apache2 restart - -#echo "$(tput setab 2)CACHE cleared$(tput sgr 0)" - -echo "$(tput setab 7)$(tput setaf 1)THINK ABOUT POSSIBLE PATCHES!" - -echo "You have updated matsen api!$(tput sgr 0)" diff --git a/matsen-tool/1localdeployMatsenFE.sh b/matsen-tool/1localdeployMatsenFE.sh new file mode 100644 index 0000000..88efbae --- /dev/null +++ b/matsen-tool/1localdeployMatsenFE.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +TARGET_PATH="/var/www/crm/matsen-tool" +GIT_PATH="/var/www/matsen-git-repository/matsen-tool-fe/matsen-tool" + +create_directories() { + # Erstelle notwendige Verzeichnisse falls sie nicht existieren + mkdir -p ${TARGET_PATH}/angular +} + +copy_files() { + cd ${GIT_PATH} + sudo GIT_SSH_COMMAND="ssh -i /home/service-spawntree/.ssh/id_rsa -p 1122" git pull + echo "$(tput setab 2)matsen fe has been PULLED$(tput sgr 0)" + + CONFIG_FILES="" + CONFIG_DIRS="" + ROOT_DIRS="" + + # Erstelle zuerst alle notwendigen Verzeichnisse + create_directories + + cd ${TARGET_PATH}/angular + + # Alles außer node_modules löschen + find . -maxdepth 1 ! -name 'node_modules' ! -name '.' -exec rm -rf {} + + echo "$(tput setab 2)Client update$(tput sgr 0)" + cp -r ${GIT_PATH}/* ${TARGET_PATH}/angular + + echo "$(tput setab 2)Files have been copied$(tput sgr 0)" +} + +copy_files + +npm install +npx ng build --configuration production + +echo "You have updated matsen api!$(tput sgr 0)" \ No newline at end of file diff --git a/matsen-tool/2deployMatsenFE.sh b/matsen-tool/2deployMatsenFE.sh new file mode 100644 index 0000000..b8d032e --- /dev/null +++ b/matsen-tool/2deployMatsenFE.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +TARGET_PATH="/var/www/crm/matsen-tool" +GIT_PATH="/var/www/matsen-git-repository/matsen-tool-fe/matsen-tool" + +create_directories() { + # Erstelle notwendige Verzeichnisse falls sie nicht existieren + mkdir -p ${TARGET_PATH}/angular +} + +copy_files() { + cd ${GIT_PATH} + sudo GIT_SSH_COMMAND="ssh -i /home/service-spawntree/.ssh/id_rsa -p 1122" git pull + echo "$(tput setab 2)matsen fe has been PULLED$(tput sgr 0)" + + # Erstelle zuerst alle notwendigen Verzeichnisse + create_directories + + cd ${TARGET_PATH}/angular + + # Alles außer node_modules löschen + find . -maxdepth 1 ! -name 'node_modules' ! -name '.' -exec rm -rf {} + + echo "$(tput setab 2)Client update$(tput sgr 0)" + cp -r ${GIT_PATH}/* ${TARGET_PATH}/angular + + echo "$(tput setab 2)Files have been copied$(tput sgr 0)" +} + +copy_files + +npm install +npx ng build --configuration production + +cp -r ${TARGET_PATH}/angular/dist/* ${TARGET_PATH}/browser + +echo "You have updated matsen client!$(tput sgr 0)" \ No newline at end of file diff --git a/matsen-tool/src/environments/environment.prod.ts b/matsen-tool/src/environments/environment.prod.ts index f00161a..635403a 100644 --- a/matsen-tool/src/environments/environment.prod.ts +++ b/matsen-tool/src/environments/environment.prod.ts @@ -1,5 +1,5 @@ export const environment = { production: true, - basePath: 'https://matsen-tool-be.ddev.site:8443', - apiUrl: 'https://matsen-tool-be.ddev.site:8443/api' + basePath: 'http://crm-api.matsen.lokal/', + apiUrl: 'http://crm-api.matsen.lokal/api' };