Fortress on Ymir #11
Replies: 3 comments 24 replies
-
Configuration Cache and Log Files.Fortress cannot build its cached configuration file on Ymir since it's read-only. This will throw an exception, since Fortress expected the log/cache directory to be existing and writable. There are three ways to handle this: 1. Use /tmp as a log/cache directory | doesn't work$_SERVER['SNICCO_FORTRESS_CACHE_DIR'] = '/tmp'
$_SERVER['SNICCO_FORTRESS_LOG_DIR'] = '/tmp'
Downsides:
2. Use /tmp/fortress as a log/cache directoryif(!is_dir('/tmp/fortress')) {
mkdir('/tmp/fortress/cache', 0755, true);
mkdir('/tmp/fortress/log', 0755, true);
}
$_SERVER['SNICCO_FORTRESS_CACHE_DIR'] = '/tmp/fortress/cache'
$_SERVER['SNICCO_FORTRESS_LOG_DIR'] = '/tmp/fortress/log' Downsides:
3. Deploy cached configuration filesLastly, it's possible to deploy a cached configuration that was built locally. There are currently no env (db, server, filesystem) related configuration settings in Fortress; a local configuration should always be reproducible remotely. This would mean the Fortress configuration cache must be put into version control and included in the Ymir deployment. The build step should include the following: id: 1
name: project-name
type: wordpress
environments:
environment-name:
build:
- 'composer install' # Install Fortress via composer
- 'wp snicco/fortress cache:clear && wp snicco/fortress config:test --reload-on-success' # Clear current cache & rebuilt sources $_SERVER['SNICCO_FORTRESS_LOG_DIR'] = '/tmp' Downsides:
|
Beta Was this translation helpful? Give feedback.
-
Fortress SecretsFortress's Secrets should be Ymir ENV secrets. Fortress secrets can be generated to stdout by running:
The output of this command can then be piped (with some xargs magic) to Secrets must be generated per ymir environment before Fortress is deployed. Secrets must never be changed after creating them in one env. |
Beta Was this translation helpful? Give feedback.
-
Static AssetsWhen ymir deploys your site, it by default strips out any non php assets, including JSON files.
In the ymir.yml adding something like this seems to resolve it. There are multiple json files in Fortress that are required to exist for the plugin to function. Examples, the JSON file from above, as well as the manifest file environments:
staging:
build:
include:
- web/app/mu-plugins/snicco-fortress |
Beta Was this translation helpful? Give feedback.
-
This discussion will be a work-in-progress to discuss the optimal Fortress configuration on Ymir.
The purpose is to later merge this into a "Guide" in the Ymir Docs.
Beta Was this translation helpful? Give feedback.
All reactions