A tool to configure an ecosystem of multiple projects from multiple repos, typically for a feature testing process.
Frequently in either testing or in a developer set up it is necessary to have several sites co-locate and exist together. This could be a Front end site in Vue, Angular, React or Quasar with a CF or other server side language. These are more likely in different repos. It's also a feasible scenario that someone will need to easily and quickly set up a site which needs to change branches quickly whether it be for QA or other purposes.
Ecosystem Testing makes that fairly straightforward and even includes some built in Docker support. Once configured, the configuration file can be shared to make replicating it easy. It also accomodates
Use CommandBox and install using box install ecosystemTesting
- Create a folder to house the project. Each of the sites will be set up in a subfolder from here.
- From CommandBox run
ecosystemTesting configure
- Give the project a name ( typically one word )
- Give the project a root folder ( defaults to the current directory )
- Enter your repo username (This remains in the CommandBox config and is not written to the project files.)
- Enter your repo Personal Access Token (This also stays in the CommandBox config and is not written to the project files.)
- Walk through the project setup and when asked to "Set Up Site", type "y".
- Choose the type of repository for this site. (i.e. gitlab, github ).
- Enter the name of the repository (this is the entire path aside from the domain i.e. in https://gitlab.com/project/repo it would be project/repo.)
- Enter the parent branch. This is the branch from which your feature branches branch. In the format of "origin/dev" if you want the source to be from the server.
- Enter the subfolder where this site will be hosted, (i.e. "api").
- Enter the URL used to access this site. Do not include the port (i.e. http://localhost, http://myapi.local)
- Enter the port to access the site (i.e. 3000,8080)
- Enter the files which need to be moved from the envFolder to the site. See section on envFolder below. The format here could be "api.env:.env, api.cfconfig.json:.cfconfig.json"
- Choose the Language (this is not really essential and might be deleted later. )
- Enter a comma delimited list of script elements which should run after the branch has been pulled. See the section on Post Install Scripts below
- Enter the name of a docker container for this site. Leave blank for none.
Once all the sites are configured you can refresh all or part of the ecosystem.
- Run
ecosystemTesting refreshEcosystem _projectname_
This will display a list of the sites in this project. - Use the spacebar to toggle which sites to refresh.
- Enter the branches for each site to be pulled.
- Choose whether the branch should be "evergreen" (refreshed from the parent branch) before testing.
- Watch the process, tweaking any scripts that need it.
Each time a site is refreshed it follows this cycle:
- Information about the site is retrienved from both CommandBox and the ecosystemTesting.json file in the root of the project
- The system attempts to stop and forget any servers in the site's folders.
- All files and folders in the site folder are deleted
- The site is cloned from the repo and switched into the desired branch
- If the site is to be "evergreened" it attempts to merge the source branch into the target branch.
- Any files are copied from the envFolder to the site
- Any scripts are run
- If there is a docker container specified as part of the site config, "docker restart comancontainername"
Ecosystem Testing contains a folder called "envFolder" which can house any files (i.e. .env, .cfconfig etc) which would be overwritten or deleted when a site is pulled but the need for the local configuation doesn't go away. When a site is "refreshed" the contents of the folder are completely deleted to ensure that it is "clean" for the next test. During a site setup, you can specify the files to me copied from this envFolder to the local site.
After the site is pulled (See the section on Life Cycle) the system will loop over the list in the scripts node. These are run from CommandBox but elements outside of CommandBox can be run by putting an ! in front of the command. For example: Example script for a JS site "!yarn install", "!docker rm controlSite", "!docker-compose build controlSite"
To run an external file either use something like recipe myScript.boxr
, !myScript.bat
or !bash myScript.sh
.
0.0.81 - made the parent branch for evergreening an option at run time
0.0.80 - fixed typo in createDatasource
0.0.79 - Added commandbox-cbdatasource as dependency; fixed issue in creating datasource immediately after adding database settings.
0.0.78 - Fixed problem with binary files being corrupted during the upload to S3
0.0.74 - Added TRY CATCH to the restore db statement
0.0.73 - renamed variables in restore to make directions clearer.
0.0.70 - Added slash directions for different OS
0.0.69 - added DB support
0.0.68 - added force rebuild of JS sites
0.0.67 - post install restart of docker edited
0.0.65 - better handling for project data for projects which don't exist
0.0.64 - added post install script to add config.modules.ecosystemTesting.installed=true
0.0.63 - updated command namespace to ecosystemTesting
0.0.62 - Fixed path for github sites; added commandPrefix to add sudo
for linux installations.
0.0.61 - Scripted an automatic commit message when evergreening the branch
0.0.60 - fixed typo in error messaging
0.0.59 - really added sudo to ALL linux commands
0.0.58 - added sudo to all linux commands