Page MenuHomeDevCentral

NetBox outage on WindRiver restart
Closed, ResolvedPublic

Description

Redis not started on startup

Cannot 'start' redis. Set redis_enable to YES in /etc/rc.conf or use 'onestart' instead of 'start'.

Should be done with salt

Revisions and Commits

Related Objects

Event Timeline

dereckson renamed this task from netbox outage on windriver restart to NetBox outage on WindRiver restart.Jan 16 2024, 22:39
dereckson updated the task description. (Show Details)

That requires two steps:

  • Enable and configure the service in /etc/rc/
  • Start the service

Configuration options should be in /usr/local/etc/rc.d/redis.

An example of how it's done for Vault:

Adapted from roles/vault/vault/init.sls
#   -------------------------------------------------------------
#   Service
#   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

{% if grains["os"] == "FreeBSD" %}
/etc/rc.conf.d/vault:
  file.managed:
    - makedirs: True
    - mode: 644
    - contents: |
        vault_enable="YES"
        vault_syslog_output_enable="YES"
{% endif %}

service_vault:
  service.running:
    - name: vault
    - enable: True

The service configuration file needs to be:

  • /etc/rc.conf.d/<service> if one configuration file is enough
  • /etc/rc.conf.d/<service>/<any name> if more than one configuration file needs to exist, ie if different Salt states need to define something for a unique service, as that's the case for networking

Variables can of course also be defined in /etc/rc.conf, but rc.conf.d allows us to manage it from different part of the Salt repository.

Instead of using contents, it's also possible to provision a file, like for iodine: https://devcentral.nasqueron.org/D3291

dereckson triaged this task as High priority.
dereckson added a project: Servers.
dereckson moved this task from Backlog to Working on on the Servers board.

It also needs PostgreSQL launched at startup, but that's already defined in the role dbserver-pgsql.

By applying it:

WindRiver
$ salt-call --local state.sls_id /etc/rc.conf.d/postgresql roles/dbserver-pgsql/server/service          
/home/dereckson/dev/python/ops3/lib/python3.11/site-packages/salt/utils/pycrypto.py:27: DeprecationWarning: 'crypt' is deprecated and slated for removal in Python 3.13
  import crypt
[CRITICAL] Specified ext_pillar interface tower is unavailable
local:
----------
          ID: /etc/rc.conf.d/postgresql
    Function: file.managed
      Result: True
     Comment: File /etc/rc.conf.d/postgresql updated
     Started: 22:07:05.103851
    Duration: 5.079 ms
     Changes:   
              ----------
              diff:
                  New file
              mode:
                  0644

Summary for local
------------
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1
Total run time:   5.079 ms

$ sudo /usr/local/etc/rc.d/postgresql status
pg_ctl: directory "/var/db/postgres/data" does not exist

We use /var/db/postgres/data15 on WindRiver <- we removed the version on the role to avoid to edit the whole role at each upgrade.

I've renamed the directory to /var/db/postgres/data, works like a charm.