diff options
-rw-r--r-- | cm-container/Dockerfile-template | 34 | ||||
-rw-r--r-- | cm-container/README.md | 33 | ||||
-rwxr-xr-x | cm-container/get-type-files.sh | 47 | ||||
-rw-r--r-- | cm-container/pom.xml | 172 | ||||
-rwxr-xr-x | cm-container/test-expand.sh | 2 | ||||
-rwxr-xr-x | mvn-phase-script.sh | 2 | ||||
-rw-r--r-- | pom.xml | 1 |
7 files changed, 290 insertions, 1 deletions
diff --git a/cm-container/Dockerfile-template b/cm-container/Dockerfile-template new file mode 100644 index 0000000..7d97a24 --- /dev/null +++ b/cm-container/Dockerfile-template @@ -0,0 +1,34 @@ +# ============LICENSE_START======================================================= +# org.onap.dcae +# ================================================================================ +# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# 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. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +FROM cloudifyplatform/community:cloudify-manager-18.2.28 +MAINTAINER maintainer + +ENV TYPE_REPO {{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }} +# Store type files locally +RUN pwd +RUN mkdir scripts +COPY get-type-files.sh scripts +# Load our type files and the Cloudify 3.4 type files +RUN scripts/get-type-files.sh ${TYPE_REPO}\ + && mkdir /opt/manager/resources/spec/cloudify/3.4\ + && curl -Ss https://cloudify.co/spec/cloudify/3.4/types.yaml > /opt/manager/resources/spec/cloudify/3.4/types.yaml\ + && chown -R cfyuser:cfyuser /opt/manager/resources/spec/cloudify/3.4 +# Create mount point for CM config file +RUN mkdir -p /opt/onap && chown cfyuser:cfyuser /opt/onap diff --git a/cm-container/README.md b/cm-container/README.md new file mode 100644 index 0000000..a29423d --- /dev/null +++ b/cm-container/README.md @@ -0,0 +1,33 @@ +# Cloudify Manager Container Builder +## Purpose +The artifacts in this directory build a Docker image based on the +public image from Cloudify (`cloudifyplatform/community`). The +image has the Cloudify Manager software from the base image +and adds our types files. It edits `/etc/cloudify/config.yaml` +to configure the import resolver to use our local type files instead +of fetching them over the Internet. It adds +Cloudify 3.4 type files that are still used in some plugins +and blueprints. Finally, it sets up the `/opt/onap` mount point +for our config files. + +## Running the Container +The container is intended to be launched via a Helm chart as part +of the ONAP deployment process, guided by OOM. It can be run directly +into a native Docker environment, using: +``` +docker run --name cfy-mgr -d --restart unless-stopped \ + -v /sys/fs/cgroup:/sys/fs/cgroup:ro \ + -p <some_external_port>:80 \ + --tmpfs /run \ + --tmpfs /run/lock \ + --security-opt seccomp:unconfined + --cap-add SYS_ADMIN \ + -v <path_to_kubeconfig_file>:/etc/cloudify/.kube/config + -v <path_to_config_file>:/opt/onap/config.txt + <image_name> +``` +In a Kubernetes environment, we expect that the <path_to_kubeconfile_file> and the +<path_to_config_file> mounts would be Kubernetes ConfigMaps. + +We also expect that in a Kubernetes environment the external port mapping would not be +needed. diff --git a/cm-container/get-type-files.sh b/cm-container/get-type-files.sh new file mode 100755 index 0000000..038e8e0 --- /dev/null +++ b/cm-container/get-type-files.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# ============LICENSE_START======================================================= +# org.onap.dcae +# ================================================================================ +# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# 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. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. + +# Pull type files from repos +# Set up the CM import resolver +# $1 is the repo URL +# +set -x +DEST=/opt/manager/resources/onapspec +ONAPTYPEFILES=\ +"\ +/dcaepolicyplugin/2.0.0/dcaepolicyplugin_types.yaml \ +/relationshipplugin/1.0.0/relationshipplugin_types.yaml \ +/k8splugin/1.0.0/k8splugin_types.yaml \ + +" +mkdir ${DEST} +for typefile in ${ONAPTYPEFILES} +do + mkdir -p ${DEST}/$(dirname ${typefile}) + curl -Ss $1/${typefile} >> ${DEST}/${typefile} +done +chown cfyuser:cfyuser ${DEST} +# Add our local type file store to CM import resolver configuration +TYPE_RULE="{${TYPE_REPO}: file://${DEST}}" +# This sed re is 'brittle' but we can be sure the config.yaml file +# won't change as long as we do not change the source Docker image for CM +sed -i -e "s# rules:# rules:\n - ${TYPE_RULE}#" /etc/cloudify/config.yaml +chown cfyuser:cfyuser /etc/cloudify/config.yaml diff --git a/cm-container/pom.xml b/cm-container/pom.xml new file mode 100644 index 0000000..35b2d66 --- /dev/null +++ b/cm-container/pom.xml @@ -0,0 +1,172 @@ +<?xml version="1.0"?> +<!-- +================================================================================ +Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. +================================================================================ +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. +============LICENSE_END========================================================= + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.dcaegen2.deployments</groupId> + <artifactId>deployments</artifactId> + <version>1.2.0-SNAPSHOT</version> + </parent> + <groupId>org.onap.dcaegen2.deployments</groupId> + <artifactId>cm-container</artifactId> + <name>dcaegen2-deployments-cm-container</name> + <version>1.0.0</version> + <url>http://maven.apache.org</url> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <sonar.skip>true</sonar.skip> + <sonar.sources>.</sonar.sources> + <!-- customize the SONARQUBE URL --> + <!-- sonar.host.url>http://localhost:9000</sonar.host.url --> + <!-- below are language dependent --> + <!-- for Python --> + <sonar.language>py</sonar.language> + <sonar.pluginName>Python</sonar.pluginName> + <sonar.inclusions>**/*.py</sonar.inclusions> + <!-- for JavaScaript --> + <!-- + <sonar.language>js</sonar.language> + <sonar.pluginName>JS</sonar.pluginName> + <sonar.inclusions>**/*.js</sonar.inclusions> + --> + </properties> + <build> + <finalName>${project.artifactId}-${project.version}</finalName> + <plugins> + <!-- plugin> + <artifactId>maven-assembly-plugin</artifactId> + <version>2.4.1</version> + <configuration> + <descriptors> + <descriptor>assembly/dep.xml</descriptor> + </descriptors> + </configuration> + <executions> + <execution> + <id>make-assembly</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + </execution> + </executions> + </plugin --> + <!-- now we configure custom action (calling a script) at various lifecycle phases --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.2.1</version> + <executions> + <execution> + <id>clean phase script</id> + <phase>clean</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <arguments> + <argument>${project.artifactId}</argument> + <argument>clean</argument> + </arguments> + </configuration> + </execution> + <execution> + <id>generate-sources script</id> + <phase>generate-sources</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <arguments> + <argument>${project.artifactId}</argument> + <argument>generate-sources</argument> + </arguments> + </configuration> + </execution> + <execution> + <id>compile script</id> + <phase>compile</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <arguments> + <argument>${project.artifactId}</argument> + <argument>compile</argument> + </arguments> + </configuration> + </execution> + <execution> + <id>package script</id> + <phase>package</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <arguments> + <argument>${project.artifactId}</argument> + <argument>package</argument> + </arguments> + </configuration> + </execution> + <execution> + <id>test script</id> + <phase>test</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <arguments> + <argument>${project.artifactId}</argument> + <argument>test</argument> + </arguments> + </configuration> + </execution> + <execution> + <id>install script</id> + <phase>install</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <arguments> + <argument>${project.artifactId}</argument> + <argument>install</argument> + </arguments> + </configuration> + </execution> + <execution> + <id>deploy script</id> + <phase>deploy</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <arguments> + <argument>${project.artifactId}</argument> + <argument>deploy</argument> + </arguments> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/cm-container/test-expand.sh b/cm-container/test-expand.sh new file mode 100755 index 0000000..0d5e8e5 --- /dev/null +++ b/cm-container/test-expand.sh @@ -0,0 +1,2 @@ +#!/bin/bash +sed -e 's#{{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }}#https://nexus.onap.org/content/sites/raw/org.onap.dcaegen2.platform.plugins/R2#g' Dockerfile-template > Dockerfile diff --git a/mvn-phase-script.sh b/mvn-phase-script.sh index 58c43d3..58294da 100755 --- a/mvn-phase-script.sh +++ b/mvn-phase-script.sh @@ -83,7 +83,7 @@ deploy) upload_files_of_extension sh build_and_push_docker ;; - k8s-bootstrap|tca-cdap-container|cmcontainer|redis-cluster-container) + k8s-bootstrap|tca-cdap-container|cm-container|redis-cluster-container) build_and_push_docker ;; scripts|cloud_init) @@ -41,6 +41,7 @@ limitations under the License. <module>cloud_init</module> <module>redis-cluster-container</module> <module>tca-cdap-container</module> + <module>cm-container</module> </modules> <properties> |