Ensure the components are isolated from the system
This creates a specific slice which all OpenStack services will operate from. By creating an independent slice these components will be governed away from the system slice allowing us to better optimise resource consumption. See the following for more information on slices: * https://www.freedesktop.org/software/systemd/man/systemd.slice.html See for following for more information on resource controls: * https://www.freedesktop.org/software/systemd/man/systemd.resource-control.html Tools like ``systemd-cgtop`` and ``systemd-cgls`` will now give us insight into specific processes, process groups, and resouce consumption in ways that we've not had access to before. To enable some of this reporting the accounting options have been added to the [Service] section of the unit file. Change-Id: I022ecb7c291287116d184bcedecaf1d39530dd72 Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
8011ba56d1
commit
170944e154
|
@ -64,3 +64,6 @@ almanach_bind_ip: 0.0.0.0
|
|||
almanach_volume_existence_threshold: 60
|
||||
almanach_instance_metadata: ''
|
||||
almanach_instance_image_meta: ''
|
||||
|
||||
almanach_collector_init_config_overrides: {}
|
||||
almanach_api_init_config_overrides: {}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
features:
|
||||
- New variables have been added to allow a deployer to customize
|
||||
a almanach systemd unit file to their liking.
|
||||
- The task dropping the almanach systemd unit files now uses the
|
||||
``config_template`` action plugin allowing deployers access to
|
||||
customize the unit files as they see fit without having to
|
||||
load extra options into the defaults and polute the generic
|
||||
systemd unit file with jinja2 variables and conditionals.
|
||||
|
|
@ -13,14 +13,18 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- include: almanach_init_api_upstart.yml
|
||||
when: inventory_hostname in groups['almanach_api'] and pid1_name == "init"
|
||||
- include: almanach_init_systemd.yml
|
||||
vars:
|
||||
program_name: "{{ almanach_api_program_name }}"
|
||||
service_name: "almanach-api"
|
||||
system_user: "{{ almanach_system_user_name }}"
|
||||
system_group: "{{ almanach_system_group_name }}"
|
||||
init_config_overrides: "{{ almanach_api_init_config_overrides }}"
|
||||
|
||||
- include: almanach_init_collector_upstart.yml
|
||||
when: inventory_hostname in groups['almanach_collector'] and pid1_name == "init"
|
||||
|
||||
- include: almanach_init_api_systemd.yml
|
||||
when: inventory_hostname in groups['almanach_api'] and pid1_name == "systemd"
|
||||
|
||||
- include: almanach_init_collector_systemd.yml
|
||||
when: inventory_hostname in groups['almanach_collector'] and pid1_name == "systemd"
|
||||
- include: almanach_init_systemd.yml
|
||||
vars:
|
||||
program_name: "{{ almanach_collector_program_name }}"
|
||||
service_name: "almanach-collector"
|
||||
system_user: "{{ almanach_system_user_name }}"
|
||||
system_group: "{{ almanach_system_group_name }}"
|
||||
init_config_overrides: "{{ almanach_collector_init_config_overrides }}"
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
---
|
||||
# Copyright 2016, Internap Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Place the init script
|
||||
template:
|
||||
src: "almanach-api-upstart.j2"
|
||||
dest: "/etc/init/{{ almanach_api_program_name }}.conf"
|
||||
mode: "0644"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
register: upstart_init
|
||||
notify:
|
||||
- Restart almanach services
|
||||
|
||||
- name: Reload init scripts
|
||||
command: initctl reload-configuration
|
||||
when: upstart_init | changed
|
||||
notify:
|
||||
- Restart almanach services
|
||||
|
||||
- name: Load service
|
||||
service:
|
||||
name: "{{ almanach_api_program_name }}"
|
||||
enabled: "yes"
|
||||
notify:
|
||||
- Restart almanach services
|
|
@ -1,24 +0,0 @@
|
|||
---
|
||||
# Copyright 2016, Internap Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Place the collector systemd init script
|
||||
template:
|
||||
src: "almanach-collector-systemd.j2"
|
||||
dest: "/etc/systemd/system/{{ almanach_collector_program_name }}.service"
|
||||
mode: "0644"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
notify:
|
||||
- Restart almanach services
|
|
@ -1,38 +0,0 @@
|
|||
---
|
||||
# Copyright 2016, Internap Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Place the init script
|
||||
template:
|
||||
src: "almanach-collector-upstart.j2"
|
||||
dest: "/etc/init/{{ almanach_collector_program_name }}.conf"
|
||||
mode: "0644"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
register: upstart_init
|
||||
notify:
|
||||
- Restart almanach services
|
||||
|
||||
- name: Reload init scripts
|
||||
command: initctl reload-configuration
|
||||
when: upstart_init | changed
|
||||
notify:
|
||||
- Restart almanach services
|
||||
|
||||
- name: Load service
|
||||
service:
|
||||
name: "{{ almanach_collector_program_name }}"
|
||||
enabled: "yes"
|
||||
notify:
|
||||
- Restart almanach services
|
|
@ -15,8 +15,8 @@
|
|||
|
||||
- name: Place the systemd init script
|
||||
template:
|
||||
src: "almanach-api-systemd.j2"
|
||||
dest: "/etc/systemd/system/{{ almanach_api_program_name }}.service"
|
||||
src: "almanach-systemd-init.j2"
|
||||
dest: "/etc/systemd/system/{{ program_name }}.service"
|
||||
mode: "0644"
|
||||
owner: "root"
|
||||
group: "root"
|
|
@ -1,20 +0,0 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
[Unit]
|
||||
Description=Almanach api openstack service
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User={{ almanach_system_user_name }}
|
||||
Group={{ almanach_system_group_name }}
|
||||
|
||||
ExecStart={{ almanach_app_dir }}/bin/almanach-api --config-file={{ almanach_config_file }} --log-file={{ almanach_log_file }}
|
||||
|
||||
TimeoutSec=300
|
||||
Restart=on-failure
|
||||
RestartSec=150
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -1,14 +0,0 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
description "{{ almanach_api_program_name }}"
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [!2345]
|
||||
|
||||
respawn
|
||||
setuid {{ almanach_system_user_name }}
|
||||
setgid {{ almanach_system_group_name }}
|
||||
|
||||
script
|
||||
exec {{ almanach_app_dir }}/bin/almanach-api --config-file={{ almanach_config_file }} --log-file={{ almanach_log_file }}
|
||||
end script
|
|
@ -1,20 +0,0 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
[Unit]
|
||||
Description=Almanach collector openstack service
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User={{ almanach_system_user_name }}
|
||||
Group={{ almanach_system_group_name }}
|
||||
|
||||
ExecStart={{ almanach_app_dir }}/bin/almanach-collector --config-file={{ almanach_config_file }} --log-file={{ almanach_log_file }}
|
||||
|
||||
TimeoutSec=300
|
||||
Restart=on-failure
|
||||
RestartSec=150
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -1,14 +0,0 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
description "{{ almanach_collector_program_name }}"
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [!2345]
|
||||
|
||||
respawn
|
||||
setuid {{ almanach_system_user_name }}
|
||||
setgid {{ almanach_system_group_name }}
|
||||
|
||||
script
|
||||
exec {{ almanach_app_dir }}/bin/almanach-collector --config-file={{ almanach_config_file }} --log-file={{ almanach_log_file }}
|
||||
end script
|
|
@ -0,0 +1,30 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
[Unit]
|
||||
Description=Almanach api openstack service
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
EnvironmentFile=/etc/environment
|
||||
User={{ system_user }}
|
||||
Group={{ system_group }}
|
||||
|
||||
ExecStart={{ almanach_app_dir }}/bin/{{ program_name }} --config-file={{ almanach_config_file }} --log-file={{ almanach_log_file }}
|
||||
|
||||
TimeoutSec=300
|
||||
Restart=on-failure
|
||||
RestartSec=150
|
||||
|
||||
# This creates a specific slice which all nova services will operate from
|
||||
# The accounting options give us the ability to see resource usage through
|
||||
# the `systemd-cgtop` command.
|
||||
Slice=almanach.slice
|
||||
CPUAccounting=true
|
||||
BlockIOAccounting=true
|
||||
MemoryAccounting=false
|
||||
TasksAccounting=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue