Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
111 changes: 111 additions & 0 deletions ci/CONFIG_MANAGEMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Configuration Management Workflow

This project uses Drupal's configuration management system to track site settings (fields, content types, views, etc.) in code. The active configuration is stored in the `config/` directory at the project root.

## Initial Setup: Syncing with Production (One-Time)

When initializing the configuration directory or when you suspect severe drift, it is best to start by exporting the current production configuration to ensure your local setup matches the live site.

### 1. Export Config on Production Server
We use the `production-drush.sh` convenience script. We export to `/tmp` to avoid permission issues with the `deployer` vs `www-data` users.

```bash
ssh deployer@IP

# 1. Create a temp directory
mkdir -p /tmp/prod-config-export

# 2. Make it writable by everyone (solves www-data write permission isssues)
chmod 777 /tmp/prod-config-export

# 3. Running the export
~/production-drush.sh config:export --destination=/tmp/prod-config-export -y
```

### 2. Download to Local Machine
From your local machine (not inside the SSH session), download the files using `scp`.

```bash
# Navigate to project root
cd /path/to/interledger.org-v4

# Secure copy from the temp folder on the server
scp -r deployer@34.23.109.31:/tmp/prod-config-export/ .
```

### 3. Establish Baseline
Copy these files into your version-controlled config directory.

```bash
# Clean existing config to avoid stale files
rm -rf config/*

# Copy production files
cp -r prod-config-export/* config/
```

### 4. Apply Local Changes
Once you have the production baseline, re-apply your specific changes locally.

```bash
# Example: Disable alt text requirement
drush config:set field.field.media.image.field_media_image settings.alt_field_required 0 -y

# Export just the changes (will modify only the relevant files)
drush config:export --destination=/var/www/html/config -y
```

## Routine Workflow

For regular updates:

> [!NOTE]
> Ensure your local environment is configured to use the root `config/` directory.
> - **DDEV**: Handled automatically via `settings.php`.
> - **Custom Docker (`local/`)**: Ensure `local/docker-compose.yaml` mounts `../config` and `local/settings.php` points to `/var/www/html/config`.

1. **Make changes locally**:
- **Option A (Drupal Admin UI)**: Log in to your local site (e.g., `ddev login`), navigate to the configuration page (e.g., *Structure > Content types*), and make your changes. Save the form.
- **Option B (DDEV + Drush)**: Run `ddev drush config:set ...` commands.
- **Option C (Custom Docker + Drush)**: Run `make drush config:set ...` from the `local/` directory. If running manually inside the container, use `./vendor/bin/drush` from the project root (`/var/www/html`).
2. Run `drush config:export --destination=/var/www/html/config -y`.
3. Commit the changed YAML files to git.
4. Deploy to Staging/Production.
5. **Deployment:** The deployment process (via GitHub Actions or `make deploy`) now **automatically** runs:
- `drush config:import -y` (Configuration import)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible that this process is configured to import configuration changes only into the staging/production databases, and not into the local database?
If that is true, we need a way to import `/config' pulled from the PR into the local Db

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most likely this was the reason, I have updated the local config path so it should not pick up the tracked config

- `drush cr` (Cache rebuild)

6. **Verify:** Check the changes on the site.

> [!NOTE]
> If you need to debug or run it manually:
> ```bash
> ssh deployer@34.23.109.31
> ~/staging-drush.sh config:import -y
> ```

## Merging & Consolidating Changes

If you are working on a separate feature and want to incorporate these configuration changes, the procedure is standard Git merging for YAML files.

### Steps to consolidate:
1. **Export your current local configuration**:
- **Inside container**: `./vendor/bin/drush config:export --destination=/var/www/html/config -y`
- **Outside container**: `make drush config:export -y` (from the `local/` directory)
2. **Pull/Merge this branch**:
```bash
git pull origin <this-feature-branch>
```
- Git will merge the YAML files in the `config/` directory.
3. **Import the merged configuration**:
- **Inside container**: `./vendor/bin/drush config:import -y`
- **Outside container**: `make drush config:import -y`

> [!IMPORTANT]
> Since the `config/` directory is now at the project root, it is tracked by Git. Previously, it was buried in `web/sites/default/files/` which was ignored by `.gitignore`. This move is what allows you and the team to finally share and version-control configuration correctly.

## Performance Considerations & Future Improvements

Currently, `config:import` runs on every deployment.
- **Efficiency**: Drush first checks for differences. If no configuration files have changed, the operation is very fast (seconds) and effectively skipped.
- **Scaling**: As the site grows, if deployment times become a concern, we may strictly separate code deployment from configuration updates by moving `config:import` to a separate, manually triggered GitHub Action or Makefile target.
7 changes: 7 additions & 0 deletions ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@ These scripts automatically:
- Supply database credentials from environment variables
- Set the correct site URI

### Configuration Management

See [Configuration Management Guide](CONFIG_MANAGEMENT.md) for detailed instructions on:
- Syncing local configuration with production
- Exporting and importing configuration
- Managing configuration drift

### Modifying Apache Configuration

Apache virtual host configurations are located directly on the VM at `/etc/apache2/sites-available/`. To modify Apache configuration:
Expand Down
3 changes: 3 additions & 0 deletions ci/deploy/production/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@ sudo chmod 444 web/sites/default/settings.php
sudo chown -R www-data:www-data web/sites/default/files
sudo chmod -R 775 web/sites/default/files

# Import configuration
sudo /home/deployer/production-drush.sh config:import -y

# Rebuild cache after deployment
sudo /home/deployer/production-drush.sh cr
3 changes: 3 additions & 0 deletions ci/deploy/staging/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,8 @@ sudo chmod 444 web/sites/default/settings.php
sudo chown -R www-data:www-data web/sites/default/files
sudo chmod -R 775 web/sites/default/files

# Import configuration
sudo /home/deployer/staging-drush.sh config:import -y

# Rebuild cache after deployment
sudo /home/deployer/staging-drush.sh cr
24 changes: 24 additions & 0 deletions config/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Deny all requests from Apache 2.4+.
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

# Deny all requests from Apache 2.0-2.2.
<IfModule !mod_authz_core.c>
Deny from all
</IfModule>

# Turn off all options we don't need.
Options -Indexes -ExecCGI -Includes -MultiViews

# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
<Files *>
# Override the handler again if we're run later in the evaluation list.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</Files>

# If we know how to do it safely, disable the PHP engine entirely.
<IfModule mod_php.c>
php_flag engine off
</IfModule>
7 changes: 7 additions & 0 deletions config/admin_toolbar.settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
_core:
default_config_hash: jvTSppzcgH5wnzBhX5xnAExcp2I1CzkQ_aky65XNfYI
menu_depth: 4
hoverintent_behavior:
enabled: true
timeout: 500
enable_toggle_shortcut: false
3 changes: 3 additions & 0 deletions config/automated_cron.settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
_core:
default_config_hash: fUksROt4FfkAU9BV4hV2XvhTBSS2nTNrZS4U7S-tKrs
interval: 10800
22 changes: 22 additions & 0 deletions config/block.block.claro_breadcrumbs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
uuid: 84fda1cc-591f-47fd-8e69-e1471bd8b104
langcode: en-gb
status: true
dependencies:
module:
- system
theme:
- claro
_core:
default_config_hash: NjcxOBrPOiK5-38t56DwFBDVY4yer7YSlbRWXFuHe7A
id: claro_breadcrumbs
theme: claro
region: breadcrumb
weight: 0
provider: null
plugin: system_breadcrumb_block
settings:
id: system_breadcrumb_block
label: Breadcrumbs
label_display: '0'
provider: system
visibility: { }
22 changes: 22 additions & 0 deletions config/block.block.claro_content.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
uuid: 3f5566f1-f8b7-4174-97d8-6aba732fd169
langcode: en-gb
status: true
dependencies:
module:
- system
theme:
- claro
_core:
default_config_hash: a0Yyx1GeyKarZ4T_yXQBR_ZFKnXiFLtxAb6gWLd8nr0
id: claro_content
theme: claro
region: content
weight: 0
provider: null
plugin: system_main_block
settings:
id: system_main_block
label: 'Main page content'
label_display: '0'
provider: system
visibility: { }
22 changes: 22 additions & 0 deletions config/block.block.claro_help.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
uuid: 71721130-266c-4e4e-bdec-1d26eecc613e
langcode: en-gb
status: true
dependencies:
module:
- help
theme:
- claro
_core:
default_config_hash: jccFSSVqV0WCDb6NtML1VWAWTtDbZ-zn5YgTRMgMrIM
id: claro_help
theme: claro
region: help
weight: 0
provider: null
plugin: help_block
settings:
id: help_block
label: Help
label_display: '0'
provider: help
visibility: { }
29 changes: 29 additions & 0 deletions config/block.block.claro_help_search.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
langcode: en-gb
status: true
dependencies:
module:
- search
- system
theme:
- claro
enforced:
config:
- search.page.help_search
id: claro_help_search
theme: claro
region: help
weight: -4
provider: null
plugin: search_form_block
settings:
id: search_form_block
label: 'Search help'
label_display: visible
provider: search
page_id: help_search
visibility:
request_path:
id: request_path
negate: false
context_mapping: { }
pages: /admin/help
20 changes: 20 additions & 0 deletions config/block.block.claro_local_actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
uuid: e39f9d58-dd8e-48e9-b05b-727c80df495a
langcode: en-gb
status: true
dependencies:
theme:
- claro
_core:
default_config_hash: CdXfDmRgAvms7EQovxxWPdYi0GitxeRbVtScYK16ZH0
id: claro_local_actions
theme: claro
region: content
weight: -10
provider: null
plugin: local_actions_block
settings:
id: local_actions_block
label: 'Primary admin actions'
label_display: '0'
provider: core
visibility: { }
22 changes: 22 additions & 0 deletions config/block.block.claro_messages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
uuid: 4da8a50a-ffc0-4443-beec-7c87b8984114
langcode: en-gb
status: true
dependencies:
module:
- system
theme:
- claro
_core:
default_config_hash: '-Ac3ISpIT0PQ-whzD7_dw0SdKi6dAbRFNWdSjOiVDqg'
id: claro_messages
theme: claro
region: highlighted
weight: 0
provider: null
plugin: system_messages_block
settings:
id: system_messages_block
label: 'Status messages'
label_display: '0'
provider: system
visibility: { }
20 changes: 20 additions & 0 deletions config/block.block.claro_page_title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
uuid: 6985e74a-9571-4ecd-bc73-097d5f35f7ca
langcode: en-gb
status: true
dependencies:
theme:
- claro
_core:
default_config_hash: fNwDdW063tk_ktzSWzZVeQS9wzvLooVO280BQ9WrsIs
id: claro_page_title
theme: claro
region: header
weight: -30
provider: null
plugin: page_title_block
settings:
id: page_title_block
label: 'Page title'
label_display: '0'
provider: core
visibility: { }
22 changes: 22 additions & 0 deletions config/block.block.claro_primary_local_tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
uuid: 7b2c68bd-2790-4e8c-be01-2759dbdf24c0
langcode: en-gb
status: true
dependencies:
theme:
- claro
_core:
default_config_hash: ACjBZI5shAMiiUpsz-inLYVXDqNNXRnSzAWV3kV_8Hw
id: claro_primary_local_tasks
theme: claro
region: header
weight: 0
provider: null
plugin: local_tasks_block
settings:
id: local_tasks_block
label: 'Primary tabs'
label_display: '0'
provider: core
primary: true
secondary: false
visibility: { }
22 changes: 22 additions & 0 deletions config/block.block.claro_secondary_local_tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
uuid: 4802883d-3eea-45a6-9a28-5fd3c0ef2d97
langcode: en-gb
status: true
dependencies:
theme:
- claro
_core:
default_config_hash: 2L0geP-ixCbCkEpW6BVF6H7vDUZN4ea07_Y9CociQm4
id: claro_secondary_local_tasks
theme: claro
region: pre_content
weight: 0
provider: null
plugin: local_tasks_block
settings:
id: local_tasks_block
label: 'Secondary tabs'
label_display: '0'
provider: core
primary: false
secondary: true
visibility: { }
Loading