Initial Murano CCP commit

Change-Id: I82d8cdc07767314102259f721106486c50ff06bd
This commit is contained in:
Bartosz Kupidura 2016-10-05 13:46:13 +00:00 committed by Aleksandr Mogylchenko
parent e78f1c11e3
commit 9b2211300c
13 changed files with 238 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.tox

View File

@ -0,0 +1,9 @@
FROM {{ image_spec("murano-base") }}
MAINTAINER {{ maintainer }}
RUN apt-get install -y --no-install-recommends \
mysql-client \
zip \
&& apt-get clean
USER murano

View File

@ -0,0 +1,15 @@
FROM {{ image_spec("openstack-base") }}
MAINTAINER {{ maintainer }}
{{ copy_sources("openstack/murano", "/murano") }}
RUN useradd -U -m -d /var/lib/murano -G microservices murano \
&& chmod 755 /var/lib/murano \
&& /var/lib/microservices/venv/bin/pip install --upgrade /murano \
&& mkdir -p /etc/murano /var/lib/murano /var/log/murano \
&& cp -r /murano/etc/murano/* /etc/murano/ \
&& chown -R murano: /etc/murano /var/lib/murano /var/log/murano
COPY murano_sudoers /etc/sudoers.d/murano_sudoers
RUN chmod 440 /etc/sudoers.d/murano_sudoers

View File

@ -0,0 +1 @@
%microservices ALL=(root) NOPASSWD: /bin/chown murano\: /var/log/ccp/murano

View File

@ -0,0 +1,4 @@
FROM {{ image_spec("murano-base") }}
MAINTAINER {{ maintainer }}
USER murano

View File

@ -0,0 +1,19 @@
configs:
murano:
api_port:
cont: 8082
ingress: application-catalog
db:
username: murano
password: password
name: murano
logging_debug: false
networking:
dns: 8.8.8.8
sources:
openstack/murano:
git_url: https://git.openstack.org/openstack/murano.git
git_ref: stable/newton

View File

@ -0,0 +1,46 @@
[DEFAULT]
debug = {{ murano.logging_debug }}
verbose = True
log_dir = /var/log/ccp/murano
bind_port = {{ murano.api_port.cont }}
home_region = RegionOne
transport_url = rabbit://{{ rabbitmq.user }}:{{ rabbitmq.password }}@{{ address("rabbitmq", rabbitmq.port) }}/
[database]
connection = mysql+pymysql://{{ murano.db.username }}:{{ murano.db.password }}@{{ address(service.database) }}/{{ murano.db.name }}
[engine]
use_trusts = True
packages_service = murano
[keystone_authtoken]
auth_version = v3
auth_uri = http://{{ address('keystone', keystone.public_port) }}/v3
auth_url = http://{{ address('keystone', keystone.admin_port) }}/v3
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = {{ murano.db.username }}
password = {{ murano.db.password }}
[rabbitmq]
host = {{ k8s_external_ip }}
port = {{ rabbitmq.port.node }}
login = {{ rabbitmq.user }}
password = {{ rabbitmq.password }}
virtual_host = /
[oslo_messaging_notifications]
driver = messagingv2
transport_url = rabbit://{{ rabbitmq.user }}:{{ rabbitmq.password }}@{{ address("rabbitmq", rabbitmq.port) }}/
[murano]
url = http://{{ address('murano-api', murano.api_port) }}
[networking]
default_dns = {{ murano.networking.dns }}

77
service/murano-api.yaml Normal file
View File

@ -0,0 +1,77 @@
dsl_version: 0.1.0
service:
name: murano-api
ports:
- {{ murano.api_port }}
containers:
- name: murano-api
image: murano-api
# TODO(sreshetniak): add probes
pre:
- name: chown-logs-dir
command: "sudo /bin/chown murano: /var/log/ccp/murano"
- name: murano-db-create
type: single
command: mysql -v -u root -p{{ db.root_password }} -h {{ address(service.database) }} -e 'create database `{{ murano.db.name }}`;
grant all privileges on `{{ murano.db.name }}`.* to "{{ murano.db.username }}"@"%" identified by "{{ murano.db.password }}";'
dependencies:
- {{ service.database }}
- name: murano-db-sync
type: single
command: murano-db-manage --config-file /etc/murano/murano.conf upgrade
dependencies:
- murano-db-create
files:
- murano.conf
- name: murano-user-create
type: single
command: openstack user create --project service --password {{ murano.db.password }} {{ murano.db.username }}
dependencies:
- keystone-create-project
- name: murano-role-add
type: single
command: openstack role add --project service --user {{ murano.db.username }} admin
dependencies:
- murano-user-create
- name: murano-service-create
type: single
command: openstack service create --name murano --description "Application Catalog for OpenStack" application-catalog
dependencies:
- keystone
- name: murano-public-endpoint-create
type: single
command: openstack endpoint create --region RegionOne murano public http://{{ address('murano-api', murano.api_port, external=True) }}
dependencies:
- murano-service-create
- name: murano-internal-endpoint-create
type: single
command: openstack endpoint create --region RegionOne murano internal http://{{ address('murano-api', murano.api_port) }}
dependencies:
- murano-service-create
- name: murano-admin-endpoint-create
type: single
command: openstack endpoint create --region RegionOne murano admin http://{{ address('murano-api', murano.api_port) }}
dependencies:
- murano-service-create
daemon:
command: murano-api --config-file /etc/murano/murano.conf
files:
- murano.conf
dependencies:
- rabbitmq
post:
- name: murano-import-core
type: single
command: cd /murano/meta/io.murano; zip -r /tmp/murano-core.zip *;
murano --murano-url http://{{ address('murano-api', murano.api_port) }}
--os-username {{ murano.db.username }}
--os-password {{ murano.db.password }}
--os-auth-url http://{{ address('keystone', keystone.public_port) }}
--os-project-name service
package-import --is-public /tmp/murano-core.zip
files:
murano.conf:
path: /etc/murano/murano.conf
content: murano.conf.j2
perm: "0600"

View File

@ -0,0 +1,23 @@
dsl_version: 0.1.0
service:
name: murano-engine
containers:
- name: murano-engine
image: murano-engine
# TODO(sreshetniak): add probes
pre:
- name: chown-logs-dir
command: "sudo /bin/chown murano: /var/log/ccp/murano"
daemon:
command: murano-engine --config-file /etc/murano/murano.conf
files:
- murano.conf
dependencies:
- rabbitmq
- heat-api
files:
murano.conf:
path: /etc/murano/murano.conf
content: murano.conf.j2
perm: "0600"

2
test-requirements.txt Normal file
View File

@ -0,0 +1,2 @@
bashate>=0.2
yamllint>=1.3.2

5
tools/yamllint.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
set -ex
workdir=$(dirname $0)
yamllint -c $workdir/yamllint.yaml $(find . -not -path '*/\.*' -type f -name '*.yaml')

21
tools/yamllint.yaml Normal file
View File

@ -0,0 +1,21 @@
extends: default
rules:
braces:
max-spaces-inside: 1
comments:
level: error
comments-indentation:
level: warning
document-end:
present: no
document-start:
level: error
present: no
empty-lines:
max: 1
max-start: 0
max-end: 0
line-length:
level: warning
max: 120

15
tox.ini Normal file
View File

@ -0,0 +1,15 @@
[tox]
minversion = 1.6
envlist = linters,bashate
skipsdist = True
[testenv]
deps = -r{toxinidir}/test-requirements.txt
[testenv:linters]
commands =
{toxinidir}/tools/yamllint.sh
[testenv:bashate]
whitelist_externals = bash
commands = bash -c "find {toxinidir} -type f -name '*.sh' -not -path '*/.tox/*' -print0 | xargs -0 bashate -v"