4.2.1 Fork your own country configuration repository

The first step towards configuring your own country configuration of OpenCRVS is to fork our existing country configuration based on our demonstration country Farajaland - Repo: opencrvs-countryconfig. the following steps help you change the cloned Farajaland repo into your own country configuration fork.

  1. When you ran the bash setup.sh script in step 3.1.2 to install OpenCRVS locally, the country configuration repo for Farajaland was cloned into the same parent directory as opencrvs-core, as you are probably aware. The first thing that you want to do is to change the name of the cloned opencrvs-countryconfig directory to something like "opencrvs-<your country>".

  2. Next, we strongly recommend that you create or use an existing organisation account on Github for storing your country configuration fork so that you can share access amongst your internal team safely.

  3. Create a new, private Git repository named the same as your new directory, ie: "opencrvs-<your country>" on your organisation's account on Github.

  4. Copy the Git URL to this repository, e.g. https://github.com/<your organisation>/opencrvs-<your country>.git

  5. In Terminal, cd inside your local directory for the country configuration, opencrvs-<your country>. If you run git remote -v inside this directory you should see that the origin Git URLs are still pointing to our Farajaland repo. We need to point these origin URLs to your repo. To do that, run this command:

git remote set-url origin git@github.com:<your organisation>/opencrvs-<your country>.git
  1. You can check that the origin URLs have changed successfully by running git remote -v again.

  2. Ensure that you are on the master branch of the country configuration folder: git checkout master

  3. Run git push to push the example Farajaland code to your repo. Once the files are pushed you should see the country configuration code on your own Github repo.

  4. We strongly recommend that you set up a Gitflow branching strategy on your repo to ensure that you can develop features on feature branches, merge them into develop for testing and main or master for releases. Therefore create a companion develop branch that you will use for developing the rest of your configuration: git checkout -b develop & then push that code up to your new repository with git push

  5. It is very important that you configure branch protection rules on your master, develop and main branches as these branches should not be able to be pushed to by any developer without a pull request for code review.

It's up to your team to decide how you wish to manage pulling future release code from our countryconfig / "farajaland" repo. 2 example strategies are explained below.

Strategy 1:

  1. Add in our countryconfig repo as a new remote and call it 'upstream'

git remote add upstream git@github.com:opencrvs/opencrvs-countryconfig.git
  1. Maintain a new branch that you use to pull in latest releases. You can use this to review changes in a pull request before fixing conflicts.

// when you are ready to upgrade

git checkout -b upstream-master
git pull upstream master
git push --set-upstream origin upstream-master

// review conflicts on github
// fix conflicts and merge into develop for QA
// merge into your main/master for Production

Strategy 2:

  1. Add in our countryconfig repo as a new remote named 'upstream'

git remote add upstream git@github.com:opencrvs/opencrvs-countryconfig.git
  1. Set up dedicated default branches that you use, such as: master-<your country code>, develop-<your country code> .

git checkout -b master-<your-country-code>
git push --set-upstream origin master-<your-country-code>
git checkout -b develop-<your-country-code>
git push --set-upstream origin develop-<your-country-code>
// set your defaults to these branches with branch protection rules

// When you are ready to upgrade
git checkout master
git pull upstream master
git push origin master

// open PRs from master into your develop-<your-country-code> branch
// fix conflicts and merge into develop-<your-country-code> for QA
// merge into your master-<your-country-code> branch for Production

Following best practices, we recommend that you setup branch protection rules so that no developer can push code to your important branches without a pull request

Last updated