This guide is designed for our team of system administrators and developers who want to customize the appearance of our SOGo webmail instance without modifying the Docker image. By using Docker volumes and a GitHub repository, we can dynamically inject a custom theme into our running SOGo container, allowing for easy maintenance and updates.
Before proceeding, we need to ensure the following:
- Basic Docker knowledge: Understanding of Docker containers, images, and volumes.
- SSH access to our VPS.
- GitHub account to host our custom theme files.
-
Set Up Repository: We've already set up a GitHub repository at ExoTheme to store our custom theme files.
-
Organize Files: We should structure our repository to match the directory where SOGo expects its theme files. According to the SOGo documentation, the theme files should be placed in the
WebServerResources
directory:sogo-theme/ ├── css/ │ └── custom.css ├── images/ │ └── logo.png └── README.md
We can create these files and directories in our repository to start customizing our SOGo theme.
-
Clone Repo: We SSH into our VPS and clone our GitHub repository into the
/opt/projects/sogo
directory:git clone https://github.com/ExonomyOrg/ExoTheme.git /opt/projects/sogo/sogo-theme
-
Identify SOGo Container: Based on the SOGo documentation, SOGo's theme files are located in
/usr/lib/GNUstep/SOGo/WebServerResources/
within the container. -
Stop the Container: If the container needs to be stopped to apply changes, we can stop it with:
docker stop sogo
-
Mount the Volume and Restart the Container: We can run the following command to mount our theme directory into the SOGo container:
docker run -d \ --name sogo \ -v /opt/projects/sogo/sogo-theme:/usr/lib/GNUstep/SOGo/WebServerResources/ \ -p 8080:8080 \ our-sogo-image
Explanation:
-v /opt/projects/sogo/sogo-theme:/usr/lib/GNUstep/SOGo/WebServerResources/
: This option mounts our local theme directory to the expected path within the container, overriding the default theme with our custom one.- Replace
our-sogo-image
with the exact name of the SOGo Docker image we are using.
When we update the theme files in our GitHub repository, we can follow these steps to apply the changes to our SOGo instance:
-
Pull Changes Locally: On our VPS, we navigate to the theme directory and pull the latest changes:
cd /opt/projects/sogo/sogo-theme git pull origin main
-
Restart the Container: We restart the SOGo container to apply the updated theme:
docker restart sogo
If we ever decide to automate this process, we can create a script and run it manually whenever we want to update the theme.
-
Create the Script: Save the following script as
/opt/projects/sogo/scripts/update-sogo-theme.sh
:#!/bin/bash cd /opt/projects/sogo/sogo-theme git pull origin main docker restart sogo
Make sure the script is executable:
chmod +x /opt/projects/sogo/scripts/update-sogo-theme.sh
-
Manual Activation: We can run the script manually whenever we want to update the theme:
/opt/projects/sogo/scripts/update-sogo-theme.sh
-
Monitor: Regularly check the Docker logs to ensure that the theme is applied correctly:
docker logs -f sogo
-
Rollback if Needed: If we encounter issues, we can revert to a previous commit in our GitHub repository, pull the changes, and restart the container:
cd /opt/projects/sogo/sogo-theme git reset --hard <commit_id> git pull origin main docker restart sogo
By leveraging Docker volumes and our GitHub repository, we can effectively manage and apply custom themes to our SOGo instance without modifying the Docker image. This approach provides flexibility and allows for easy updates via version control, ensuring that our SOGo instance always runs the latest version of our theme with minimal manual intervention.
This version of the guide is now fully tailored to our team, using precise references to our specific files, folders, and setup.