Skip to content

Commit

Permalink
Merge pull request #25 from NethServer/sdl-custom-conf
Browse files Browse the repository at this point in the history
Add customization of configuration files NethServer/dev#7109
  • Loading branch information
stephdl authored Nov 12, 2024
2 parents 991afbb + 9d0a7e4 commit 9d593c1
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 10 deletions.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,32 @@ SOGo must be tuned https://sogo.nu/files/docs/SOGoInstallationGuide.html#_micros

Keep in mind to set one worker per active user for the activesync connection. The SXVMEMLIMIT https://sogo.nu/files/docs/SOGoInstallationGuide.html#_general_preferences could be be adjusted also, between 25MB to 45 MB per active user with the activesync service.

## Custom configuration files

You can modify the configuration by adding new files to the folder `/home/sogo1/.config/state/templates`, if the files are present they are used instead of the default one and they are included in the backup of the module

- sogo configuration: `templates/sogo.conf.local`
- apache configuration: `templates/SOGo.conf.local`
- cron configuration: `templates/cron.conf.local`

```
runagent -m sogo1
# copy the relevant files (copy and edit only the file you need)
cp ../templates/sogo.conf templates/sogo.conf.local
cp ../templates/SOGo.conf templates/SOGo.conf.local
cp ../templates/cron.conf templates/cron.conf.local
# edit the files
vim template/sogo.conf.local
vim templates/SOGo.conf.local
vim templates/cron.conf.local
# restart the service
systemctl restart --user sogo
```


## Backup database

You can enable a databse backup for each users of their addressbooks and their calendars, older entries more than 31 days are removed. The syntax is cron based, in the example it will be triggered each day at 00h30. the backup is disabled by default
You can enable a database backup for each users of their addressbooks and their calendars, older entries more than 31 days are removed. The syntax is cron based, in the example it will be triggered each day at 00h30. the backup is disabled by default

```
- BACKUPTIME=#30 0
Expand Down
29 changes: 21 additions & 8 deletions imageroot/bin/expand-configuration
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import socket

from jinja2 import Environment, FileSystemLoader, select_autoescape

files =["config/sogo.conf","config/SOGo.conf"]
files =["config/sogo.conf","config/SOGo.conf","config/cron-sogo"]
for f in files:
try:
os.remove(f)
Expand All @@ -25,7 +25,11 @@ jenv = Environment(
autoescape=select_autoescape(),
keep_trailing_newline=True,
)

jenv_custom = Environment(
loader=FileSystemLoader(os.getenv("AGENT_INSTALL_DIR")+"/state/templates"),
autoescape=select_autoescape(),
keep_trailing_newline=True,
)
properties = {
"admin_users" : os.environ['ADMIN_USERS'].lower(),
"ldap_schema" : os.environ['SOGO_LDAP_SCHEMA'],
Expand Down Expand Up @@ -58,8 +62,11 @@ properties = {
"trashfolder": os.environ['TRASHFOLDER'],
"wowatchdogrequesttimeout": os.environ['WOWATCHDOGREQUESTTIMEOUT']
}

template = jenv.get_template('sogo.conf')
# test if sogo.conf.local exists
if os.path.exists("templates/sogo.conf.local"):
template = jenv_custom.get_template('sogo.conf.local')
else:
template = jenv.get_template('sogo.conf')
output = template.render(properties)
with open("config/sogo.conf","w") as f:
f.write(output)
Expand All @@ -70,8 +77,11 @@ properties = {
"active_sync": True if os.environ['ACTIVESYNC'] == 'True' else False,
"dav": True if os.environ['DAV'] == 'True' else False
}

template = jenv.get_template('SOGo.conf')
# test if SOGo.conf.local exists
if os.path.exists("templates/SOGo.conf.local"):
template = jenv_custom.get_template('SOGo.conf.local')
else:
template = jenv.get_template('SOGo.conf')
output = template.render(properties)
with open("config/SOGo.conf","w") as f:
f.write(output)
Expand All @@ -81,8 +91,11 @@ properties = {
"backuptime": os.environ['BACKUPTIME'],
"sessionduration": os.environ['SESSIONDURATION']
}

template = jenv.get_template('cron.conf')
# test if cron.conf.local exists
if os.path.exists("templates/cron.conf.local"):
template = jenv_custom.get_template('cron.conf.local')
else:
template = jenv.get_template('cron.conf')
output = template.render(properties)
with open("config/cron-sogo","w") as f:
f.write(output)
1 change: 1 addition & 0 deletions imageroot/etc/state-include.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
#
state/sogo.sql
state/backups
state/templates
2 changes: 1 addition & 1 deletion imageroot/systemd/user/sogo-app.service
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ EnvironmentFile=-%S/state/discovery_ldap.env
WorkingDirectory=%S/state
Restart=always
TimeoutStopSec=70
ExecStartPre=/usr/bin/bash -c "/bin/mkdir -p {config,backups}"
ExecStartPre=/usr/bin/bash -c "/bin/mkdir -p {config,backups,templates}"
ExecStartPre=/bin/rm -f %t/sogo-app.pid %t/sogo-app.ctr-id
ExecStartPre=/usr/local/bin/runagent discover-service
ExecStartPre=/usr/local/bin/runagent discover-ldap
Expand Down

0 comments on commit 9d593c1

Please sign in to comment.