syntro_gmbh.silverstripe
Ansible Role: silverstripe
Description
Silverstripe is a flexible open-source platform for building websites. This role installs Silverstripe on a LAMP server of your choice.
Key features of this role include:
- Minimal deployment requirements -> deploy anywhere
- Release retention -> easily roll back if an error occurs
- No downtime during deployment -> deploy without disrupting users
- CI ready -> manage tags or keep branches updated
- Backup-friendly -> run backup scripts before updates
No Downtime Deployment
By default, this role performs deployments without downtime. The necessary build and flush processes occur before the live code is updated. This means users can continue using the site during the update. Silverstripe is usually capable of being deployed like this since its database structure is generally backwards compatible. Problems may arise when:
- DataObjects are removed (Silverstripe adds a
deprecated_
prefix to the table instead) - Enum values are changed
These situations are rare and usually indicate poor planning.
Keep in mind that this approach may complicate database backups, requiring more attention for consistency! It's up to the user to manage this responsibility.
Installation
ansible-galaxy install syntro_gmbh.silverstripe
Requirements
- Composer
- Git
Dependencies
None, but make sure Composer and Git are installed on your deployment host.
Usage
This role can be easily used for any Silverstripe project with just a few required variables. Check the defaults file for customizable options.
Webroot and Generated Files
The role uses the following directory structure for your application:
{{ WorkingDir }}/
├── {{ current }}
│ ├── .htaccess
│ ├── index.php
│ ├── assets --> ../shared/assets
│ └── _resources --> ../releases/<current sha>/_resources
├── releases/
│ ├── <current sha>/
│ │ ├── .git
│ │ └── ...
│ └── <other sha>/
│ ├── .git
│ └── ...
├── shared/
│ └── assets/
└── logs/
Your webroot should link to the {{ WorkingDir }}/{{ current }}/
directory. You can set these directories using silverstripe_working_dir
and silverstripe_current_dir_name
.
Database Management and Backups
To set up a new Silverstripe installation, you need to build or update the database. By default, this role runs the standard build command with the flush=1
parameter before updating files in the webroot.
You can add additional commands but remember to include the build command again using silverstripe_provisioning_cmds
. This is where you can also add any necessary backup commands. You might consider using our restic role to install a backup utility and automatically create backup scripts. By running these backups before the build step, you can ensure you have the latest version in case of a rollback.
No Downtime Deployment
This role ensures Silverstripe is deployed without downtime. The build and flush processes occur before the codebase is updated, preventing user lockout. Silverstripe is generally deployable this way, given its backwards-compatible database structure.
As mentioned, issues may arise when:
- DataObjects are removed (Silverstripe uses a
deprecated_
prefix instead of deleting tables) - Enum values are changed
These instances are unusual and typically indicative of poor planning. Always remember to back up the database before making updates.
Role Variables
Refer to the defaults file to see what variables you can customize.
Minimal Example Playbook
- hosts: all
vars:
silverstripe_project_repository: https://github.com/silverstripe/demo.silverstripe.org
silverstripe_project_version: master
silverstripe_ss_database_name: silverstripe
silverstripe_ss_database_username: root
silverstripe_ss_database_password: root
roles:
- silverstripe
Author
- Matthias Leutenegger
License
MIT
Copyright
(c) 2020, Syntro GmbH
ansible-galaxy install syntro_gmbh.silverstripe