From: Bill Erickson Date: Wed, 14 Jun 2017 16:34:03 +0000 (-0400) Subject: Optionally use systemd service files WIP X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e7a77451493c5b3de4d932cd8518db25ee082838;p=working%2Frandom.git Optionally use systemd service files WIP Signed-off-by: Bill Erickson --- diff --git a/extras/main.yml b/extras/main.yml index fbf68540e..108b4a812 100644 --- a/extras/main.yml +++ b/extras/main.yml @@ -4,6 +4,9 @@ - name: Install Nginx include: nginx.yml when: use_nginx +- name: Install Service Files + include: services.yml + when: use_service_files - name: Starting Services include: start.yml when: start_services diff --git a/extras/service_files/opensrf.service.j2 b/extras/service_files/opensrf.service.j2 new file mode 100644 index 000000000..ede746b7f --- /dev/null +++ b/extras/service_files/opensrf.service.j2 @@ -0,0 +1,29 @@ +# TODO: 'Before' and 'After' reflect a single-server setup. +# Make these configurable for cases where certain services +# (e.g. memcache) are not run on the same machine. + +[Unit] +Description=Open Service Request Framework +After=ejabberd.service memcached.service +Before=apache2.service apache2-websockets.service +Requries=memcached.service +BindsTo=ejabberd.service + +[Service] +User=opensrf +Group=opensrf +Type=oneshot +RemainAfterExit=yes +Environment=PATH=/openils/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +Environment=LD_LIBRARY_PATH=/openils/lib:/usr/local/lib:/usr/local/lib/dbd:$LD_LIBRARY_PATH +#ExecStartPre=/bin/sleep 5 +ExecStart=/openils/bin/osrf_control -l --start-all +#ExecStartPost=/bin/sleep 10 +#ExecStartPost=-/bin/systemctl restart apache2.service +#ExecStartPost=-/bin/systemctl restart apache2-websockets.service +ExecStop=/openils/bin/osrf_control -l --stop-all + +#[Install] +#WantedBy=multi-user.target +#Alias=opensrf.service + diff --git a/extras/services.yml b/extras/services.yml new file mode 100644 index 000000000..48d5a21f6 --- /dev/null +++ b/extras/services.yml @@ -0,0 +1,11 @@ +- name: Install OpenSRF Service File + become: true + template: + src: extras/service_files/opensrf.service.j2 + dest: /lib/systemd/system/opensrf.service + owner: root + group: root + mode: 0644 +- name: Reload Systemd Configs + become: true + shell: systemctl daemon-reload diff --git a/settings.yml b/settings.yml index bf169220a..70db80fb1 100644 --- a/settings.yml +++ b/settings.yml @@ -39,6 +39,9 @@ use_rsyslog: true # Install and configure NGINX proxy use_nginx: true +# Install systemd service files and use them to stop/start services +use_service_files: true + # Start Evergreen services when the install is complete. start_services: true