infinoted: Minor updates to action

- No need to have /etc/default/infinoted file.  It is not used in the
  systemd service.

- Enable directory sync plugin so that plaing text files are always
  available on server.

- Enable automatic save every 60 seconds with autosave plugin.

- Enhanced logging by enabling logging plugin.

- Remove double quotes in system user name.
This commit is contained in:
Sunil Mohan Adapa 2017-01-18 10:06:24 +05:30
parent eff8a7b84e
commit fb8ac3b748
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -47,33 +47,37 @@ certificate-file=/etc/infinoted/infinoted-cert.pem
# Absolute path of the private key file. # Absolute path of the private key file.
key-file=/etc/infinoted/infinoted-key.pem key-file=/etc/infinoted/infinoted-key.pem
# Setting this to 0 disables autosave. # Enable plugins
autosave-interval=60 plugins=note-text;autosave;logging;directory-sync
# Specify a path to use a root certificate instead of a certificate-key pair. # Specify a path to use a root certificate instead of a certificate-key pair.
#certificate-chain= #certificate-chain=
#password= #password=
# If you want to regularly synchronize the saved documents. # Automatically save documents every few seconds
#sync-directory [autosave]
#sync-interval= # Setting this to 0 disables autosave.
''' interval=60
DEFAULT_PATH = '/etc/default/infinoted' # Synchronize files to another directory in plain text format
DEFAULT = ''' [directory-sync]
# defaults file for infinoted
# Should infinoted be started by the init script? (true/false) # Directory to sync plain text files
INFINOTED_ENABLED=true directory=/var/lib/infinoted/sync
# The configuration file to be used. # Synchronize seconds
INFINOTED_CONFIG=/etc/xdg/infinoted.conf interval=60
# The session autosave file to be updated periodically and loaded # Log additional events
# upon startup. [logging]
INFINOTED_SESSION_FILE=/var/lib/infinoted
# Log when users connect or disconnect
log-connections=true
# Log errors with client connections such as a connection reset
log-connection-errors=true
''' '''
SYSTEMD_SERVICE_PATH = '/etc/systemd/system/infinoted.service' SYSTEMD_SERVICE_PATH = '/etc/systemd/system/infinoted.service'
@ -90,8 +94,8 @@ After=network.target
[Service] [Service]
User=infinoted User=infinoted
EnvironmentFile=-/etc/default/infinoted Group=infinoted
ExecStart=/usr/bin/infinoted ${OPTIONS} ExecStart=/usr/bin/infinoted
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
@ -110,18 +114,14 @@ def parse_arguments():
def subcommand_setup(_): def subcommand_setup(_):
"""Configure infinoted after install.""" """Configure infinoted after install."""
if not os.path.isfile(CONF_PATH): if not os.path.isfile(CONF_PATH):
with open(CONF_PATH, 'w') as file_handle: with open(CONF_PATH, 'w') as file_handle:
file_handle.write(CONF) file_handle.write(CONF)
if not os.path.isfile(DEFAULT_PATH):
with open(DEFAULT_PATH, 'w') as file_handle:
file_handle.write(DEFAULT)
if not os.path.isfile(SYSTEMD_SERVICE_PATH): if not os.path.isfile(SYSTEMD_SERVICE_PATH):
with open(SYSTEMD_SERVICE_PATH, 'w') as file_handle: with open(SYSTEMD_SERVICE_PATH, 'w') as file_handle:
file_handle.write(SYSTEMD_SERVICE) file_handle.write(SYSTEMD_SERVICE)
subprocess.check_call(['systemctl', 'daemon-reload']) subprocess.check_call(['systemctl', 'daemon-reload'])
# Create infinoted group if needed. # Create infinoted group if needed.
@ -136,7 +136,7 @@ def subcommand_setup(_):
except KeyError: except KeyError:
subprocess.run(['adduser', '--system', '--ingroup', 'infinoted', subprocess.run(['adduser', '--system', '--ingroup', 'infinoted',
'--home', DATA_DIR, '--home', DATA_DIR,
'--gecos', '"Infinoted collaborative editing server"', '--gecos', 'Infinoted collaborative editing server',
'infinoted'], check=True) 'infinoted'], check=True)
if not os.path.exists(DATA_DIR): if not os.path.exists(DATA_DIR):