Skip to content

Commit

Permalink
Replaced toothpaste with simpleRepair and fix tests (#20)
Browse files Browse the repository at this point in the history
* Replaced toothpaste with simpleRepair and fix tests

* Added sugar folder

* Fixed docker compose command

* removing sugar9 workflows no longer supported
  • Loading branch information
rfernandes-sugarcrm authored Dec 2, 2024
1 parent ea9f254 commit 1fe9398
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 48 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/sugar9.yml

This file was deleted.

16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
Empty file added data/app/sugar/.gitkeep
Empty file.
2 changes: 1 addition & 1 deletion stacks/reverseproxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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://<local ip address>/sugar/` (make sure to add the `/` at the end of the url)
Expand Down
4 changes: 2 additions & 2 deletions tests/stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 3 additions & 11 deletions tests/web_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
7 changes: 6 additions & 1 deletion utilities/repair.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions utilities/stack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1fe9398

Please sign in to comment.