Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 83 additions & 3 deletions docs/hypernode-deploy/applications/config-for-magento-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,71 @@ Done. Config types dumped: scopes, themes

## Advanced

However, for advanced configurations you can override most steps and variables set my Hypernode Deploy:
However, for advanced configurations you can override most steps and variables set by Hypernode Deploy:

### Static Content Locales

When the deployer runs `bin/magento static-content:deploy` it will require locales to know what to build, this variable is set for this. It is included when you run `new ApplicationTemplate\Magento2` or can be overriden with:
When the deployer runs `bin/magento static-content:deploy` it will require locales to know what to build, this variable is set for this. It is included when you run `new ApplicationTemplate\Magento2` or can be overridden with:

```php
$this->setVariable('static_content_locales', 'nl_NL en_US');
$configuration->setVariable('static_content_locales', 'nl_NL en_US');
```

### Magento Themes and Split Static Deployment

For large stores with multiple themes and locales, you can use `setMagentoThemes()` to define specific themes and enable split static deployment for better build performance:

```php
<?php

namespace Hypernode\DeployConfiguration;

$configuration = new ApplicationTemplate\Magento2(['en_US']);

// Option 1: Simple theme list (uses all configured locales)
$configuration->setMagentoThemes(['Vendor/theme1', 'Vendor/theme2']);

// Option 2: Themes with specific locales per theme
$configuration->setMagentoThemes([
'Vendor/theme1' => 'nl_NL en_US',
'Vendor/theme2' => 'de_DE'
]);

return $configuration;
```

**Parameters:**

- `$themes` - Array of themes as `['vendor/theme', ...]` or with locale mapping `['vendor/theme' => 'nl_NL en_US', ...]`
- `$allowSplitStaticDeployment` (optional, default: `true`) - Enables split static deployment for better build performance

### Magento Backend Themes

If you're using custom admin themes or need to deploy backend static content separately, use the `setMagentoBackendThemes()` method:

```php
<?php

namespace Hypernode\DeployConfiguration;

$configuration = new ApplicationTemplate\Magento2(['en_US']);

// Set frontend themes
$configuration->setMagentoThemes([
'Vendor/theme1' => 'nl_NL en_US',
'Vendor/theme2' => 'de_DE'
]);

// Set backend themes separately
$configuration->setMagentoBackendThemes([
'Vendor/admin-theme' => 'nl_NL en_US'
]);

return $configuration;
```

This automatically enables split static deployment for optimal build performance.

### Defining custom steps

You potentially need to add custom steps to the deployment, for example to build npm assets or do server actions after deployment.
Expand Down Expand Up @@ -83,3 +138,28 @@ If you add these folders be aware that your new folders will be empty on your fi
```php
$configuration->addSharedFolder('var/reports');
```

### OPcache Clearing

By default, Hypernode Deploy does **not** automatically clear the OPcache after deployment. This is because the Hypernode platform has `validate_timestamps` enabled, which automatically invalidates cached PHP files when they change.

If you're deploying to a Hypernode server which has `validate_timestamps` disabled, you can manually enable OPcache clearing by adding the following to your `deploy.php`:

```php
<?php

namespace Hypernode\DeployConfiguration;

use function Deployer\after;

$configuration = new ApplicationTemplate\Magento2(['en_US']);

// Enable automatic OPcache clearing after deployment
after('deploy:symlink', 'cachetool:clear:opcache');

return $configuration;
```

```{note}
On Hypernode, OPcache is automatically managed via `validate_timestamps`. You typically don't need to enable manual clearing unless you experience caching issues after deployment.
```
10 changes: 10 additions & 0 deletions docs/hypernode-deploy/getting-started/configure-ci-cd.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@ We assume you have an `auth.json` file in either your project directory or your

Then go to your Github repository on Github.com and go to **Settings -> Secrets -> Actions**. Click the **New repository secret**, fill in `DEPLOY_COMPOSER_AUTH` as the name, paste the contents of your `auth.json` file and press **Save**.

````{note}
The `DEPLOY_COMPOSER_AUTH` variable accepts both raw JSON and base64-encoded JSON. If you're having trouble with special characters in your CI/CD system, you can base64-encode the contents:

```bash
base64 -w0 < auth.json
```

This produces a single-line encoded string that's safer for environment variables.
````

### Hypernode API authentication

***Optional step***
Expand Down