Integrating Crafter CMS with BitBucket

This section details how to create a new project in BitBucket and then start a new project in Crafter CMS in a way that connects to BitBucket as an upstream remote repository.

Create a New Project and Connect it to BitBucket

Step 1: Create a Project in BitBucket

How-Tos - Create a project in BitBucket

Figure 1: Create a project in BitBucket

  1. Create project

  2. Enter your project name

  3. Choose your security level

  4. Do not initialize the repository with a readme

  5. Click create site

  6. Once your repository is created you will see a screen similar to the one below. You want to make note of the Git URL for the site. You will need this URL in the next step.

How-Tos - New project in BitBucket

Figure 2: New Project in BitBucket

Step 2: Create Your Project In Crafter Studio

Next, you want to log in to Crafter Studio as the admin user. The admin user has the rights to create new projects (called sites.) Click Create Site.

How-Tos - Site screen in Crafter Studio

Figure 3: Create site via Crafter Studio

Clicking Create Site will present you with the Create Site dialog. This dialog changes depending on what you choose. Below is an example of the dialog filled out in a way that creates your project locally, set the BitBucket repository as its upstream remote and pushes the initial project contents to the upstream repository.

Let’s walk through each part of the dialog:

How-Tos - Create Site Dialog Walk Through

Figure 4: Create Site Dialog in Crafter Studio, populating a bare upstream Git repository

  1. The first thing you need to do is give your site an ID. The ID itself doesn’t matter in a sense. It doesn’t need to match anything per se, technically speaking the only requirement is that it’s unique. That said, it’s a best practice to provide an ID that is meaningful/recognizable to the team. If your website is called Sweet.com a good ID might be “sweetdotcom”

  2. Next, because you plan to connect this project to an upstream repository you want to click the plus (+) on “Link to upstream remote Git repository” This will open a number of new fields.

  3. In the “Remote Git Repository Name” field you want to provide a repository name that makes sense. It’s common to use “origin” or “upstream.”

  4. In the “Remote Git Repository URL” field you must provide the link to the Git repository discussed in Step #1: https://myuser@bitbucket.org/myuser/mysweetdotcom.git

  5. Provide your credentials in Git Remote Repository Username and Password

  6. Choose the option: “Create site based on blueprint then push to remote bare repository.” This means that Crafter Studio will create a new site based on the blueprint you choose, link the remote repository as an upstream and then once the blueprint is installed in the local Repositories it will be pushed automatically to the upstream remote.

  7. Choose your blueprint. There are several out of the box blueprints provided by default. Choose one of these or one of your own. For our example, we’ll choose Editorial which is the simple Article style website/project template.

  8. Click Create. Crafter CMS will create the local repositories, Solr core and internal data structures required to support the project and install the blueprint. Once complete it will connect to the upstream and push the contents of the Sandbox repository to the remote.

How-Tos - Crafter Studio Home Page Preview

Figure 5: Site is created and the contents of the sandbox are automatically pushed to the upstream repository

Step 3: Check BitBucket to Make Sure Your Site is There

Go back to your BitBucket project and refresh the screen. You will see the contents of your CMS project in the repository.

How-Tos - BitBucket project created

Your project is there!

Pushing and Pulling from the Remote Repository

Crafter Studio helps you manage and interact with your remote repositories via the user interface and via API. Using Crafter Studio’s remote repositories console, you can add any remotes to the project you like and sync with them via pull and push operations at any time.

How-Tos - Pushing and Pulling from the Remote Repository

Now you are ready to set up your entire development process and CI/CD automation.

Creating a Project in Crafter CMS Based on an Existing BitBucket Project

Let’s consider for a moment that you’re a new developer joining the team. The topology above is already set up and you just want to get a local environment up and going. Simple. Follow these instructions.

  1. Install Crafter Studio locally (Source build or Binaries bundle)

  2. Login as Admin

  3. Click Create Site

  4. Fill out the Create Site Form as in a similar fashion described in Step 2, except this time you chose the option to create your site based on an existing upstream repository. This can be your team’s branch or your own fork. The exact workflow is up to you.