-
Notifications
You must be signed in to change notification settings - Fork 34
Link an extending site to a Git repository
When creating a customized environment for a specific brigade, you want to maintain a layer of overrides for laddr instead of forking laddr. This layer of files should be versioned in its own Git repository independently of any fork of laddr you might always want to have.
For this example, we'll walk through configuring Open Charlotte Brigade's existing set of customizations made on their staging site (which extends v2.laddr.us
) to start being synced with a Git repository.
This process is a bit of a mess currently and will be done fundamentally differently in the next deployment system.
The first step is to create a new config file, named after your repository, to map some files in your instance to git. For example, php-config/Git.config.d/open-charlotte.php
:
<?php
Git::$repositories['open-charlotte'] = [
'remote' => '[email protected]:OpenCLTBrigade/brigade-laddr.git',
'originBranch' => 'master',
'workingBranch' => 'master',
'trees' => [
'event-handlers',
'html-templates',
'php-classes',
'php-config/Git.config.d',
'php-config/Laddr.config.d',
'php-config/RemoteSystems/Twitter.config.php',
'php-config/Session.config.php',
'site-root'
]
];
Here we create a whitelist of paths we want to sync to the git repository. By default, only local files will be included (i.e. none being inherited from v2.laddr.us
). You generally want to version everything in your override layer and just list entire roots, but often for the php-config
root you may want to either only whitelist a few configs, or list the whole root and add a few exclude patterns to keep API keys out of git so the repo can be public.
Now go to /site-admin/sources
on the site and you'll see the newly-defined open-charlotte
(or your own name) in the list. Click on that and you'll nee the uninitialized repository screen:
- Click Initialize Repository.
- When presented with a randomly generated SSH key pair, install the public key as a read/write deploy key to the Git repository.
- Look at the now initialized source page, click Sync->Update git working tree
- Select all the unstaged files and click Stage Selected
- Write a commit message and click Commit
- Click Push
From this screen, you can commit and push changes made in the instance out to Git, and pull updates in from git. If you end up outside the simple git workflow the web UI can provide for, SSH into the host machine and run emergence-git-shell mysite mysource
to drop into a full git shell with authentication to push.