From 1fe9398b0dd1a96e0fd418d7fb1ebb67bb03dbbd Mon Sep 17 00:00:00 2001 From: Rafael Fernandes <87442654+rfernandes-sugarcrm@users.noreply.github.com> Date: Mon, 2 Dec 2024 14:09:51 -0500 Subject: [PATCH] Replaced toothpaste with simpleRepair and fix tests (#20) * Replaced toothpaste with simpleRepair and fix tests * Added sugar folder * Fixed docker compose command * removing sugar9 workflows no longer supported --- .github/workflows/sugar9.yml | 22 ---------------------- README.md | 16 ++++++++-------- data/app/sugar/.gitkeep | 0 stacks/reverseproxy/README.md | 2 +- tests/stop.sh | 4 ++-- tests/web_tests.sh | 14 +++----------- utilities/repair.sh | 7 ++++++- utilities/stack.sh | 6 +++--- 8 files changed, 23 insertions(+), 48 deletions(-) delete mode 100644 .github/workflows/sugar9.yml create mode 100644 data/app/sugar/.gitkeep diff --git a/.github/workflows/sugar9.yml b/.github/workflows/sugar9.yml deleted file mode 100644 index 80403609d..000000000 --- a/.github/workflows/sugar9.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: -on: - #push: - # branches: [ master, dev ] - push: - tags: - - 'v*' -jobs: - tests: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - run: ['stacks/sugar9/php73.yml', 'stacks/sugar9/php73-mac.yml', 'stacks/sugar9/php73-local-build.yml', 'stacks/sugar9/php73lb.yml'] - steps: - - run: sudo sysctl -w vm.max_map_count=262144 - - run: echo '127.0.0.1 docker.local' | sudo tee -a /etc/hosts - - uses: actions/checkout@v1 - - run: cp -r ./tests/web_tests ./data/app/sugar/ - - run: ./tests/start.sh ${{ matrix.run }} - - run: ./tests/web_tests.sh ${{ matrix.run }} 9.0 7.3 - - run: ./tests/stop.sh ${{ matrix.run }} diff --git a/README.md b/README.md index 195ec77c0..6dfab9ad2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Sugar Dockerized [![Build Status](https://github.com/sugarcrm-developers/SugarDockerized/actions/workflows/sugar12.yml/badge.svg)](https://github.com/sugarcrm-developers/SugarDockerized/actions/workflows/sugar12.yml) [![Build Status](https://github.com/sugarcrm-developers/SugarDockerized/actions/workflows/sugar13.yml/badge.svg)](https://github.com/sugarcrm-developers/SugarDockerized/actions/workflows/sugar13.yml) +# Sugar Dockerized [![Build Status](https://github.com/sugarcrm-developers/SugarDockerized/actions/workflows/sugar12.yml/badge.svg)](https://github.com/sugarcrm-developers/SugarDockerized/actions/workflows/sugar12.yml) [![Build Status](https://github.com/sugarcrm-developers/SugarDockerized/actions/workflows/sugar13.yml/badge.svg)](https://github.com/sugarcrm-developers/SugarDockerized/actions/workflows/sugar13.yml) [![Build Status](https://github.com/sugarcrm-developers/SugarDockerized/actions/workflows/sugar14.yml/badge.svg)](https://github.com/sugarcrm-developers/SugarDockerized/actions/workflows/sugar14.yml) This repository will help you deploy a Docker based **development only** full stack for Sugar, meeting all the platform requirements for a different set of platform combinations. @@ -11,7 +11,6 @@ If you find this software useful, please consider supporting the work that went ## Requirements * linux platform - it can be a virtual machine * docker -* docker-compose * curl * rsync * zip @@ -21,12 +20,13 @@ If you find this software useful, please consider supporting the work that went ## Stacks available There are few stacks available, with in itself multiple platform combinations. You can read more about the specific stacks on the links below: -* [Sugar 13](stacks/sugar13/README.md) - This stack is valid from version 13 for local developement also of Sugar Cloud only versions -* [Sugar 12](stacks/sugar12/README.md) - This stack is valid from version 12 for local developement also of Sugar Cloud only versions -* [Sugar 11](stacks/sugar11/README.md) - This stack is valid from version 11 for local developement also of Sugar Cloud only versions +* [Sugar 14](stacks/sugar14/README.md) - This stack is valid for version 13 for local developement also of Sugar Cloud only versions +* [Sugar 13](stacks/sugar13/README.md) - This stack is valid for version 13 for local developement also of Sugar Cloud only versions +* [Sugar 12](stacks/sugar12/README.md) - This stack is valid for version 12 for local developement also of Sugar Cloud only versions +* [Sugar 11](stacks/sugar11/README.md) - This stack is valid for version 11 for local developement also of Sugar Cloud only versions You will find additional stacks within the [stack directory of the project](stacks). -For most stacks, there are both the pre-built version (eg on Sugar 13: `./stacks/sugar13/php82.yml`) and a locally built version (eg on Sugar 13: `./stacks/sugar13/php82-local-build.yml`). The locally built version will be built run-time, and therefore those stacks will let you specify additional changes you might require to the docker images provided. Local builds will take much longer to deploy than pre-built ones. +For most stacks, there are both the pre-built version (eg on Sugar 14: `./stacks/sugar14/php83.yml`) and a locally built version (eg on Sugar 14: `./stacks/sugar14/php83-local-build.yml`). The locally built version will be built run-time, and therefore those stacks will let you specify additional changes you might require to the docker images provided. Local builds will take much longer to deploy than pre-built ones. ### Types of stacks There are mainly three types of stack: @@ -66,7 +66,7 @@ For details about the hostnames and credentials of each of the infrastructure co * Run the utility `build/build.sh`. Read more about [build/build.sh](#buildbuildsh) ## Current version support -The main stacks work with [Sugar version 13.0 and all its platform requirements](https://support.sugarcrm.com/Resources/Supported_Platforms/Sugar_13.0.x_Supported_Platforms/). Additional stacks are aligned with the platform requirements of version [12.x](https://support.sugarcrm.com/Resources/Supported_Platforms/Sugar_12.0.x_Supported_Platforms/), [11.x](https://support.sugarcrm.com/Resources/Supported_Platforms/Sugar_11.0.x_Supported_Platforms/) and stacks for Sugar Cloud only versions for local development only. +The main stacks work with [Sugar version 14.0 and all its platform requirements](https://support.sugarcrm.com/Resources/Supported_Platforms/Sugar_14.0.x_Supported_Platforms/). Additional stacks are aligned with the platform requirements of version [13.x](https://support.sugarcrm.com/Resources/Supported_Platforms/Sugar_13.0.x_Supported_Platforms/), [12.x](https://support.sugarcrm.com/Resources/Supported_Platforms/Sugar_12.0.x_Supported_Platforms/) and stacks for Sugar Cloud only versions for local development only. ## System's details @@ -481,7 +481,7 @@ To run the repair from the docker host, assuming that the repository has been ch cd sugardocker ./utilities/repair.sh ``` -The actual code for `repair.sh` leverages the [`toothpaste.sh`](#toothpastesh) script mentioned above. +This script will use [simpleRepair.php](utilities/build/simpleRepair.php) created to QRR (repair and rebuild) local instances. The script itself will clear cache and warmup services in the local instance. ### Setup Sugar instance to leverage Redis object caching Add on `config_override.php` the following options: diff --git a/data/app/sugar/.gitkeep b/data/app/sugar/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/stacks/reverseproxy/README.md b/stacks/reverseproxy/README.md index 1344300d9..8206b5c0c 100755 --- a/stacks/reverseproxy/README.md +++ b/stacks/reverseproxy/README.md @@ -7,7 +7,7 @@ This container will help you do just that, when deployed within your OSX environ * Make sure no web server is running locally on your OSX environment, and port 80 and 8080 are not in use * Clone the git repository into your OSX environment * While leveraging this functionality, temporarily disable your OSX firewall by navigating to: System Preferences, Security & Privacy, Firewall, Turn Off Firewall -* Start the container with: `docker-compose -f stacks/reverseproxy/docker-compose.yml up -d` +* Start the container with: `docker compose -f stacks/reverseproxy/docker-compose.yml up -d` * Find out your local ip address by navigating to: System Preferences, Network and choosing the active network available in your specific scenario It would then be possible for your local network to access your Sugar environment by navigating to the url: `http:///sugar/` (make sure to add the `/` at the end of the url) diff --git a/tests/stop.sh b/tests/stop.sh index 58d049543..83c78d9a1 100755 --- a/tests/stop.sh +++ b/tests/stop.sh @@ -5,6 +5,6 @@ then exit 1 else echo Stopping environment $1 - docker-compose -f $1 down - docker-compose -f $1 rm + docker compose -f $1 down + docker compose -f $1 rm fi diff --git a/tests/web_tests.sh b/tests/web_tests.sh index 5321f0272..fd600f1ff 100755 --- a/tests/web_tests.sh +++ b/tests/web_tests.sh @@ -4,10 +4,6 @@ then echo PHP version not provided else echo Installing composer dependencies if any - # add web_tests to sugar-cron after it becomes available through 'pwd' - ./utilities/runcli.sh "pwd" - docker cp ./tests/web_tests sugar-cron:/var/www/html/sugar - ./utilities/runcli.sh "cd ./web_tests/$3/ && composer install" echo Confirming that Apache, MySQL and Elasticsearch are available @@ -29,10 +25,6 @@ else fi done - # add web_tests to sugar-web1 - docker cp ./tests/web_tests sugar-web1:/var/www/html/sugar/ - docker exec sugar-web1 chown sugar:sugar -R /var/www/html/sugar/web_tests - while [ `./utilities/runcli.sh "(echo >/dev/tcp/sugar-mysql/3306) &>/dev/null && echo 1 || echo 0"` != "1" ] ; do echo MySQL is not ready... sleeping... sleep $INTERVAL @@ -77,18 +69,18 @@ else echo Script ./web_tests/$3/test_$i.php executed successfully via CLI fi - OUTPUT_WEB=`./utilities/runcli.sh "curl -s http://sugar-web1/sugar/web_tests/$3/test_$i.php | grep ok | wc -l"` + OUTPUT_WEB=`curl -s http://docker.local/sugar/web_tests/$3/test_$i.php | grep ok | wc -l` if [ $OUTPUT_WEB != '1' ] then echo Error for web script test_$i.php echo Output: - echo `curl -s http://sugar-web1/sugar/web_tests/$3/test_$i.php` + echo `curl -s http://docker.local/sugar/web_tests/$3/test_$i.php` echo echo Retrieving complete logs from the web server: docker logs sugar-web1 exit 1 else - echo Script http://sugar-web1/sugar/web_tests/$3/test_$i.php executed successfully via web + echo Script http://docker.local/sugar/web_tests/$3/test_$i.php executed successfully via web fi done fi diff --git a/utilities/repair.sh b/utilities/repair.sh index 66f0c7787..fcf6fd5aa 100755 --- a/utilities/repair.sh +++ b/utilities/repair.sh @@ -3,4 +3,9 @@ # get into the correct directory REPO="$( dirname ${BASH_SOURCE[0]} )/../" cd $REPO -./utilities/toothpaste.sh "local:system:repair --instance ../sugar" +echo Repairing system +if [ ! -f ./data/app/sugar/simpleRepair.php ]; then + cp ./utilities/build/simpleRepair.php ./data/app/sugar +fi +./utilities/runcli.sh "php simpleRepair.php" +echo System repaired diff --git a/utilities/stack.sh b/utilities/stack.sh index d34e7b218..2fe87add4 100755 --- a/utilities/stack.sh +++ b/utilities/stack.sh @@ -48,13 +48,13 @@ else then echo The stack is already down, skipping else - docker-compose -f $STACKFILE down - docker-compose -f $STACKFILE rm + docker compose -f $STACKFILE down + docker compose -f $STACKFILE rm fi else if [ $2 == 'up' ] then - docker-compose -f $STACKFILE up -d --build + docker compose -f $STACKFILE up -d --build else echo The action $2 is not applicable fi