tripleo-heat-templates/deployment/congress/congress-container-puppet.yaml
Dan Prince 25bc2a687b flatten the congress service
This change combines the previous puppet and docker files into a single
file that performs the docker service installation and configuration
for the congress service.

Change-Id: Ic39a7bca37a21ce01e1d185c1eb5c28c6aabb804
Related-Blueprint: services-yaml-flattening
2019-02-01 10:02:10 -05:00

265 lines
9.8 KiB
YAML

heat_template_version: rocky
description: >
OpenStack containerized Congress API service
parameters:
DockerCongressApiImage:
description: image
type: string
DockerCongressConfigImage:
description: The container image to use for the congress config_volume
type: string
EndpointMap:
default: {}
description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry.
type: json
ServiceData:
default: {}
description: Dictionary packing service data
type: json
ServiceNetMap:
default: {}
description: Mapping of service_name -> network name. Typically set
via parameter_defaults in the resource registry. This
mapping overrides those in ServiceNetMapDefaults.
type: json
DefaultPasswords:
default: {}
type: json
RoleName:
default: ''
description: Role name on which the service is applied
type: string
RoleParameters:
default: {}
description: Parameters specific to the role
type: json
UpgradeRemoveUnusedPackages:
default: false
description: Remove package if the service is being disabled during upgrade
type: boolean
CongressPassword:
description: The password for the congress service account.
type: string
hidden: true
Debug:
type: boolean
default: false
description: Set to True to enable debugging on all services.
CongressDebug:
default: ''
description: Set to True to enable debugging Congress service.
type: string
constraints:
- allowed_values: [ '', 'true', 'True', 'TRUE', 'false', 'False', 'FALSE']
KeystoneRegion:
type: string
default: 'regionOne'
description: Keystone region for endpoint
CongressPolicies:
description: |
A hash of policies to configure for Congress.
e.g. { congress-context_is_admin: { key: context_is_admin, value: 'role:admin' } }
default: {}
type: json
NotificationDriver:
type: string
default: 'messagingv2'
description: Driver or drivers to handle sending notifications.
RpcPort:
default: 5672
description: The network port for messaging backend
type: number
RpcUserName:
default: guest
description: The username for messaging backend
type: string
RpcPassword:
description: The password for messaging backend
type: string
hidden: true
RpcUseSSL:
default: false
description: >
Messaging client subscriber parameter to specify
an SSL connection to the messaging host.
type: string
conditions:
service_debug_unset: {equals : [{get_param: CongressDebug}, '']}
resources:
ContainersCommon:
type: ../../docker/services/containers-common.yaml
MySQLClient:
type: ../../deployment/database/mysql-client.yaml
outputs:
role_data:
description: Role data for the Congress API role.
value:
service_name: congress
config_settings:
congress_password: {get_param: CongressPassword}
congress::db::database_connection:
make_url:
scheme: {get_param: [EndpointMap, MysqlInternal, protocol]}
username: congress
password: {get_param: CongressPassword}
host: {get_param: [EndpointMap, MysqlInternal, host]}
path: /congress
query:
read_default_file: /etc/my.cnf.d/tripleo.cnf
read_default_group: tripleo
congress::logging::debug:
if:
- service_debug_unset
- {get_param: Debug }
- {get_param: CongressDebug }
congress::rpc_backend: rabbit
congress::notification_driver: {get_param: NotificationDriver}
# TODO(ansmith): remove once p-t-o switches to oslo params
congress::rabbit_userid: {get_param: RpcUserName}
congress::rabbit_password: {get_param: RpcPassword}
congress::rabbit_use_ssl: {get_param: RpcUseSSL}
congress::rabbit_port: {get_param: RpcPort}
congress::server::bind_host:
str_replace:
template:
"%{hiera('$NETWORK')}"
params:
$NETWORK: {get_param: [ServiceNetMap, CongressApiNetwork]}
congress::keystone::authtoken::password: {get_param: CongressPassword}
congress::keystone::authtoken::project_name: 'service'
congress::keystone::authtoken::user_domain_name: 'Default'
congress::keystone::authtoken::project_domain_name: 'Default'
congress::keystone::authtoken::auth_url: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
congress::keystone::authtoken::www_authenticate_uri: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
congress::keystone::authtoken::auth_uri: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
congress::db::mysql::password: {get_param: CongressPassword}
congress::db::mysql::user: congress
congress::db::mysql::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
congress::db::mysql::dbname: congress
congress::db::mysql::allowed_hosts:
- '%'
- {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
congress::policy::policies: {get_param: CongressPolicies}
tripleo::congress::firewall_rules:
'113 congress':
dport:
- 1789
- 13789
service_config_settings:
keystone:
congress::keystone::auth::tenant: 'service'
congress::keystone::auth::region: {get_param: KeystoneRegion}
congress::keystone::auth::password: {get_param: CongressPassword}
congress::keystone::auth::public_url: {get_param: [EndpointMap, CongressPublic, uri]}
congress::keystone::auth::internal_url: {get_param: [EndpointMap, CongressInternal, uri]}
congress::keystone::auth::admin_url: {get_param: [EndpointMap, CongressAdmin, uri]}
# BEGIN DOCKER SETTINGS
puppet_config:
config_volume: congress
puppet_tags: congress_config
step_config:
list_join:
- "\n"
- - "include ::tripleo::profile::base::congress"
- {get_attr: [MySQLClient, role_data, step_config]}
config_image: {get_param: DockerCongressConfigImage}
kolla_config:
/var/lib/kolla/config_files/congress_api.json:
command: /usr/bin/congress-server --config-file=/etc/congress/congress.conf --log-file=/var/log/congress/api.log
config_files:
- source: "/var/lib/kolla/config_files/src/*"
dest: "/"
merge: true
preserve_properties: true
permissions:
- path: /var/log/congress
owner: congress:congress
recurse: true
docker_config:
# db sync runs before permissions set by kolla_config
step_2:
congress_init_logs:
image: &congress_api_image {get_param: DockerCongressApiImage}
net: none
privileged: false
user: root
volumes:
- /var/log/containers/congress:/var/log/congress:z
command: ['/bin/bash', '-c', 'chown -R congress:congress /var/log/congress']
step_3:
congress_db_sync:
image: *congress_api_image
net: host
privileged: false
detach: false
user: root
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
-
# FIXME(mandre) mounting /etc rw to workaround LP1696283
# This should go away anyway and mount the exact files it
# needs or use kolla set_configs.py
- /var/lib/config-data/congress/etc/:/etc/
- /var/log/containers/congress:/var/log/congress:z
command: "/usr/bin/bootstrap_host_exec congress su congress -s /bin/bash -c 'congress-db-manage --config-file /etc/congress/congress.conf upgrade head'"
step_4:
congress_api:
start_order: 15
image: *congress_api_image
net: host
privileged: false
restart: always
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
-
- /var/lib/kolla/config_files/congress_api.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/congress/:/var/lib/kolla/config_files/src:ro
- /var/log/containers/congress:/var/log/congress:z
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
host_prep_tasks:
- name: create persistent directories
file:
path: "{{ item.path }}"
state: directory
setype: "{{ item.setype }}"
with_items:
- { 'path': /var/log/congress, 'setype': svirt_sandbox_file_t }
- { 'path': /var/log/containers/congress, 'setype': svirt_sandbox_file_t }
- name: congress logs readme
copy:
dest: /var/log/congress/readme.txt
content: |
Log files from congress containers can be found under
/var/log/containers/congress.
ignore_errors: true
post_upgrade_tasks:
- when: step|int == 1
import_role:
name: tripleo-docker-rm
vars:
containers_to_rm:
- congress_api
upgrade_tasks:
- when: step|int == 3
block:
- name: Set fact for removal of openstack-congress package
set_fact:
remove_congress_package: {get_param: UpgradeRemoveUnusedPackages}
- name: Remove openstack-congress package if operator requests it
package: name=openstack-congress state=removed
ignore_errors: True
when: remove_congress_package|bool