summaryrefslogtreecommitdiffstats
path: root/build/rpm_specs/openstack-congress.spec
blob: 37023be8e3b1ef2b7a708f2f0bed51f806d0b5fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
%define debug_package %{nil}

Name:		openstack-congress
Version:	2016.2
Release:	1%{?git}%{?dist}
Summary:	OpenStack servicevm/device manager

Group:		Applications/Internet
License:	Apache 2.0
URL:		https://wiki.openstack.org/wiki/Congress/Installation
Source0:	openstack-congress.tar.gz

BuildArch:	noarch

BuildRequires:	python-setuptools python2-oslo-config python2-debtcollector libffi-devel python-devel openssl-devel python2-oslo-config python2-debtcollector python34-devel

%description
OpenStack policy manager

%prep
%setup -q
rm requirements.txt


%build
#rm requirements.txt
#/usr/bin/python setup.py build


%install
/usr/bin/python setup.py install --root=%{buildroot}

rm -rf %{buildroot}/usr/lib/python2.7/site-packages/congress_tempest_tests

install -d -m 755 %{buildroot}/var/log/congress/
install -d -m 755 %{buildroot}/etc/congress/snapshot/

install etc/api-paste.ini %{buildroot}/etc/congress/api-paste.ini
install etc/policy.json %{buildroot}/etc/congress/policy.json
tox -egenconfig
install etc/congress.conf.sample %{buildroot}/etc/congress/congress.conf

install -p -D -m 644 openstack-congress.service %{buildroot}%{_unitdir}/openstack-congress.service
install -d -m 755 %{buildroot}%{_sharedstatedir}/congress

%pre
getent group congress >/dev/null || groupadd -r congress
if ! getent passwd congress >/dev/null; then
  useradd -r -g congress -G congress,nobody -d %{_sharedstatedir}/congress -s /sbin/nologin -c "OpenStack Congress Daemon" congress
fi
exit 0

%post
%systemd_post openstack-congress

%preun
%systemd_preun openstack-congress

%postun
%systemd_postun_with_restart openstack-congress

%files
%{python2_sitelib}/congress-*.egg-info
/etc/congress/api-paste.ini
/etc/congress/congress.conf
/etc/congress/policy.json
/usr/bin/congress-db-manage
/usr/bin/congress-server
%{_unitdir}/openstack-congress.service
/usr/lib/python2.7/site-packages/congress
/usr/lib/python2.7/site-packages/congress_dashboard
/usr/lib/python2.7/site-packages/antlr3runtime

%dir %attr(0750, congress, root) %{_localstatedir}/log/congress

%changelog
#888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
heat_template_version: 2015-10-15
description: >
  OpenStack compute node post deployment for Docker.

parameters:
  servers:
    type: json
  DeployIdentifier:
     type: string
     description: Value which changes if the node configuration may need to be re-applied
  DockerNamespace:
    type: string
    default: tripleoupstream
  DockerComputeImage:
    type: string
  DockerComputeDataImage:
    type: string
  DockerLibvirtImage:
    type: string
  DockerOpenvswitchImage:
    type: string
  DockerOvsVswitchdImage:
    type: string
  DockerOpenvswitchDBImage:
    type: string
  LibvirtConfig:
    type: string
    default: "/etc/libvirt/libvirtd.conf"
  NovaConfig:
    type: string
    default: "/etc/nova/nova.conf,/etc/nova/rootwrap.conf"
  NeutronOpenvswitchAgentConfig:
    type: string
    default: "/etc/neutron/neutron.conf,/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini"
  NeutronOpenvswitchAgentPluginVolume:
    type: string
    default: "/var/lib/etc-data/neutron/plugins/ml2/openvswitch_agent.ini:/var/lib/kolla/config_files/ovs_neutron_plugin.ini:ro"
  NeutronOpenvswitchAgentOvsVolume:
    type: string
    default: " "
  StepConfig:
    type: string
    description: Config manifests that will be used to step through the deployment.
    default: ''
  RoleData:
    type: json
    default: {}


resources:

  ComputePuppetConfig:
    type: OS::Heat::SoftwareConfig
    properties:
      group: puppet
      options:
        enable_hiera: True
        enable_facter: False
        tags: package,file,concat,file_line,nova_config,neutron_config,neutron_agent_ovs,neutron_plugin_ml2
      inputs:
      - name: tripleo::packages::enable_install
        type: Boolean
        default: True
      outputs:
      - name: result
      config:
        list_join:
        - ''
        - - get_file: ../puppet/manifests/overcloud_compute.pp
          - {get_param: StepConfig}


  ComputePuppetDeployment:
    type: OS::Heat::SoftwareDeployments
    properties:
      name: ComputePuppetDeployment
      servers:  {get_param: servers}
      config: {get_resource: ComputePuppetConfig}
      input_values:
        update_identifier: {get_param: DeployIdentifier}
        tripleo::packages::enable_install: True

  CopyEtcConfig:
    type: OS::Heat::SoftwareConfig
    properties:
      group: script
      outputs:
      - name: result
      config: {get_file: ./copy-etc.sh}

  CopyEtcDeployment:
    type: OS::Heat::SoftwareDeployments
    depends_on: ComputePuppetDeployment
    properties:
      name: CopyEtcDeployment
      config: {get_resource: CopyEtcConfig}
      servers:  {get_param: servers}

  CopyJsonConfig:
    type: OS::Heat::SoftwareConfig
    properties:
      group: script
      inputs:
      - name: libvirt_config
      - name: nova_config
      - name: neutron_openvswitch_agent_config
      config: |
        #!/bin/python
        import json
        import os

        data = {}
        file_perms = '600'
        libvirt_perms = '644'

        libvirt_config = os.getenv('libvirt_config').split(',')
        nova_config = os.getenv('nova_config').split(',')
        neutron_openvswitch_agent_config = os.getenv('neutron_openvswitch_agent_config').split(',')

        # Command, Config_files, Owner, Perms
        services = {'nova-libvirt': ['/usr/sbin/libvirtd', libvirt_config, 'root', libvirt_perms],
                    'nova-compute': ['/usr/bin/nova-compute', nova_config, 'nova', file_perms],
                    'neutron-openvswitch-agent': ['/usr/bin/neutron-openvswitch-agent', neutron_openvswitch_agent_config, 'neutron', file_perms],
                    'ovs-vswitchd': ['/usr/sbin/ovs-vswitchd unix:/run/openvswitch/db.sock -vconsole:emer -vsyslog:err -vfile:info --mlockall --log-file=/var/log/openvswitch/ovs-vswitchd.log'],
                    'ovsdb-server': ['/usr/sbin/ovsdb-server /etc/openvswitch/conf.db -vconsole:emer -vsyslog:err -vfile:info --remote=punix:/run/openvswitch/db.sock --log-file=/var/log/openvswitch/ovsdb-server.log']
                   }


        def build_config_files(config, owner, perms):
            config_source = '/var/lib/kolla/config_files/'
            config_files_dict = {}
            source = os.path.basename(config)
            dest = config
            config_files_dict.update({'source': config_source + source,
                                      'dest': dest,
                                      'owner': owner,
                                      'perm': perms})
            return config_files_dict


        for service in services:
            if service != 'ovs-vswitchd' and service != 'ovsdb-server':
                command = services.get(service)[0]
                config_files = services.get(service)[1]
                owner = services.get(service)[2]
                perms = services.get(service)[3]
                config_files_list = []
                for config_file in config_files:
                    if service == 'nova-libvirt':
                        command = command + ' --config ' + config_file
                    else:
                        command = command + ' --config-file ' + config_file
                    data['command'] = command
                    config_files_dict = build_config_files(config_file, owner, perms)
                    config_files_list.append(config_files_dict)
                data['config_files'] = config_files_list
            else:
                data['command'] = services.get(service)[0]
                data['config_files'] = []

            json_config_dir = '/var/lib/etc-data/json-config/'
            with open(json_config_dir + service + '.json', 'w') as json_file:
                json.dump(data, json_file, sort_keys=True, indent=4, separators=(',', ': '))

  CopyJsonDeployment:
    type: OS::Heat::SoftwareDeployments
    depends_on: CopyEtcDeployment
    properties:
      name: CopyJsonDeployment
      config: {get_resource: CopyJsonConfig}
      servers:  {get_param: servers}
      input_values:
        libvirt_config: {get_param: LibvirtConfig}
        nova_config: {get_param: NovaConfig}
        neutron_openvswitch_agent_config: {get_param: NeutronOpenvswitchAgentConfig}

  NovaComputeContainersDeploymentOVS:
    type: OS::Heat::StructuredDeployments
    depends_on: CopyJsonDeployment
    properties:
      name: NovaComputeContainersDeploymentOVS
      config: {get_resource: NovaComputeContainersConfigOVS}
      servers: {get_param: servers}

  NovaComputeContainersConfigOVS:
    type: OS::Heat::StructuredConfig
    properties:
      group: docker-cmd
      config:
        ovsvswitchd:
          image:
            list_join:
            - '/'
            - [ {get_param: DockerNamespace}, {get_param: DockerOvsVswitchdImage} ]
          net: host
          privileged: true
          restart: always
          volumes:
           - /run:/run
           - /lib/modules:/lib/modules:ro
           - /var/lib/etc-data/json-config/ovs-vswitchd.json:/var/lib/kolla/config_files/config.json
          environment:
           - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS

        openvswitchdb:
          image:
            list_join:
            - '/'
            - [ {get_param: DockerNamespace}, {get_param: DockerOpenvswitchDBImage} ]
          net: host
          restart: always
          volumes:
           - /run:/run
           - /var/lib/etc-data/json-config/ovsdb-server.json:/var/lib/kolla/config_files/config.json
           - /etc/openvswitchd:/etc/openvswitchd
          environment:
           - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS

  NovaComputeContainersDeploymentNetconfig:
    type: OS::Heat::SoftwareDeployments
    depends_on: NovaComputeContainersDeploymentOVS
    properties:
      name: NovaComputeContainersDeploymentNetconfig
      config: {get_resource: NovaComputeContainersConfigNetconfig}
      servers: {get_param: servers}

  # We run os-net-config here because we depend on the ovs containers to be up
  # and running before we configure the network.  This allows explicit timing
  # of the network configuration.
  NovaComputeContainersConfigNetconfig:
    type: OS::Heat::SoftwareConfig
    properties:
      group: script
      outputs:
      - name: result
      config: |
        #!/bin/bash
        /usr/local/bin/run-os-net-config

  LibvirtContainersDeployment:
    type: OS::Heat::StructuredDeployments
    depends_on: [CopyJsonDeployment, CopyEtcDeployment, ComputePuppetDeployment, NovaComputeContainersDeploymentNetconfig]
    properties:
      name: LibvirtContainersDeployment
      config: {get_resource: LibvirtContainersConfig}
      servers: {get_param: servers}

  LibvirtContainersConfig:
    type: OS::Heat::StructuredConfig
    properties:
      group: docker-cmd
      config:
        computedata:
          image:
            list_join:
            - '/'
            - [ {get_param: DockerNamespace}, {get_param: DockerComputeDataImage} ]
          container_name: computedata
          volumes:
           - /var/lib/nova/instances
           - /var/lib/libvirt

        libvirt:
          image:
            list_join:
            - '/'
            - [ {get_param: DockerNamespace}, {get_param: DockerLibvirtImage} ]
          net: host
          pid: host
          privileged: true
          restart: always
          volumes:
           - /run:/run
           - /lib/modules:/lib/modules:ro
           - /dev:/dev
           - /lib/udev:/lib/udev
           - /sys/fs/cgroup:/sys/fs/cgroup
           - /var/lib/etc-data/json-config/nova-libvirt.json:/var/lib/kolla/config_files/config.json
           - /var/lib/etc-data/libvirt/libvirtd.conf:/var/lib/kolla/config_files/libvirtd.conf
          environment:
           - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
          volumes_from:
           - computedata

  NovaComputeContainersDeployment:
    type: OS::Heat::StructuredDeployments
    depends_on: [CopyJsonDeployment, CopyEtcDeployment, ComputePuppetDeployment, NovaComputeContainersDeploymentNetconfig, LibvirtContainersDeployment]
    properties:
      name: NovaComputeContainersDeployment
      config: {get_resource: NovaComputeContainersConfig}
      servers: {get_param: servers}

  NovaComputeContainersConfig:
    type: OS::Heat::StructuredConfig
    properties:
      group: docker-cmd
      config:
        neutronovsagent:
          image:
            list_join:
            - '/'
            - [ {get_param: DockerNamespace}, {get_param: DockerOpenvswitchImage} ]
          net: host
          pid: host
          privileged: true
          restart: always
          volumes:
            str_split:
              - ","
              - list_join:
                 - ","
                 - [ "/run:/run", "/lib/modules:/lib/modules:ro",
                     "/var/lib/etc-data/json-config/neutron-openvswitch-agent.json:/var/lib/kolla/config_files/config.json",
                     "/var/lib/etc-data/neutron/neutron.conf:/var/lib/kolla/config_files/neutron.conf:ro",
                     "/var/lib/etc-data/neutron/plugins/ml2/ml2_conf.ini:/var/lib/kolla/config_files/ml2_conf.ini:ro",
                     {get_param: NeutronOpenvswitchAgentPluginVolume},
                     {get_param: NeutronOpenvswitchAgentOvsVolume} ]
          environment:
           - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
          volumes_from:
           - computedata

        novacompute:
          image:
            list_join:
            - '/'
            - [ {get_param: DockerNamespace}, {get_param: DockerComputeImage} ]
          net: host
          privileged: true
          restart: always
          volumes:
           - /run:/run
           - /lib/modules:/lib/modules:ro
           - /dev:/dev
           - /lib/udev:/lib/udev
           - /etc/iscsi:/etc/iscsi
           - /var/lib/etc-data/json-config/nova-compute.json:/var/lib/kolla/config_files/config.json
           - /var/lib/etc-data/nova/nova.conf:/var/lib/kolla/config_files/nova.conf:ro
           - /var/lib/etc-data/nova/rootwrap.conf:/var/lib/kolla/config_files/rootwrap.conf:ro
          environment:
           - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
          volumes_from:
           - computedata

  ExtraConfig:
    depends_on: NovaComputeContainersDeployment
    type: OS::TripleO::NodeExtraConfigPost
    properties:
        servers: {get_param: servers}