Restructuring Docker files
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/fb5383d7 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/fb5383d7 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/fb5383d7 Branch: refs/heads/master Commit: fb5383d712e2b3212f096d9ba2960e1c2c609478 Parents: 96c7935 Author: Akila Perera <[email protected]> Authored: Sun Aug 30 02:01:53 2015 +0530 Committer: Akila Perera <[email protected]> Committed: Sun Aug 30 14:09:53 2015 +0530 ---------------------------------------------------------------------- .../base-image/Dockerfile | 13 +++---- .../service-images/php/Dockerfile | 4 +-- .../php/packs/plugins/PhpServerStarterPlugin.py | 36 ------------------- .../plugins/PhpServerStarterPlugin.yapsy-plugin | 26 -------------- .../php/plugins/PhpServerStarterPlugin.py | 36 +++++++++++++++++++ .../plugins/PhpServerStarterPlugin.yapsy-plugin | 26 ++++++++++++++ .../service-images/tomcat/Dockerfile | 2 +- .../service-images/tomcat/packs/.gitignore | 4 +++ .../packs/plugins/TomcatServerStarterPlugin.py | 38 -------------------- .../TomcatServerStarterPlugin.yapsy-plugin | 25 ------------- .../tomcat/plugins/TomcatServerStarterPlugin.py | 38 ++++++++++++++++++++ .../TomcatServerStarterPlugin.yapsy-plugin | 25 +++++++++++++ 12 files changed, 139 insertions(+), 134 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/fb5383d7/tools/docker-images/cartridge-docker-images/base-image/Dockerfile ---------------------------------------------------------------------- diff --git a/tools/docker-images/cartridge-docker-images/base-image/Dockerfile b/tools/docker-images/cartridge-docker-images/base-image/Dockerfile index 0fafed2..7076fae 100644 --- a/tools/docker-images/cartridge-docker-images/base-image/Dockerfile +++ b/tools/docker-images/cartridge-docker-images/base-image/Dockerfile @@ -19,9 +19,10 @@ # # -------------------------------------------------------------- -FROM debian:7.7 +FROM debian:7.8 MAINTAINER [email protected] +ENV PCA_DISTRIBUTION_NAME apache-stratos-python-cartridge-agent-4.1.2 # ------------------ # Setup ssh server # ------------------ @@ -48,13 +49,13 @@ RUN pip install yapsy # ------------------------- WORKDIR /mnt/ -ADD packs/apache-stratos-python-cartridge-agent-4.1.2.zip /mnt/apache-stratos-python-cartridge-agent-4.1.2.zip -RUN unzip -q /mnt/apache-stratos-python-cartridge-agent-4.1.2.zip -d /mnt/ -RUN rm /mnt/apache-stratos-python-cartridge-agent-4.1.2.zip +ADD packs/${PCA_DISTRIBUTION_NAME}.zip /mnt/${PCA_DISTRIBUTION_NAME}.zip +RUN unzip -q /mnt/${PCA_DISTRIBUTION_NAME}.zip -d /mnt/ +RUN rm /mnt/${PCA_DISTRIBUTION_NAME}.zip -RUN mkdir -p /mnt/apache-stratos-python-cartridge-agent-4.1.2/payload +RUN mkdir -p /mnt/${PCA_DISTRIBUTION_NAME}/payload -RUN chmod +x /mnt/apache-stratos-python-cartridge-agent-4.1.2/extensions/bash/* +RUN chmod +x /mnt/${PCA_DISTRIBUTION_NAME}/extensions/bash/* RUN mkdir -p /var/log/apache-stratos/ RUN touch /var/log/apache-stratos/cartridge-agent-extensions.log http://git-wip-us.apache.org/repos/asf/stratos/blob/fb5383d7/tools/docker-images/cartridge-docker-images/service-images/php/Dockerfile ---------------------------------------------------------------------- diff --git a/tools/docker-images/cartridge-docker-images/service-images/php/Dockerfile b/tools/docker-images/cartridge-docker-images/service-images/php/Dockerfile index 0ca5c3f..3795e9c 100644 --- a/tools/docker-images/cartridge-docker-images/service-images/php/Dockerfile +++ b/tools/docker-images/cartridge-docker-images/service-images/php/Dockerfile @@ -25,14 +25,14 @@ MAINTAINER [email protected] # ---------------- # Install PHP # ---------------- -RUN apt-get install -y apache2 php5 zip stress +RUN apt-get update && apt-get install -y apache2 php5 zip stress RUN rm -f /etc/apache2/sites-enabled/000-default.conf ADD files/000-default.conf /etc/apache2/sites-enabled/000-default.conf #------------------------ # Copy PHP related PCA plugins #----------------------- -ADD packs/plugins /mnt/plugins +ADD plugins /mnt/plugins EXPOSE 80 http://git-wip-us.apache.org/repos/asf/stratos/blob/fb5383d7/tools/docker-images/cartridge-docker-images/service-images/php/packs/plugins/PhpServerStarterPlugin.py ---------------------------------------------------------------------- diff --git a/tools/docker-images/cartridge-docker-images/service-images/php/packs/plugins/PhpServerStarterPlugin.py b/tools/docker-images/cartridge-docker-images/service-images/php/packs/plugins/PhpServerStarterPlugin.py deleted file mode 100644 index 13d165c..0000000 --- a/tools/docker-images/cartridge-docker-images/service-images/php/packs/plugins/PhpServerStarterPlugin.py +++ /dev/null @@ -1,36 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. - -import mdsclient -from plugins.contracts import ICartridgeAgentPlugin -import time -import zipfile -import subprocess -from modules.util.log import LogFactory -import os - - -class PhpServerStarterPlugin(ICartridgeAgentPlugin): - - def run_plugin(self, values): - log = LogFactory().get_log(__name__) - # php_start_command = "/usr/sbin/apache2ctl -D FOREGROUND" - php_start_command = "/etc/init.d/apache2 restart" - p = subprocess.Popen(php_start_command, shell=True) - output, errors = p.communicate() - log.debug("Apache server started: [command] %s, [output] %s" % (php_start_command, output)) - http://git-wip-us.apache.org/repos/asf/stratos/blob/fb5383d7/tools/docker-images/cartridge-docker-images/service-images/php/packs/plugins/PhpServerStarterPlugin.yapsy-plugin ---------------------------------------------------------------------- diff --git a/tools/docker-images/cartridge-docker-images/service-images/php/packs/plugins/PhpServerStarterPlugin.yapsy-plugin b/tools/docker-images/cartridge-docker-images/service-images/php/packs/plugins/PhpServerStarterPlugin.yapsy-plugin deleted file mode 100644 index 0fb7a01..0000000 --- a/tools/docker-images/cartridge-docker-images/service-images/php/packs/plugins/PhpServerStarterPlugin.yapsy-plugin +++ /dev/null @@ -1,26 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. - -[Core] -Name = PhpServerStarterPlugin to start Apache server with PHP -Module = PhpServerStarterPlugin - -[Documentation] -Description = ArtifactUpdatedEvent -Author = Op1 -Version = 0.1 -Website = stratos.apache.org \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/fb5383d7/tools/docker-images/cartridge-docker-images/service-images/php/plugins/PhpServerStarterPlugin.py ---------------------------------------------------------------------- diff --git a/tools/docker-images/cartridge-docker-images/service-images/php/plugins/PhpServerStarterPlugin.py b/tools/docker-images/cartridge-docker-images/service-images/php/plugins/PhpServerStarterPlugin.py new file mode 100644 index 0000000..13d165c --- /dev/null +++ b/tools/docker-images/cartridge-docker-images/service-images/php/plugins/PhpServerStarterPlugin.py @@ -0,0 +1,36 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +import mdsclient +from plugins.contracts import ICartridgeAgentPlugin +import time +import zipfile +import subprocess +from modules.util.log import LogFactory +import os + + +class PhpServerStarterPlugin(ICartridgeAgentPlugin): + + def run_plugin(self, values): + log = LogFactory().get_log(__name__) + # php_start_command = "/usr/sbin/apache2ctl -D FOREGROUND" + php_start_command = "/etc/init.d/apache2 restart" + p = subprocess.Popen(php_start_command, shell=True) + output, errors = p.communicate() + log.debug("Apache server started: [command] %s, [output] %s" % (php_start_command, output)) + http://git-wip-us.apache.org/repos/asf/stratos/blob/fb5383d7/tools/docker-images/cartridge-docker-images/service-images/php/plugins/PhpServerStarterPlugin.yapsy-plugin ---------------------------------------------------------------------- diff --git a/tools/docker-images/cartridge-docker-images/service-images/php/plugins/PhpServerStarterPlugin.yapsy-plugin b/tools/docker-images/cartridge-docker-images/service-images/php/plugins/PhpServerStarterPlugin.yapsy-plugin new file mode 100644 index 0000000..0fb7a01 --- /dev/null +++ b/tools/docker-images/cartridge-docker-images/service-images/php/plugins/PhpServerStarterPlugin.yapsy-plugin @@ -0,0 +1,26 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +[Core] +Name = PhpServerStarterPlugin to start Apache server with PHP +Module = PhpServerStarterPlugin + +[Documentation] +Description = ArtifactUpdatedEvent +Author = Op1 +Version = 0.1 +Website = stratos.apache.org \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/fb5383d7/tools/docker-images/cartridge-docker-images/service-images/tomcat/Dockerfile ---------------------------------------------------------------------- diff --git a/tools/docker-images/cartridge-docker-images/service-images/tomcat/Dockerfile b/tools/docker-images/cartridge-docker-images/service-images/tomcat/Dockerfile index faf962b..fd47a81 100644 --- a/tools/docker-images/cartridge-docker-images/service-images/tomcat/Dockerfile +++ b/tools/docker-images/cartridge-docker-images/service-images/tomcat/Dockerfile @@ -58,7 +58,7 @@ RUN chmod +x /tmp/env && \ #------------------------ # Copy Tomcat related PCA plugins #----------------------- -ADD packs/plugins /mnt/plugins +ADD plugins /mnt/plugins EXPOSE 8080 http://git-wip-us.apache.org/repos/asf/stratos/blob/fb5383d7/tools/docker-images/cartridge-docker-images/service-images/tomcat/packs/.gitignore ---------------------------------------------------------------------- diff --git a/tools/docker-images/cartridge-docker-images/service-images/tomcat/packs/.gitignore b/tools/docker-images/cartridge-docker-images/service-images/tomcat/packs/.gitignore new file mode 100644 index 0000000..5e7d273 --- /dev/null +++ b/tools/docker-images/cartridge-docker-images/service-images/tomcat/packs/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore http://git-wip-us.apache.org/repos/asf/stratos/blob/fb5383d7/tools/docker-images/cartridge-docker-images/service-images/tomcat/packs/plugins/TomcatServerStarterPlugin.py ---------------------------------------------------------------------- diff --git a/tools/docker-images/cartridge-docker-images/service-images/tomcat/packs/plugins/TomcatServerStarterPlugin.py b/tools/docker-images/cartridge-docker-images/service-images/tomcat/packs/plugins/TomcatServerStarterPlugin.py deleted file mode 100644 index 6509865..0000000 --- a/tools/docker-images/cartridge-docker-images/service-images/tomcat/packs/plugins/TomcatServerStarterPlugin.py +++ /dev/null @@ -1,38 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. - -import mdsclient -from plugins.contracts import ICartridgeAgentPlugin -import time -import zipfile -import subprocess -from modules.util.log import LogFactory -import os - - -class TomcatServerStarterPlugin(ICartridgeAgentPlugin): - - def run_plugin(self, values): - log = LogFactory().get_log(__name__) - # start tomcat - tomcat_start_command = "exec ${CATALINA_HOME}/bin/startup.sh" - log.info("Starting Tomcat server: [command] %s" % tomcat_start_command) - - p = subprocess.Popen(tomcat_start_command, shell=True) - output, errors = p.communicate() - log.debug("Tomcat server started: [command] %s, [output] %s" % (p.args, output)) - http://git-wip-us.apache.org/repos/asf/stratos/blob/fb5383d7/tools/docker-images/cartridge-docker-images/service-images/tomcat/packs/plugins/TomcatServerStarterPlugin.yapsy-plugin ---------------------------------------------------------------------- diff --git a/tools/docker-images/cartridge-docker-images/service-images/tomcat/packs/plugins/TomcatServerStarterPlugin.yapsy-plugin b/tools/docker-images/cartridge-docker-images/service-images/tomcat/packs/plugins/TomcatServerStarterPlugin.yapsy-plugin deleted file mode 100644 index 6c80de9..0000000 --- a/tools/docker-images/cartridge-docker-images/service-images/tomcat/packs/plugins/TomcatServerStarterPlugin.yapsy-plugin +++ /dev/null @@ -1,25 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -[Core] -Name = TomcatServerStarterPlugin to read SAML SSO related metadata needed to configure SAML SSO for apps and start tomcat -Module = TomcatServerStarterPlugin - -[Documentation] -Description = ArtifactUpdatedEvent -Author = Op1 -Version = 0.1 -Website = stratos.apache.org \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/fb5383d7/tools/docker-images/cartridge-docker-images/service-images/tomcat/plugins/TomcatServerStarterPlugin.py ---------------------------------------------------------------------- diff --git a/tools/docker-images/cartridge-docker-images/service-images/tomcat/plugins/TomcatServerStarterPlugin.py b/tools/docker-images/cartridge-docker-images/service-images/tomcat/plugins/TomcatServerStarterPlugin.py new file mode 100644 index 0000000..6509865 --- /dev/null +++ b/tools/docker-images/cartridge-docker-images/service-images/tomcat/plugins/TomcatServerStarterPlugin.py @@ -0,0 +1,38 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +import mdsclient +from plugins.contracts import ICartridgeAgentPlugin +import time +import zipfile +import subprocess +from modules.util.log import LogFactory +import os + + +class TomcatServerStarterPlugin(ICartridgeAgentPlugin): + + def run_plugin(self, values): + log = LogFactory().get_log(__name__) + # start tomcat + tomcat_start_command = "exec ${CATALINA_HOME}/bin/startup.sh" + log.info("Starting Tomcat server: [command] %s" % tomcat_start_command) + + p = subprocess.Popen(tomcat_start_command, shell=True) + output, errors = p.communicate() + log.debug("Tomcat server started: [command] %s, [output] %s" % (p.args, output)) + http://git-wip-us.apache.org/repos/asf/stratos/blob/fb5383d7/tools/docker-images/cartridge-docker-images/service-images/tomcat/plugins/TomcatServerStarterPlugin.yapsy-plugin ---------------------------------------------------------------------- diff --git a/tools/docker-images/cartridge-docker-images/service-images/tomcat/plugins/TomcatServerStarterPlugin.yapsy-plugin b/tools/docker-images/cartridge-docker-images/service-images/tomcat/plugins/TomcatServerStarterPlugin.yapsy-plugin new file mode 100644 index 0000000..6c80de9 --- /dev/null +++ b/tools/docker-images/cartridge-docker-images/service-images/tomcat/plugins/TomcatServerStarterPlugin.yapsy-plugin @@ -0,0 +1,25 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +[Core] +Name = TomcatServerStarterPlugin to read SAML SSO related metadata needed to configure SAML SSO for apps and start tomcat +Module = TomcatServerStarterPlugin + +[Documentation] +Description = ArtifactUpdatedEvent +Author = Op1 +Version = 0.1 +Website = stratos.apache.org \ No newline at end of file
