Using in GovCMS SaaS
Before you begin
Where to get help
See Getting help section
Steps overview
1. Generic GovCMS setup
1.1 Setup local
Clone the GitLab project locally.
Create a new branch
develop
frommaster
.Uncomment
MARIADB_DATA_IMAGE
line in.env
file.Add the following file exclusions to
.gitignore
:
You can lookup username by logging into production site or by running:
Now, if you run ahoy login
you should be able to login to your local version of the site as an admin user.
1.2 Export active configuration
If the above did not work OR hasn't been updated nightly - download a raw database file from GovCMS Lagoon Projects from the “Backups” tab and import with
ahoy mysql-import .data/db.sql
Run
ahoy drush cex
and commit configuration changes.Push to remote and wait for deployment to complete.
Upon successful deploy, create a new Merge Request against
master
branch . This will get the active configuration into the main branch.When merged, update your local branch against the latest
master
.
At this point, you should have a GovCMS project running in master
environment in GovCMS SaaS with the default theme.
2. CivicTheme setup
It is advised to perform all changes in a dedicated (feature) branch to test this part before applying any customisations.
2.1 Download CivicTheme theme
Since GovCMS SaaS does not allow to install themes via Composer, CivicTheme source must be installed as a custom theme.
Download the latest CivicTheme release and extract into
themes/custom
directory, rename the directory tocivictheme
.
2.2 Enable required modules
Using an automated script to discover required modules from theme dependencies (Drupal does not support this OOTB):
2.3 Clear caches
Do not skip this step
2.4 Enable admin and CivicTheme
CivicTheme MUST be enabled before your custom theme is enabled
2.5 Remove GovCMS content types
CivicTheme GovCMS helper module civictheme_govcms
serves the purpose to remove unnecessary entities and configuration that ships with GovCMS.
Install it locally to automatically remove the configuration from DB to later have it exported without GovCMS entities.
Run in CLI container (
ahoy cli
):Export updated configuration
2.6 Generate a sub-theme
Consider naming your theme as close as possible to the name of the site. Do not include civic
or civictheme
into name to avoid confusions in code when maintaining a theme in the future.
Run in CLI container (ahoy cli
):
This should result in 2 directories:
2.7 Install sub-theme and set as default
2.8 Build front-end assets
Run on your host:
Check that directory
themes/<SUBTHEME_MACHINE_NAME>/dist
was created.Navigate to your site and assert that default styling was applied.
2.9 Commit built assets
Modify
.gitignore
file in your new theme and remove the following lines\Commit built assets.
2.10 Provision content
CivicTheme comes with pre-set Block Content blocks configuration. Since Drupal does not support running install hooks in themes, a custom content provisioning script has to be used.
The provisioning needs to be run twice:
Locally - to capture created configuration for config entities (blocks, menus etc.)
In production - to populate the configuration with the default content. This step will be covered in the “Deployment” section below.
Run locally:
Login to the local instance of your site.
Navigate to
/admin/appearance/settings/<SUBTHEME_MACHINE_NAME>
\Press "Provision content" button.
Navigate to the homepage and observe that all blocks and menus are present.
Export config for created entities:
Commit and push to remote.
Wait for deployment to finish and login to the Drupal instance.
Navigate to
/admin/appearance/settings/<SUBTHEME_MACHINE_NAME>
.Press "Provision content" button.
Navigate to the homepage and observe that all blocks and menus are present.
After deployment and provisioning your remote feature environment should look like a default CivicTheme site without homepage content.
3. Deployment
3.1 Deploy to (pre-)production
Merge feature branch to
master
(ordevelop
and then tomaster
).Commit and push to remote.
Wait for deployment to finish and login to the Drupal instance.
Navigate to
/admin/appearance/settings/<SUBTHEME_MACHINE_NAME>
.Press "Provision content" button.
Navigate to the homepage and observe that all blocks and menus are present.
After deployment and provisioning your remote (pre-)production environment should look like a default CivicTheme site without homepage content
3.2 Cleanup
Only run this step once everything is working and looking as expected.
Commit and push to remote.
4. Customising CivicTheme
Replace sub-theme logos in repository
themes/<SUBTHEME_MACHINE_NAME>/assets/logos
with site-specific versions.Update the colour palette with your sub-theme.
Update sub-theme
screenshot.png
with something more appropriate (optional).npm run build
and commit changes.
5. Updating CivicTheme
See Version update
Resolving issues with roles
Enable
Role Delegation
module and allowSite Administrator
to delegate both GovCMS and CivicTheme roles. Ensure that CivicTheme roles have the same permissions with their GovCMS counterparts.Login to the site and re-assign existing users from GovCMS roles to relevant CivicTheme roles.
Remove GovCMS admin roles and re-export configuration.
Last updated