CrafterCMS is a modern content management platform for building digital experience applications including:
- Single Page Applications (SPAs) using frameworks like React, Vue, and Angular
- Native mobile apps and headless applications (IOT, digital signage, wearables, etc.)
- HTML5 websites using Bootstrap or other HTML frameworks
- e-commerce front-ends
- OTT video experiences on AWS Elemental Media Services
- AR/VR applications using A-Frame
You can learn more about CrafterCMS here: https://craftercms.org.
Try CrafterCMS using a pre-built AMI (use the authoring
AMI): https://aws.amazon.com/marketplace/seller-profile?id=6d75ffca-9630-44bd-90b4-ac0e99058995
Download a pre-built binary archive here: https://craftercms.org/downloads.
Read the docs here: https://docs.craftercms.org/current
This repository is for developers interested in contributing to CrafterCMS, customizing their own release, or building the latest. This parent project helps you build the following:
- Deployable CrafterCMS binaries
- Docker images
- Developer's environment so you can compile and contribute to CrafterCMS
WARNING: CrafterCMS source code development and building is only supported on Unix based systems. If you want to use CrafterCMS in Windows, use Docker or install Windows Subsystem for Linux (WSL) by following the instructions here then use the WSL 2 terminal for all the commands below.
Please make sure your system meets the prerequisites: https://docs.craftercms.org/current/by-role/system-admin/installation.html#requirements
Let's begin :)
If you're building deployable CrafterCMS binaries, we'll clone the master branch:
git clone -b master https://github.com/craftercms/craftercms.git
OR
If you would like to contribute to CrafterCMS, to build a developer's environment, we'll need to clone the develop branch (default):
git clone -b develop https://github.com/craftercms/craftercms.git
For more information on CrafterCMS Git Workflow, please review: https://github.com/craftercms/craftercms/blob/master/GIT_WORKFLOW.md
download
Download dependenciesclone
Clone CrafterCMS modulesselfUpdate
Update the parent project (craftercms
)update
Update modulesclean
Clean modulesbuild
Build modulesdeploy
Deploy modulesupgrade
Upgrade modules (same asupdate
,clean
,build
,deploy
)start
Start CrafterCMSstop
Stop CrafterCMSstatus
Report status on running environments if anybundle
Create deployable binariesbuildAuthoringTomcat
Build an authoring Docker imagebuildDeliveryTomcat
Build a delivery Docker imagebuildDeployer
Build a deployer Docker imagebuildGitSshServer
Build a Git SSH server Docker imagebuildGitHttpServer
Build a Git HTTP server Docker imagebuildLogRotate
Build a LogRotate Docker imagebuildMainImages
Build the main Docker imagesbuildAllImages
Build all the Docker imagesdeleteDockerArtifacts
Delete all Docker artifacts (CrafterCMS and non-CrafterCMS, including containers, images, and volumes)
overwriteChangedFiles
: Update and overwrite the deployed environment (authoring or delivery) files (binaries, configuration, etc.), defaulttrue
refreshEnv
: Update the deployed environment (authoring or delivery) with any changes to the scripts, defaultfalse
overwriteArtifact
: Update and overwrite the downloaded artifacts (example: OpenSearch, Tomcat, ...) that's cached in the downloads folder by downloading it again, defaultfalse
gitRemote
: Git remote name to use in cloned modules, defaultorigin
gitBranch
: Git branch to use when cloning modules, defaultdevelop
(for develop branch)gitUrl
: Which Git URL to use, defaulthttps://github.com/craftercms/
socialRequired
: Include Social in the build, defaultfalse
profileRequired
: Include Profile in the build, defaultfalse
startSearch
orwithSearch
: start OpenSearch, defaulttrue
startMongoDB
: start MongoDB, defaultfalse
unless Profile or Social are enabled. This is automatic.unitTest
: Run unit tests during build, defaultfalse
shallowClone
: Clone only the latest commits and not the entire history (faster, but you lose history), defaultfalse
bundlesDir
: Where to deposit binaries, default./bundles
downloadGrapes
: Download Grapes ahead of time (useful when no public Internet is available), defaultfalse
downloadDir
: Where to store downloads, default./downloads
authoringEnvDir
: Where to store the authoring environment, default./crafter-authoring
deliveryEnvDir
: Where to store the delivery environment, default./crafter-delivery
currentPlatform
: What platform to build to (linux
ordarwin
), default is the build machine's OScurrentArch
: What arch to build to (aarch64
orx86_64
), default is the build machine's archpushDockerImages
: Push the Docker images to DockerHub (if you have the right permissions), defaultfalse
tagDockerImages
: Tag the Docker images with the tag provided (if you have the right permissions), default is not to tagrootlessDockerImages
: Docker images without using root at runtime, defaultfalse
dockerTag
: Tag used to build a Docker image, typically the version number, e.g.4.2.0
dockerAuthoringBundle
: Use to point to an external authoring bundle from which to build the Docker images. This can be a remote URL, a local.tar.gz
file path, or an expanded bundle path.dockerDeliveryBundle
: Use to point to an external delivery bundle from which to build the Docker images. This can be a remote URL, a local.tar.gz
file path, or an expanded bundle path.
To build deployable and distributable binaries of CrafterCMS, use the Gradle task bundle
. This task will generate .tar.gz
files ready to be deployed to any system.
Before using bundle
task make sure that the environment has been created and deployed using gradle tasks build
and deploy
Archives will be named crafter-cms-${environment}-VERSION.tar.gz
and can be found in the bundles
folder.
./gradlew build deploy bundle
To run CrafterCMS from the binary archive, unzip and follow the instructions in the binary archive's README.txt
.
CrafterCMS is a decoupled CMS, and that means you have an authoring
environment that caters to content creators, and a different environment, delivery
, that handles the end-users that use the experience created by the former.
To build a binary archive for a specific environment:
./gradlew bundle -Penv=authoring
Archive will be named crafter-cms-authoring-${version}.tar.gz
and can be found in the bundles
folder.
For the delivery
environment, simply substitute the env=authoring
with env=delivery
.
To download, build and generate a binary archive from a given tag or branch of the source code,
- Clone the branch/tag of craftercms that you want to work with
git clone -b <tag or branch> https://github.com/craftercms/craftercms/
- Download, build and bundle the tag/branch that you want to work with
./gradlew build deploy bundle
NOTE: When using a tag-based build, you're essentially cloning a point in time to build that specific version of CrafterCMS. That implies that you won't be able to update/nor push changes back.
CrafterCMS comprises a number of headless API-first (GraphQL, REST, in-process) modules that work together to provide the final solution. In this section, we'll start with the simple case of build everything/run everything, and then move on to building/hacking individual modules.
Build all CrafterCMS modules
./gradlew build deploy
Start CrafterCMS,
./gradlew start
You can now point your browser to http://localhost:8080/studio and start using CrafterCMS. To get started with your first CrafterCMS experience, you can follow this guide: Your First Templated Project or Your First Headless Project.
NOTE: * The authoring environment runs on port
8080
, a great place to start, while the delivery environment runs on port9080
.
Stop CrafterCMS,
./gradlew stop
You might have noticed that you essentially have two environments built and running: authoring
and delivery
. CrafterCMS is a decoupled CMS, and that means you have an authoring
environment that caters to content creators, and a different environment, delivery
, that handles the end-users that use the experience created by the former.
As a developer, you can use an authoring
environment for most tasks without the need to run a delivery
environment. It's important to note that delivery
essentially runs the same software that's in authoring
except Crafter Studio (the authoring tools).
By default, this project will build both environments unless instructed otherwise. The authoring
environment runs at http://localhost:8080/studio, whereas the delivery
environment runs at http://localhost:9080/.
To build, start and stop one of the two environments is similar to building/starting/stopping All.
./gradlew build deploy -Penv=authoring
./gradlew start -Penv=authoring
./gradlew stop -Penv=authoring
./gradlew build deploy -Penv=delivery
./gradlew start -Penv=delivery
./gradlew stop -Penv=delivery
The mechanics for working with a single module are similar to working with all, with one exception: You can deploy a module to one or both environments (authoring
/delivery
).
CrafterCMS comprises the following modules:
You'll find these projects checked out and ready for you to contribute to in the folder src/{modules}
.
Start by forking the module you want to work on. You can follow the GitHub instructions.
The next step is to switch the origin url location to be the one just forked, to do so you can use these GitHub instructions.
The last step will be to add an upstream repository from the main craftercms
repo to your own. Follow these steps
to make it happen.
You can now work in your local system, and build/deploy and ultimately push to your fork. We welcome code contributions, so please do send us pull-requests.
To update your project with the latest:
./gradlew update
You can update, build, deploy, start or stop a module by:
./gradlew update -Pmodules=studio
./gradlew build -Pmodules=studio
./gradlew deploy -Pmodules=studio -Penv=authoring
./gradlew start -Pmodules=studio -Penv=authoring
./gradlew stop -Pmodules=studio -Penv=authoring
NOTE: * If you don't specify the
env
parameter, it means all environments (where applicable). * In the current version of CrafterCMS, some services run in the same Web container, and that implies the stopping/starting of one of these services will cause other services to stop/start as well.
For more detailed information and advanced topic, please visit the detailed documentation.
CrafterCMS has two environments, the Authoring Environment and the Delivery Environment.
The authoring environment provides all the content management services, enabling authoring, managing and publishing of all content. It provides a comprehensive set of user-friendly features for managing and optimizing your experiences.
The delivery environment provides content delivery services. It consumes content published from your authoring environment and provides developers with the foundation for quickly building high-performance, flexible experiences.
In this section we will be discussing the scripts for the authoring and delivery environments.
The CrafterCMS Authoring and Delivery scripts will help you on the basic startup and shutdown of the services needed to run a healthy Authoring environment and Delivery environment with the following scripts:
Script | crafter.sh |
---|---|
Description | Main Script to start and stop all needed Services to have a functional CrafterCMS Authoring/Delivery Environment To log the output of the script to a file, set the environment variable CRAFTER_SCRIPT_LOG to point to a log file |
Synopsis | crafter.sh start |stop |debug |help |
Arguments | start [withMongoDB] [skipSearch] [skipMongoDB] [tailTomcat] Starts all CrafterCMS services in this order: Crafter Deployer, OpenSearch, Apache Tomcat If withMongoDB is specified MongoDB will be started.If skipSearch is specified OpenSearch will not be started.If skipMongoDB is specified MongoDB will not be started even if the Crafter Profile war is present.If tailTomcat is specified, Tomcat will be tailed and Crafter will shutdown when the script terminates.stop Stops all CrafterCMS services in the same order as they start.debug [withMongoDB] [skipSearch] [skipMongoDB] Starts all CrafterCMS services with the JAVA remote debug port 5000 for Crafter Deployer, and 8000 for Apache Tomcat for the Authoring Environment Starts all CrafterCMS services with the JAVA remote debug port 5001 for Crafter Deployer, and 9000 for Apache Tomcat for the Delivery Environment If withMongoDB is specified MongoDB will be started.If skipSearch is specified OpenSearch will not be started.If skipMongoDB is specified MongoDB will not be started even if the Crafter Profile war is present.start_deployer Starts Deployerstop_deployer Stops Deployerdebug_deployer Starts Deployer in debug moderestart_deployer Restarts Deployerstart_search Starts OpenSearchstop_search Stops OpenSearchdebug_search Starts OpenSearch in debug moderestart_search Restarts OpenSearchstart_tomcat Starts Apache Tomcatstop_tomcat Stops Apache Tomcatdebug_tomcat Starts Apache Tomcat in debug moderestart_tomcat Restarts Apache Tomcatrestart_debug_tomcat Restarts Apache Tomcat in debug modestart_mongodb Starts MongoDBstop_mongodb Stops MongoDBrestart_mongodb Restarts MongoDBstatus Prints the status of all CrafterCMS subsystemsstatus_engine Prints the status of Crafter Enginestatus_studio Prints the status of Crafter Studiostatus_profile Prints the status of Crafter Profilestatus_social Prints the status of Crafter Socialstatus_deployer Prints the status of Crafter Deployerstatus_search Prints the status of OpenSearchstatus_mariadb Prints the status of MariaDbstatus_mongodb Prints the status of MongoDBbackup <name> Perform a backup of all datarestore <file> Perform a restore of all dataupgradedb Perform database upgrade (mariadb-upgrade) |
Synopsis | startup.sh |
---|---|
Description | Starts all needed Services to have a functional CrafterCMS Authoring/Delivery Environment |
Synopsis | shutdown.sh |
---|---|
Description | Stops all needed Services to have a functional CrafterCMS Authoring/Delivery Environment |
Synopsis | debug.sh |
---|---|
Description | Starts all needed Services to have a functional CrafterCMS Authoring/Delivery Environment with the JAVA remote debug ports open and listening port 5000/5001 for Crafter Deployer, and 8000/9000 for Apache Tomcat |
Script | deployer.sh |
---|---|
Description | Script located in $CRAFTER_HOME/bin/crafter-deployer which will start,stop Crafter Deployer for the Authoring/Delivery environment |
Synopsis | deployer.sh start |stop |debug |help |
Arguments | start Starts all CrafterCMS services in this order Crafter Deployer OpenSearch, Apache Tomcatstop Stops all CrafterCMS services in the same order as they start.debug Start all CrafterCMS services with the JAVA remote debug port 5000 for Crafter Deployer, and 8000 for Apache Tomcat for the Authoring Environment Starts all CrafterCMS services with the JAVA remote debug port 5001 for Crafter Deployer, and 9000 for Apache Tomcat for the Delivery Environment help Prints script help |
For more information on environment variables used by crafter.sh
, see CrafterCMS Environment Variables
Let's look at an example on how to start an authoring environment using the scripts we discussed above. To start the authoring environment, go to your CrafterCMS install folder then run the following:
cd crafter-authoring
./startup.sh
What the above does is go to your authoring environment folder, then run the startup script.
To stop the authoring environment:
./shutdown.sh
For more information about Apache Tomcat, and OpenSearch please refer to the following:
As we have seen in the getting started section above, to run a gradle task, we run the following from the root of the project:
./gradlew command [-Penv={env}] [-Pmodules={module}]
Here's a list of commands (Gradle tasks) available:
Commandcommand |
Description | Env Optionsenv |
Module Optionsmodule |
---|---|---|---|
clone | Clones CrafterCMS |
|
|
build | Build module/s or an entire environmentNote:: build will clone if needed |
authoring delivery |
|
deploy | Deploy module/s or an entire environment | authoring delivery |
|
bundle | Build deployable and distributable binaries | authoring delivery |
|
start | Start CrafterCMS | authoring delivery |
|
stop | Stop CrafterCMS | authoring delivery |
|
update | Update a module or modules |
|
|
upgrade | Upgrades the installed Tomcat version, etc, without deleting your data then builds and deploys |
|
|
selfupdate | Updates the CrafterCMS project (gradle) |
|
|
clean | Delete all compiled objects |
|
|
NOTE: * If you don't specify the
env
parameter, it means all environments (where applicable). * In the current version of CrafterCMS, some services run in the same Web container, and that implies the stopping/starting of one of these services will cause other services to stop/start as well. * The Gradle task propertymodules
accepts one or multiple module/s, separated by commas like this:./gradlew build -Pmodules=search,studio
* Theclean
command does not delete previously built environment folderscrafter-authoring
andcrafter-delivery
. To build a fresh copy of these two, backup your custom data and delete both folders manually.
Let's see some examples of running Gradle tasks here.
To build the authoring and delivery environments, run the following:
./gradlew build
The Gradle task above will:
-
Download the dependencies
-
Build all CrafterCMS modules from the source (check the section on how to update the source)
crafter-authoring
crafter-delivery
To build a module (all module options for task build
are listed in the table above), run the following (we'll build the module studio in the example below):
./gradlew build -Pmodules=studio
To build an environment, run the following (we'll build the authoring environment in the example below:
./gradlew build -Penv=authoring
To start an environment, run the following:
./gradlew start [-Penv={env}]
For an alternative to start an environment, run the following:
cd crafter-{env}
./startup.sh
The options above will:
For the Authoring Environment:
- The above will start the authoring environment with the default port 8080
For the Delivery Environment:
- The above will start the delivery environment with the default port 9080
Here's an example starting a delivery environment:
./gradlew start -Penv=delivery
To stop an environment, run the following:
./gradlew stop [-Penv={env}]
For an alternative to stop an environment, run the following:
cd crafter-{env}
./shutdown.sh
The Gradle task bundle
will build deployable and distributable binaries of CrafterCMS for the authoring and/or delivery environments. This will generate tar files ready to be unarchived and run.
./gradlew bundle [-Penv={env}]
Binaries will be saved as crafter-cms-authoring-VERSION.tar.gz
for the Authoring Environment and crafter-cms-delivery-VERSION.tar.gz
for the Delivery Environment in the bundles
folder
Using the common task property env
lets you select what environment (authoring or delivery) will be generated.
Let's look at an example using the task property mentioned above:
./gradlew bundle -Penv=authoring
The command above will generate an authoring binary archive in the bundles folder named crafter-cms-authoring-VERSION.tar.gz
.