Add option for panko container to log to stdout/stderr
This adds the option to get the panko container to log to stdout. The option is disabled by default. If enabled, It also adds a sidecar container that reads the apache access logs. bp logging-stdout-rsyslog Change-Id: I56fa3de7427330c1d7bc10e0f8b1adbacec00e46
This commit is contained in:
parent
97e3a2fd0d
commit
0b5117840b
41
docker/services/logging/files/panko-api.yaml
Normal file
41
docker/services/logging/files/panko-api.yaml
Normal file
@ -0,0 +1,41 @@
|
||||
heat_template_version: pike
|
||||
|
||||
description: >
|
||||
OpenStack containerized Panko service
|
||||
|
||||
parameters:
|
||||
DockerPankoApiImage:
|
||||
description: image
|
||||
type: string
|
||||
|
||||
outputs:
|
||||
cmd_extra_args:
|
||||
description: Extra command line arguments for running the service in the container.
|
||||
value: ''
|
||||
config_settings:
|
||||
description: Extra hieradata needed to log to files in the host.
|
||||
value: null
|
||||
volumes:
|
||||
description: The volumes needed to log to files in the host.
|
||||
value: &panko_api_volumes
|
||||
- /var/log/containers/panko:/var/log/panko
|
||||
- /var/log/containers/httpd/panko-api:/var/log/httpd
|
||||
docker_config:
|
||||
description: Extra containers needed for logging to files in the host.
|
||||
value:
|
||||
step_2:
|
||||
panko_init_log:
|
||||
image: {get_param: DockerPankoApiImage}
|
||||
user: root
|
||||
volumes: *panko_api_volumes
|
||||
command: ['/bin/bash', '-c', 'chown -R panko:panko /var/log/panko']
|
||||
host_prep_tasks:
|
||||
description: Extra ansible tasks needed for logging to files in the host.
|
||||
value:
|
||||
- name: create persistent logs directory
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- /var/log/containers/panko
|
||||
- /var/log/containers/httpd/panko-api
|
63
docker/services/logging/stdout/panko-api.yaml
Normal file
63
docker/services/logging/stdout/panko-api.yaml
Normal file
@ -0,0 +1,63 @@
|
||||
heat_template_version: pike
|
||||
|
||||
description: >
|
||||
OpenStack containerized Keystone service
|
||||
|
||||
parameters:
|
||||
DockerPankoApiImage:
|
||||
description: image
|
||||
type: string
|
||||
|
||||
outputs:
|
||||
cmd_extra_args:
|
||||
description: Extra command line arguments for running the service in the container.
|
||||
value: "--log-dir= --log-file="
|
||||
config_settings:
|
||||
description: Extra hieradata needed to log to stdout.
|
||||
value:
|
||||
panko::wsgi::apache::access_log_file: /var/log/httpd/access.log
|
||||
panko::wsgi::apache::error_log_file: /var/log/httpd/error_log
|
||||
docker_config:
|
||||
description: Extra containers needed for logging to stdout or a sidecar container.
|
||||
value:
|
||||
step_2:
|
||||
panko_api_apache_error_logs:
|
||||
start_order: 1
|
||||
image: {get_param: DockerPankoApiImage}
|
||||
user: root
|
||||
privileged: false
|
||||
restart: always
|
||||
healthcheck:
|
||||
test: '[ -p /var/log/httpd/error_log ]'
|
||||
command: ['/bin/bash', '-c', 'mkdir -p /var/log/httpd && rm -f /var/log/httpd/error_log && mkfifo /var/log/httpd/error_log && while true; do cat /var/log/httpd/error_log; done']
|
||||
volumes:
|
||||
- PankoApiLogs:/var/log/
|
||||
panko_api_apache_access_logs:
|
||||
start_order: 1
|
||||
image: {get_param: DockerPankoApiImage}
|
||||
user: root
|
||||
privileged: false
|
||||
restart: always
|
||||
healthcheck:
|
||||
test: '[ -p /var/log/httpd/access.log ]'
|
||||
command: ['/bin/bash', '-c', 'mkdir -p /var/log/httpd && rm -f /var/log/httpd/access.log && mkfifo /var/log/httpd/access.log && while true; do cat /var/log/httpd/access.log; done']
|
||||
volumes:
|
||||
- PankoApiLogs:/var/log/
|
||||
panko_api_logs:
|
||||
start_order: 2
|
||||
image: {get_param: DockerPankoApiImage}
|
||||
user: panko
|
||||
privileged: false
|
||||
restart: always
|
||||
healthcheck:
|
||||
test: '[ -p /var/log/panko/app.log ]'
|
||||
command: ['/bin/bash', '-c', 'mkdir -p /var/log/panko && rm -f /var/log/panko/app.log && mkfifo /var/log/panko/app.log && while true; do cat /var/log/panko/app.log; done']
|
||||
volumes:
|
||||
- PankoApiLogs:/var/log/
|
||||
volumes:
|
||||
description: The volumes needed to log to stdout or a sidecar container.
|
||||
value:
|
||||
- PankoApiLogs:/var/log/
|
||||
host_prep_tasks:
|
||||
description: Extra ansible tasks needed for logging to files in the host.
|
||||
value: null
|
@ -64,6 +64,9 @@ resources:
|
||||
RoleName: {get_param: RoleName}
|
||||
RoleParameters: {get_param: RoleParameters}
|
||||
|
||||
PankoApiLogging:
|
||||
type: OS::TripleO::Services::Logging::PankoApi
|
||||
|
||||
outputs:
|
||||
role_data:
|
||||
description: Role data for the Panko API role.
|
||||
@ -72,6 +75,7 @@ outputs:
|
||||
config_settings:
|
||||
map_merge:
|
||||
- get_attr: [PankoApiPuppetBase, role_data, config_settings]
|
||||
- get_attr: [PankoApiLogging, config_settings]
|
||||
- apache::default_vhost: false
|
||||
logging_source: {get_attr: [PankoApiPuppetBase, role_data, logging_source]}
|
||||
logging_groups: {get_attr: [PankoApiPuppetBase, role_data, logging_groups]}
|
||||
@ -101,16 +105,10 @@ outputs:
|
||||
recurse: true
|
||||
docker_config:
|
||||
step_2:
|
||||
panko_init_log:
|
||||
image: &panko_api_image {get_param: DockerPankoApiImage}
|
||||
user: root
|
||||
volumes:
|
||||
- /var/log/containers/panko:/var/log/panko
|
||||
- /var/log/containers/httpd/panko-api:/var/log/httpd
|
||||
command: ['/bin/bash', '-c', 'chown -R panko:panko /var/log/panko']
|
||||
get_attr: [PankoApiLogging, docker_config, step_2]
|
||||
step_3:
|
||||
panko_db_sync:
|
||||
image: *panko_api_image
|
||||
image: &panko_api_image {get_param: DockerPankoApiImage}
|
||||
net: host
|
||||
detach: false
|
||||
privileged: false
|
||||
@ -118,12 +116,19 @@ outputs:
|
||||
volumes:
|
||||
list_concat:
|
||||
- {get_attr: [ContainersCommon, volumes]}
|
||||
- {get_attr: [PankoApiLogging, volumes]}
|
||||
-
|
||||
- /var/lib/config-data/panko/etc/my.cnf.d/tripleo.cnf:/etc/my.cnf.d/tripleo.cnf:ro
|
||||
- /var/lib/config-data/panko/etc/panko:/etc/panko:ro
|
||||
- /var/log/containers/panko:/var/log/panko
|
||||
- /var/log/containers/httpd/panko-api:/var/log/httpd
|
||||
command: "/usr/bin/bootstrap_host_exec panko_api su panko -s /bin/bash -c '/usr/bin/panko-dbsync'"
|
||||
command:
|
||||
# NOTE(jaosorior): When providing extra arguments, we need to make sure that they're part
|
||||
# of the bash -c invocation, so we include them in the quoted db sync command. Hence the
|
||||
# final single quote that's part of the list_join.
|
||||
list_join:
|
||||
- ' '
|
||||
- - "/usr/bin/bootstrap_host_exec panko_api su panko -s /bin/bash -c '/usr/bin/panko-dbsync"
|
||||
- {get_attr: [PankoApiLogging, cmd_extra_args]}
|
||||
- "'"
|
||||
step_4:
|
||||
panko_api:
|
||||
start_order: 2
|
||||
@ -134,11 +139,10 @@ outputs:
|
||||
volumes:
|
||||
list_concat:
|
||||
- {get_attr: [ContainersCommon, volumes]}
|
||||
- {get_attr: [PankoApiLogging, volumes]}
|
||||
-
|
||||
- /var/lib/kolla/config_files/panko_api.json:/var/lib/kolla/config_files/config.json:ro
|
||||
- /var/lib/config-data/puppet-generated/panko/:/var/lib/kolla/config_files/src:ro
|
||||
- /var/log/containers/panko:/var/log/panko
|
||||
- /var/log/containers/httpd/panko-api:/var/log/httpd
|
||||
-
|
||||
if:
|
||||
- internal_tls_enabled
|
||||
@ -151,13 +155,6 @@ outputs:
|
||||
- ''
|
||||
environment:
|
||||
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
|
||||
host_prep_tasks:
|
||||
- name: create persistent logs directory
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- /var/log/containers/panko
|
||||
- /var/log/containers/httpd/panko-api
|
||||
host_prep_tasks: {get_attr: [PankoApiLogging, host_prep_tasks]}
|
||||
metadata_settings:
|
||||
get_attr: [PankoApiPuppetBase, role_data, metadata_settings]
|
||||
|
@ -11,3 +11,4 @@ resource_registry:
|
||||
OS::TripleO::Services::Logging::NovaCommon: ../docker/services/logging/stdout/nova-common.yaml
|
||||
OS::TripleO::Services::Logging::NovaPlacement: ../docker/services/logging/stdout/nova-placement.yaml
|
||||
OS::TripleO::Services::Logging::NovaLibvirt: ../docker/services/logging/stdout/nova-libvirt.yaml
|
||||
OS::TripleO::Services::Logging::PankoApi: ../docker/services/logging/stdout/panko-api.yaml
|
||||
|
@ -309,6 +309,7 @@ resource_registry:
|
||||
OS::TripleO::Services::Logging::NovaCommon: docker/services/logging/files/nova-common.yaml
|
||||
OS::TripleO::Services::Logging::NovaLibvirt: OS::Heat::None
|
||||
OS::TripleO::Services::Logging::NovaPlacement: docker/services/logging/files/nova-placement.yaml
|
||||
OS::TripleO::Services::Logging::PankoApi: docker/services/logging/files/panko-api.yaml
|
||||
|
||||
parameter_defaults:
|
||||
EnablePackageInstall: false
|
||||
|
Loading…
Reference in New Issue
Block a user