Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-4281

System scripts: provide Systemd templates to manage Karaf child instances

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 4.1.0, 4.0.5
    • karaf
    • None

    Description

      Systemd's has as a sort of template-engine for unit files which are defined in the form of template-name@.service, i.e. for karaf I've created one named karaf@.service with content like:

        [Unit]
        Description=Karaf - %i
        After=syslog.target network.target
      
        [Service]
        EnvironmentFile=-/etc/karaf/karaf.conf
        Environment=JAVA_HOME=/opt/java/1.8.0
        Environment=KARAF_HOME=/opt/apache/karaf-4
        Environment=KARAF_BASE=/opt/apache/karaf-4/instances/%i
      
        ExecStart=/opt/apache/karaf-4/bin/karaf daemon
        ExecStop=/opt/apache/karaf-4/bin/karaf stop
      
        LimitNOFILE=102642
      
        [Install]
        WantedBy=multi-user.target
      

      With such configuration, you do not need to create a systemd unit file for each child instance but you can leverage karaf@.service, i.e:

        systemctl start karaf@instance-1
      

      A service created in such way can also be configured to auto-start at boot like any other Systemd unit:

        [lb@home]# systemctl enable karaf@instance-1
        Created symlink from /etc/systemd/system/multi-user.target.wants /karaf@instance-1.service to /etc/systemd/system/karaf@.service. 
      

      Attachments

        Activity

          People

            ffang Freeman Yue Fang
            lb Luca Burgazzoli
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: