From 889253a2dc7f050f5753d130ad39e030c94658db Mon Sep 17 00:00:00 2001 From: TiB Rkt Arimana <5566338+b23prodtm@users.noreply.github.com> Date: Tue, 2 Feb 2021 20:18:13 +0100 Subject: [PATCH] Fixes: Apache Startup and IP binding (#52) * Fixes: DocumentRoot File permissions * Fixes: ServerRoot * Fixes: setup config_a2ensite * Adds: Kubernetes Fixes: Openshift descriptors * Foxes: optimize Dockerfile --- .gitignore | 1 - .travis.yml | 3 +- Dockerfile.armhf | 69 +-- Dockerfile.template | 67 +- Dockerfile.x86_64 | 65 +- README.md | 22 + Scripts/config_a2ensite.sh | 38 +- common.env | 2 +- .../images/apache-php7/Dockerfile.armhf | 4 +- .../apache-php7/etc/apache2/conf.d/site.conf | 4 +- docker-compose.armhf | 9 +- docker-compose.x86_64 | 9 +- docker-compose.yml | 17 +- etc/services.d/apache/setup | 6 +- .../acake2php-data-persistentvolumeclaim.yaml | 14 + ...ake2php-db-data-persistentvolumeclaim.yaml | 14 + ...e2php-db-socket-persistentvolumeclaim.yaml | 14 + kubernetes/armhf/acake2php-deployment.yaml | 93 +++ kubernetes/armhf/acake2php-service.yaml | 23 + .../armhf/acake2php_cake-networkpolicy.yaml | 14 + kubernetes/armhf/db-deployment.yaml | 97 +++ kubernetes/armhf/db-service.yaml | 20 + .../acake2php-data-persistentvolumeclaim.yaml | 14 + ...ake2php-db-data-persistentvolumeclaim.yaml | 14 + ...e2php-db-socket-persistentvolumeclaim.yaml | 14 + kubernetes/x86_64/acake2php-deployment.yaml | 94 +++ kubernetes/x86_64/acake2php-service.yaml | 24 + .../x86_64/acake2php_cake-networkpolicy.yaml | 14 + kubernetes/x86_64/db-deployment.yaml | 98 +++ kubernetes/x86_64/db-service.yaml | 21 + .../acake2php-data-persistentvolumeclaim.json | 22 + ...ake2php-db-data-persistentvolumeclaim.json | 22 + ...e2php-db-socket-persistentvolumeclaim.json | 22 + openshift/templates/acake2php-deployment.json | 164 +++++ .../templates/acake2php-deploymentconfig.json | 175 ++++++ .../templates/acake2php-imagestream.json | 28 + openshift/templates/acake2php-service.json | 36 ++ .../acake2php_cake-networkpolicy.json | 28 + .../templates/cakephp-mysql-persistent.json | 577 ------------------ openshift/templates/cakephp-mysql.json | 551 ----------------- openshift/templates/cakephp.json | 343 ----------- openshift/templates/db-deployment.json | 171 ++++++ openshift/templates/db-deploymentconfig.json | 182 ++++++ openshift/templates/db-imagestream.json | 28 + openshift/templates/db-service.json | 31 + 45 files changed, 1677 insertions(+), 1601 deletions(-) create mode 100644 kubernetes/armhf/acake2php-data-persistentvolumeclaim.yaml create mode 100644 kubernetes/armhf/acake2php-db-data-persistentvolumeclaim.yaml create mode 100644 kubernetes/armhf/acake2php-db-socket-persistentvolumeclaim.yaml create mode 100644 kubernetes/armhf/acake2php-deployment.yaml create mode 100644 kubernetes/armhf/acake2php-service.yaml create mode 100644 kubernetes/armhf/acake2php_cake-networkpolicy.yaml create mode 100644 kubernetes/armhf/db-deployment.yaml create mode 100644 kubernetes/armhf/db-service.yaml create mode 100644 kubernetes/x86_64/acake2php-data-persistentvolumeclaim.yaml create mode 100644 kubernetes/x86_64/acake2php-db-data-persistentvolumeclaim.yaml create mode 100644 kubernetes/x86_64/acake2php-db-socket-persistentvolumeclaim.yaml create mode 100644 kubernetes/x86_64/acake2php-deployment.yaml create mode 100644 kubernetes/x86_64/acake2php-service.yaml create mode 100644 kubernetes/x86_64/acake2php_cake-networkpolicy.yaml create mode 100644 kubernetes/x86_64/db-deployment.yaml create mode 100644 kubernetes/x86_64/db-service.yaml create mode 100644 openshift/templates/acake2php-data-persistentvolumeclaim.json create mode 100644 openshift/templates/acake2php-db-data-persistentvolumeclaim.json create mode 100644 openshift/templates/acake2php-db-socket-persistentvolumeclaim.json create mode 100644 openshift/templates/acake2php-deployment.json create mode 100644 openshift/templates/acake2php-deploymentconfig.json create mode 100644 openshift/templates/acake2php-imagestream.json create mode 100644 openshift/templates/acake2php-service.json create mode 100644 openshift/templates/acake2php_cake-networkpolicy.json delete mode 100644 openshift/templates/cakephp-mysql-persistent.json delete mode 100644 openshift/templates/cakephp-mysql.json delete mode 100644 openshift/templates/cakephp.json create mode 100644 openshift/templates/db-deployment.json create mode 100644 openshift/templates/db-deploymentconfig.json create mode 100644 openshift/templates/db-imagestream.json create mode 100644 openshift/templates/db-service.json diff --git a/.gitignore b/.gitignore index 4fe1d6efa..5292ec58f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ ################################################# .env *.old -*.yaml *.armhf *.aarch64 *.x86_64 diff --git a/.travis.yml b/.travis.yml index 06bb3bf9f..c0ec27fe3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -94,6 +94,7 @@ install: - ./deploy.sh "$(arch)" --nobuild --exit before_script: + - mkdir -p ${MYPHPCMS_LOG} script: - if [[ "${TRAVIS_OS_NAME}" != "linux" && "${COVERITY_SCAN_BRANCH:-0}" != 1 ]]; then ./test-cake.sh --travis --phpcs || true; fi - if [[ "${TRAVIS_OS_NAME}" = "linux" && "${COVERITY_SCAN_BRANCH:-0}" != 1 ]]; then ./test-cake.sh --travis; fi @@ -104,7 +105,7 @@ after_success: - chmod +x send.sh - "./send.sh success $WEBHOOK_URL" - zip -r acake2php.zip * > /dev/null - - git tag --force "v${GIT_RELEASE_VERSION}.${TRAVIS_BUILD_NUMBER}" + - git tag --force "${GIT_RELEASE_VERSION}.${TRAVIS_BUILD_NUMBER}" deploy: provider: releases api_key: diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 6581ae096..93e63335c 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -58,11 +58,11 @@ ARG PGID ENV PGID ${PGID:-0} # Must own the ip address ARG HTTPD_LISTEN -ENV HTTPD_LISTEN ${HTTPD_LISTEN:-'0.0.0.0:80'} +ENV HTTPD_LISTEN ${HTTPD_LISTEN:-'*:80'} # Use the default production configuration #COPY $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini -# RUN [ "cross-build-start" ] +RUN [ "cross-build-start" ] RUN install_packages \ git \ openssh-client \ @@ -78,9 +78,6 @@ RUN install_packages \ libmemcached-dev # libicu libicu-dev -# just containers configuration -COPY etc /etc - WORKDIR /usr/src/ COPY vagrant-shell.sh . @@ -89,47 +86,51 @@ RUN ./vagrant-shell.sh php-settings-update extension memcached.so \ && ./vagrant-shell.sh php-settings-update session.save_handler memcached \ && ./vagrant-shell.sh php-settings-update session.save_path '127.0.0.1:11211,127.0.0.1:11212' -# Copy the source code into /var/www/html/ inside the image -COPY . /var/www/html/ +WORKDIR /var/www/localhost/htdocs/ -# Configure the application -WORKDIR /var/www/html/ - -# Change mode of bash Scripts -RUN chmod -R gu+xs deploy.sh configure.sh migrate-database.sh Scripts/ +# Copy the app source code inside the image +COPY app app -# Add cake and composer command to system path -ENV PATH "${PATH}:/var/www/html/app/Console" -ENV PATH "${PATH}:/var/www/html/app/Vendor/bin" +COPY package.json . +COPY package-lock.json . -# Enable site on httpd -RUN Scripts/config_a2ensite.sh /var/www/html/app/webroot +# Helper packages +RUN npm link balena-cloud -# Add to hosts -RUN echo "127.0.0.1 ${SERVER_NAME}" | tee -a /etc/hosts +# Create tmp directory and make it writable by the web server +RUN mkdir -p \ + app/tmp/cache/models \ + app/tmp/cache/persistent \ + app/tmp/cache/long \ + app/tmp/logs \ + && chmod -R 1777 app/tmp -# Password Hash Verbose -# RUN cat app/webroot/php_cms/e13/etc/export_hash_password.sh | awk -F= '{print $2}' | tail -n 1 +# Add cake and composer command to system path +COPY composer.json . +COPY composer.lock . +ENV PATH "${PATH}:/var/www/localhost/htdocs/app/Console" +ENV PATH "${PATH}:/var/www/localhost/htdocs/app/Vendor/bin" -# Set default working directory -WORKDIR app +# Configure the application +WORKDIR /var/www/localhost/htdocs/ -# Create tmp directory and make it writable by the web server -RUN mkdir -p \ - tmp/cache/models \ - tmp/cache/persistent \ - tmp/cache/long \ - tmp/logs \ - && chmod -R 1777 tmp +# Copy the scripts code inside the image +COPY . . -# Helper packages -RUN npm link balena-cloud +# Change mode of bash Scripts +RUN chmod -R gu+xs deploy.sh configure.sh migrate-database.sh Scripts/ -WORKDIR /var/www/html/ +# Password Hash Verbose +# RUN cat app/webroot/php_cms/e13/etc/export_hash_password.sh | awk -F= '{print $2}' | tail -n 1 RUN chmod 0755 *.sh RUN ./deploy.sh ${DKR_ARCH} --nobuild --exit \ && ./configure.sh --openshift -m -c -h -p pass -s word --development -# RUN [ "cross-build-end" ] + +# just containers configuration +COPY etc /etc + +RUN [ "cross-build-end" ] ENTRYPOINT ./migrate-database.sh -o -u -i --enable-authentication-plugin && /init +EXPOSE 80 443 diff --git a/Dockerfile.template b/Dockerfile.template index 21155e68a..e106850aa 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -23,7 +23,7 @@ ARG CAKEPHP_DEBUG_LEVEL ENV CAKEPHP_DEBUG_LEVEL ${CAKEPHP_DEBUG_LEVEL:-2} ENV BALENA_MACHINE_NAME ${BALENA_MACHINE_NAME:-%%BALENA_MACHINE_NAME%%} ARG SECONDARY_HUB -ENV SECONDARY_HUB ${SECONDARY_HUB:-'linuxserver\\/mariadb'} +ENV SECONDARY_HUB ${SECONDARY_HUB:-'linuxserver/mariadb'} ENV DKR_ARCH ${DKR_ARCH:-%%BALENA_ARCH%%} ARG COLLECT_COVERAGE ENV COLLECT_COVERAGE ${COLLECT_COVERAGE:-'False'} @@ -58,7 +58,7 @@ ARG PGID ENV PGID ${PGID:-0} # Must own the ip address ARG HTTPD_LISTEN -ENV HTTPD_LISTEN ${HTTPD_LISTEN:-'0.0.0.0:80'} +ENV HTTPD_LISTEN ${HTTPD_LISTEN:-'*:80'} # Use the default production configuration #COPY $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini @@ -78,9 +78,6 @@ RUN install_packages \ libmemcached-dev # libicu libicu-dev -# just containers configuration -COPY etc /etc - WORKDIR /usr/src/ COPY vagrant-shell.sh . @@ -89,47 +86,51 @@ RUN ./vagrant-shell.sh php-settings-update extension memcached.so \ && ./vagrant-shell.sh php-settings-update session.save_handler memcached \ && ./vagrant-shell.sh php-settings-update session.save_path '127.0.0.1:11211,127.0.0.1:11212' -# Copy the source code into /var/www/html/ inside the image -COPY . /var/www/html/ +WORKDIR /var/www/localhost/htdocs/ -# Configure the application -WORKDIR /var/www/html/ - -# Change mode of bash Scripts -RUN chmod -R gu+xs deploy.sh configure.sh migrate-database.sh Scripts/ +# Copy the app source code inside the image +COPY app app -# Add cake and composer command to system path -ENV PATH "${PATH}:/var/www/html/app/Console" -ENV PATH "${PATH}:/var/www/html/app/Vendor/bin" +COPY package.json . +COPY package-lock.json . -# Enable site on httpd -RUN Scripts/config_a2ensite.sh /var/www/html/app/webroot +# Helper packages +RUN npm link balena-cloud -# Add to hosts -RUN echo "127.0.0.1 ${SERVER_NAME}" | tee -a /etc/hosts +# Create tmp directory and make it writable by the web server +RUN mkdir -p \ + app/tmp/cache/models \ + app/tmp/cache/persistent \ + app/tmp/cache/long \ + app/tmp/logs \ + && chmod -R 1777 app/tmp -# Password Hash Verbose -# RUN cat app/webroot/php_cms/e13/etc/export_hash_password.sh | awk -F= '{print $2}' | tail -n 1 +# Add cake and composer command to system path +COPY composer.json . +COPY composer.lock . +ENV PATH "${PATH}:/var/www/localhost/htdocs/app/Console" +ENV PATH "${PATH}:/var/www/localhost/htdocs/app/Vendor/bin" -# Set default working directory -WORKDIR app +# Configure the application +WORKDIR /var/www/localhost/htdocs/ -# Create tmp directory and make it writable by the web server -RUN mkdir -p \ - tmp/cache/models \ - tmp/cache/persistent \ - tmp/cache/long \ - tmp/logs \ - && chmod -R 1777 tmp +# Copy the scripts code inside the image +COPY . . -# Helper packages -RUN npm link balena-cloud +# Change mode of bash Scripts +RUN chmod -R gu+xs deploy.sh configure.sh migrate-database.sh Scripts/ -WORKDIR /var/www/html/ +# Password Hash Verbose +# RUN cat app/webroot/php_cms/e13/etc/export_hash_password.sh | awk -F= '{print $2}' | tail -n 1 RUN chmod 0755 *.sh RUN ./deploy.sh ${DKR_ARCH} --nobuild --exit \ && ./configure.sh --openshift -m -c -h -p pass -s word --development + +# just containers configuration +COPY etc /etc + # RUN [ "cross-build-end" ] ENTRYPOINT ./migrate-database.sh -o -u -i --enable-authentication-plugin && /init +EXPOSE 80 443 diff --git a/Dockerfile.x86_64 b/Dockerfile.x86_64 index 4419f994e..11f7d83dc 100644 --- a/Dockerfile.x86_64 +++ b/Dockerfile.x86_64 @@ -58,7 +58,7 @@ ARG PGID ENV PGID ${PGID:-0} # Must own the ip address ARG HTTPD_LISTEN -ENV HTTPD_LISTEN ${HTTPD_LISTEN:-'0.0.0.0:80'} +ENV HTTPD_LISTEN ${HTTPD_LISTEN:-'*:80'} # Use the default production configuration #COPY $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini @@ -78,9 +78,6 @@ RUN install_packages \ libmemcached-dev # libicu libicu-dev -# just containers configuration -COPY etc /etc - WORKDIR /usr/src/ COPY vagrant-shell.sh . @@ -89,47 +86,51 @@ RUN ./vagrant-shell.sh php-settings-update extension memcached.so \ && ./vagrant-shell.sh php-settings-update session.save_handler memcached \ && ./vagrant-shell.sh php-settings-update session.save_path '127.0.0.1:11211,127.0.0.1:11212' -# Copy the source code into /var/www/html/ inside the image -COPY . /var/www/html/ +WORKDIR /var/www/localhost/htdocs/ -# Configure the application -WORKDIR /var/www/html/ - -# Change mode of bash Scripts -RUN chmod -R gu+xs deploy.sh configure.sh migrate-database.sh Scripts/ +# Copy the app source code inside the image +COPY app app -# Add cake and composer command to system path -ENV PATH "${PATH}:/var/www/html/app/Console" -ENV PATH "${PATH}:/var/www/html/app/Vendor/bin" +COPY package.json . +COPY package-lock.json . -# Enable site on httpd -RUN Scripts/config_a2ensite.sh /var/www/html/app/webroot +# Helper packages +RUN npm link balena-cloud -# Add to hosts -RUN echo "127.0.0.1 ${SERVER_NAME}" | tee -a /etc/hosts +# Create tmp directory and make it writable by the web server +RUN mkdir -p \ + app/tmp/cache/models \ + app/tmp/cache/persistent \ + app/tmp/cache/long \ + app/tmp/logs \ + && chmod -R 1777 app/tmp -# Password Hash Verbose -# RUN cat app/webroot/php_cms/e13/etc/export_hash_password.sh | awk -F= '{print $2}' | tail -n 1 +# Add cake and composer command to system path +COPY composer.json . +COPY composer.lock . +ENV PATH "${PATH}:/var/www/localhost/htdocs/app/Console" +ENV PATH "${PATH}:/var/www/localhost/htdocs/app/Vendor/bin" -# Set default working directory -WORKDIR app +# Configure the application +WORKDIR /var/www/localhost/htdocs/ -# Create tmp directory and make it writable by the web server -RUN mkdir -p \ - tmp/cache/models \ - tmp/cache/persistent \ - tmp/cache/long \ - tmp/logs \ - && chmod -R 1777 tmp +# Copy the scripts code inside the image +COPY . . -# Helper packages -RUN npm link balena-cloud +# Change mode of bash Scripts +RUN chmod -R gu+xs deploy.sh configure.sh migrate-database.sh Scripts/ -WORKDIR /var/www/html/ +# Password Hash Verbose +# RUN cat app/webroot/php_cms/e13/etc/export_hash_password.sh | awk -F= '{print $2}' | tail -n 1 RUN chmod 0755 *.sh RUN ./deploy.sh ${DKR_ARCH} --nobuild --exit \ && ./configure.sh --openshift -m -c -h -p pass -s word --development + +# just containers configuration +COPY etc /etc + # RUN [ "cross-build-end" ] ENTRYPOINT ./migrate-database.sh -o -u -i --enable-authentication-plugin && /init +EXPOSE 80 443 diff --git a/README.md b/README.md index b7c9adfcd..b864e6b8a 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,28 @@ The following additional variables must be set up as server secrets environment, # Generated by ./configure.sh -h GET_HASH_PASSWORD: + MYSQL_DATABASE + aria_db + + MYSQL_HOST + db + + MYSQL_PASSWORD + maria-abc + + MYSQL_ROOT_PASSWORD + mariadb + + MYSQL_TCP_PORT + 3306 + + MYSQL_USER + maria + + SERVER_NAME + + + ### Database Configuration An SQL server (must match remote server version) must be reachable by hostname or via its socket. If it's the 1st time you use this connection, diff --git a/Scripts/config_a2ensite.sh b/Scripts/config_a2ensite.sh index 941567d6a..dd3640f1e 100755 --- a/Scripts/config_a2ensite.sh +++ b/Scripts/config_a2ensite.sh @@ -1,12 +1,15 @@ #!/usr/bin/env bash set -eu +. init_functions . +log_daemon_msg "Add VirtualHost $HTTPD_LISTEN" CNF="/etc/apache2" -WWW="${1:-/var/www/localhost/htdocs}" +WWW="${1:-localhost/htdocs}" mkdir -p "$(dirname "$CNF")" mkdir -p "$(dirname "$WWW")" touch site.conf echo -e " + AllowOverride All Require all denied @@ -20,12 +23,41 @@ echo -e " AllowOverride All Require all granted - ErrorLog /var/log/apache2/error.${SERVER_NAME}.log - CustomLog /var/log/apache2/access.${SERVER_NAME}.log combined + ErrorLog logs/error.${SERVER_NAME}.log + TransferLog logs/access.${SERVER_NAME}.log ServerName ${SERVER_NAME} " >> site.conf cat site.conf mv site.conf "${CNF}/conf.d/" +log_daemon_msg "SSL VirtualHost" +touch ssl_site.conf +echo -e " + + DocumentRoot ${WWW} + ServerAdmin webmaster@${SERVER_NAME} + ServerName ${SERVER_NAME}:443 + ServerAlias www.${SERVER_NAME}:443 + + DirectoryIndex index.php + Options +FollowSymLinks + AllowOverride All + Require all granted + + ErrorLog logs/ssl_error.${SERVER_NAME}.log + TransferLog logs/ssl_access.${SERVER_NAME}.log + SSLEngine on + SSLCertificateFile /etc/ssl/apache2/server.pem + SSLCertificateKeyFile /etc/ssl/apache2/server.key + #SSLCertificateChainFile /etc/ssl/apache2/server-ca.pem + #SSLCACertificatePath /etc/ssl/apache2/ssl.crt + #SSLCACertificateFile /etc/ssl/apache2/ssl.crt/ca-bundle.pem + +" >> ssl_site.conf +cat ssl_site.conf +mv ssl_site.conf "${CNF}/conf.d/" +log_daemon_msg "Enable mod_rewrite" sed -i.old -E -e "/mod_rewrite.so/s/^#+//g" "${CNF}/httpd.conf" grep mod_rewrite.so < "${CNF}/httpd.conf" +log_daemon_msg "Add www hosts $SERVER_NAME" +sed -i "/127.0.0.1/s/(localhost)/\\1 ${SERVER_NAME} www.${SERVER_NAME}/" /etc/hosts diff --git a/common.env b/common.env index 49ef34b41..fd59a0c75 100644 --- a/common.env +++ b/common.env @@ -1,6 +1,6 @@ PGID=1000 PUID=1000 -HTTPD_LISTEN=0.0.0.0:80 +HTTPD_LISTEN=*:80 BALENA_PROJECTS_FLAGS=(IMG_TAG PRIMARY_HUB SECONDARY_HUB) COLLECT_COVERAGE=false DATABASE_USER=root diff --git a/deployment/images/apache-php7/Dockerfile.armhf b/deployment/images/apache-php7/Dockerfile.armhf index 90ea7a964..fd7720d1a 100644 --- a/deployment/images/apache-php7/Dockerfile.armhf +++ b/deployment/images/apache-php7/Dockerfile.armhf @@ -3,7 +3,7 @@ # S6 Overlay: https://github.com/smebberson/docker-alpine/blob/master/alpine-apache/Dockerfile # FROM balenalib/raspberrypi3-alpine-node:build -# RUN [ "cross-build-start" ] +RUN [ "cross-build-start" ] ARG PHP_LIB ENV PHP_LIB ${PHP_LIB:-7} @@ -103,4 +103,4 @@ ADD "https://raw.githubusercontent.com/b23prodtm/docker-systemctl-replacement/ma RUN chmod g+xs /bin/systemctl ENTRYPOINT /init -# RUN [ "cross-build-end" ] +RUN [ "cross-build-end" ] diff --git a/deployment/images/apache-php7/etc/apache2/conf.d/site.conf b/deployment/images/apache-php7/etc/apache2/conf.d/site.conf index 679401f30..bc3cbee3e 100644 --- a/deployment/images/apache-php7/etc/apache2/conf.d/site.conf +++ b/deployment/images/apache-php7/etc/apache2/conf.d/site.conf @@ -1,7 +1,7 @@ ServerAdmin webmaster@localhost - DocumentRoot /var/www/html - + DocumentRoot localhost/htdocs + Options FollowSymLinks AllowOverride All Order allow,deny diff --git a/docker-compose.armhf b/docker-compose.armhf index 0acfcdabb..e5dedda75 100644 --- a/docker-compose.armhf +++ b/docker-compose.armhf @@ -17,7 +17,7 @@ services: volumes: - db-data:/config - db-socket:/var/run/mysqld - - data:/var/www/html + - data:/var/www ports: - "3306:3306" restart: unless-stopped @@ -40,16 +40,15 @@ services: MYSQL_HOST: "db" PUID: 1000 PGID: 1000 - HTTPD_LISTEN: "0.0.0.0:80" image: betothreeprod/acake2php-raspberrypi3 labels: io.balena.features.dbus: "1" volumes: - - data:/var/www/html + - data:/var/www - db-socket:/var/run/mysqld ports: - #Dockerfile's exposed 80 (through apache2), forward 8000 as of CakePHP default port setting - - "80:8000" + - "80:80" + - "443:443" depends_on: - db networks: diff --git a/docker-compose.x86_64 b/docker-compose.x86_64 index 6c051b8e6..cd6d8e3e5 100644 --- a/docker-compose.x86_64 +++ b/docker-compose.x86_64 @@ -17,7 +17,7 @@ services: volumes: - db-data:/config - db-socket:/var/run/mysqld - - data:/var/www/html + - data:/var/www ports: - "3306:3306" restart: unless-stopped @@ -40,16 +40,15 @@ services: MYSQL_HOST: "db" PUID: 1000 PGID: 1000 - HTTPD_LISTEN: "127.0.0.1:80" image: betothreeprod/acake2php-intel-nuc labels: io.balena.features.dbus: "1" volumes: - - data:/var/www/html + - data:/var/www - db-socket:/var/run/mysqld ports: - #Dockerfile's exposed 80 (through apache2), forward 8000 as of CakePHP default port setting - - "80:8000" + - "80:80" + - "443:443" depends_on: - db networks: diff --git a/docker-compose.yml b/docker-compose.yml index 61e22d89e..e5dedda75 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ services: db: build: context: mysqldb - dockerfile: Dockerfile.template + dockerfile: Dockerfile.armhf args: PUID: 0 PGID: 0 @@ -13,11 +13,11 @@ services: MYSQL_DATABASE: aria_db MYSQL_USER: maria MYSQL_PASSWORD: maria-abc - image: betothreeprod/mariadb-%%BALENA_MACHINE_NAME%% + image: betothreeprod/mariadb-raspberrypi3 volumes: - db-data:/config - db-socket:/var/run/mysqld - - data:/var/www/html + - data:/var/www ports: - "3306:3306" restart: unless-stopped @@ -34,22 +34,21 @@ services: - .env build: context: . - dockerfile: Dockerfile.template + dockerfile: Dockerfile.armhf args: CAKEPHP_DEBUG_LEVEL: "2" MYSQL_HOST: "db" PUID: 1000 PGID: 1000 - HTTPD_LISTEN: "0.0.0.0:80" - image: betothreeprod/acake2php-%%BALENA_MACHINE_NAME%% + image: betothreeprod/acake2php-raspberrypi3 labels: io.balena.features.dbus: "1" volumes: - - data:/var/www/html + - data:/var/www - db-socket:/var/run/mysqld ports: - #Dockerfile's exposed 80 (through apache2), forward 8000 as of CakePHP default port setting - - "80:8000" + - "80:80" + - "443:443" depends_on: - db networks: diff --git a/etc/services.d/apache/setup b/etc/services.d/apache/setup index dc8a382a8..19801070a 100755 --- a/etc/services.d/apache/setup +++ b/etc/services.d/apache/setup @@ -1,5 +1,4 @@ #!/usr/bin/with-contenv sh - if grep www-data < /etc/group; then id www-data else @@ -10,6 +9,9 @@ if grep www-data < /etc/passwd; then else adduser --ingroup www-data --system www-data fi - +SERVER_ROOT=$(grep "^ServerRoot" < /etc/apache2/httpd.conf | awk '{ print $2 }' | sed "s/\"//g") +chown -R www-data:www-data "$SERVER_ROOT" \ + && chmod -R g+s "$SERVER_ROOT" +bash -c "${SERVER_ROOT}/localhost/htdocs/Scripts/config_a2ensite.sh localhost/htdocs/app/webroot" memcached -d -l 127.0.0.1 -p 11211 -u www-data -m 16 \ && memcached -d -l 127.0.0.1 -p 11212 -u www-data -m 16 diff --git a/kubernetes/armhf/acake2php-data-persistentvolumeclaim.yaml b/kubernetes/armhf/acake2php-data-persistentvolumeclaim.yaml new file mode 100644 index 000000000..4b4f1be84 --- /dev/null +++ b/kubernetes/armhf/acake2php-data-persistentvolumeclaim.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: acake2php-data + name: acake2php-data +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +status: {} diff --git a/kubernetes/armhf/acake2php-db-data-persistentvolumeclaim.yaml b/kubernetes/armhf/acake2php-db-data-persistentvolumeclaim.yaml new file mode 100644 index 000000000..43b1c9942 --- /dev/null +++ b/kubernetes/armhf/acake2php-db-data-persistentvolumeclaim.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: acake2php-db-data + name: acake2php-db-data +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +status: {} diff --git a/kubernetes/armhf/acake2php-db-socket-persistentvolumeclaim.yaml b/kubernetes/armhf/acake2php-db-socket-persistentvolumeclaim.yaml new file mode 100644 index 000000000..9de54c1e6 --- /dev/null +++ b/kubernetes/armhf/acake2php-db-socket-persistentvolumeclaim.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: acake2php-db-socket + name: acake2php-db-socket +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +status: {} diff --git a/kubernetes/armhf/acake2php-deployment.yaml b/kubernetes/armhf/acake2php-deployment.yaml new file mode 100644 index 000000000..227b48acd --- /dev/null +++ b/kubernetes/armhf/acake2php-deployment.yaml @@ -0,0 +1,93 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + io.balena.features.dbus: "1" + kompose.cmd: kompose convert --controller deployment -o kubernetes/armhf/ -f docker-compose.armhf + kompose.version: 1.21.0 (992df58d8) + creationTimestamp: null + labels: + io.kompose.service: acake2php + name: acake2php +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: acake2php + strategy: + type: Recreate + template: + metadata: + annotations: + io.balena.features.dbus: "1" + kompose.cmd: kompose convert --controller deployment -o kubernetes/armhf/ + -f docker-compose.armhf + kompose.version: 1.21.0 (992df58d8) + creationTimestamp: null + labels: + io.kompose.network/acake2php_cake: "true" + io.kompose.service: acake2php + spec: + containers: + - env: + - name: BALENA_MACHINE_NAME + value: raspberrypi3 + - name: BALENA_PROJECTS + value: '(. ./mysqldb ./deployment/images/node-php7 ./deployment/images/apache-php7) + #(submodule deployment/images/primary' + - name: BALENA_PROJECTS_FLAGS + value: (IMG_TAG PRIMARY_HUB SECONDARY_HUB) + - name: CAKEPHP_DEBUG_LEVEL + value: "1" + - name: CAKEPHP_SECURITY_CIPHER_SEED + value: "01234" + - name: CAKEPHP_SECURITY_SALT + value: Word + - name: COLLECT_COVERAGE + value: "false" + - name: DATABASE_USER + value: root + - name: DKR_ARCH + value: armhf + - name: HTTPD_LISTEN + value: '*:80' + - name: IMG_TAG + value: latest + - name: MYPHPCMS_DIR + value: app/webroot/php_cms + - name: MYPHPCMS_LOG + value: app/tmp/logs + - name: PGID + value: "1000" + - name: PRIMARY_HUB + value: betothreeprod/apache-php7 + - name: PUID + value: "1000" + - name: SECONDARY_HUB + value: betothreeprod/mariadb-raspberrypi3 + - name: SERVER_NAME + value: acake2php.local + - name: TZ + value: Europe/Paris + image: betothreeprod/acake2php-raspberrypi3 + imagePullPolicy: "" + name: acake2php + ports: + - containerPort: 80 + - containerPort: 443 + resources: {} + volumeMounts: + - mountPath: /var/www + name: acake2php-data + - mountPath: /var/run/mysqld + name: acake2php-db-socket + restartPolicy: Always + serviceAccountName: "" + volumes: + - name: acake2php-data + persistentVolumeClaim: + claimName: acake2php-data + - name: acake2php-db-socket + persistentVolumeClaim: + claimName: acake2php-db-socket +status: {} diff --git a/kubernetes/armhf/acake2php-service.yaml b/kubernetes/armhf/acake2php-service.yaml new file mode 100644 index 000000000..ab61f4e18 --- /dev/null +++ b/kubernetes/armhf/acake2php-service.yaml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + io.balena.features.dbus: "1" + kompose.cmd: kompose convert --controller deployment -o kubernetes/armhf/ -f docker-compose.armhf + kompose.version: 1.21.0 (992df58d8) + creationTimestamp: null + labels: + io.kompose.service: acake2php + name: acake2php +spec: + ports: + - name: "80" + port: 80 + targetPort: 80 + - name: "443" + port: 443 + targetPort: 443 + selector: + io.kompose.service: acake2php +status: + loadBalancer: {} diff --git a/kubernetes/armhf/acake2php_cake-networkpolicy.yaml b/kubernetes/armhf/acake2php_cake-networkpolicy.yaml new file mode 100644 index 000000000..540fce6d3 --- /dev/null +++ b/kubernetes/armhf/acake2php_cake-networkpolicy.yaml @@ -0,0 +1,14 @@ +apiVersion: extensions/v1beta1 +kind: NetworkPolicy +metadata: + creationTimestamp: null + name: acake2php_cake +spec: + ingress: + - from: + - podSelector: + matchLabels: + io.kompose.network/acake2php_cake: "true" + podSelector: + matchLabels: + io.kompose.network/acake2php_cake: "true" diff --git a/kubernetes/armhf/db-deployment.yaml b/kubernetes/armhf/db-deployment.yaml new file mode 100644 index 000000000..35b4bff88 --- /dev/null +++ b/kubernetes/armhf/db-deployment.yaml @@ -0,0 +1,97 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + io.balena.features.dbus: "1" + kompose.cmd: kompose convert --controller deployment -o kubernetes/armhf/ -f docker-compose.armhf + kompose.version: 1.21.0 (992df58d8) + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: db + strategy: + type: Recreate + template: + metadata: + annotations: + io.balena.features.dbus: "1" + kompose.cmd: kompose convert --controller deployment -o kubernetes/armhf/ + -f docker-compose.armhf + kompose.version: 1.21.0 (992df58d8) + creationTimestamp: null + labels: + io.kompose.network/acake2php_cake: "true" + io.kompose.service: db + spec: + containers: + - env: + - name: BALENA_MACHINE_NAME + value: raspberrypi3 + - name: BALENA_PROJECTS + value: '(. ./mysqldb ./deployment/images/node-php7 ./deployment/images/apache-php7) + #(submodule deployment/images/primary' + - name: BALENA_PROJECTS_FLAGS + value: (IMG_TAG PRIMARY_HUB SECONDARY_HUB) + - name: CAKEPHP_DEBUG_LEVEL + value: "1" + - name: CAKEPHP_SECURITY_CIPHER_SEED + value: "01234" + - name: CAKEPHP_SECURITY_SALT + value: Word + - name: COLLECT_COVERAGE + value: "false" + - name: DATABASE_USER + value: root + - name: DKR_ARCH + value: armhf + - name: HTTPD_LISTEN + value: '*:80' + - name: IMG_TAG + value: latest + - name: MYPHPCMS_DIR + value: app/webroot/php_cms + - name: MYPHPCMS_LOG + value: app/tmp/logs + - name: PGID + value: "1000" + - name: PRIMARY_HUB + value: betothreeprod/apache-php7 + - name: PUID + value: "1000" + - name: SECONDARY_HUB + value: betothreeprod/mariadb-raspberrypi3 + - name: SERVER_NAME + value: acake2php.local + - name: TZ + value: Europe/Paris + image: betothreeprod/mariadb-raspberrypi3 + imagePullPolicy: "" + name: db + ports: + - containerPort: 3306 + resources: {} + volumeMounts: + - mountPath: /config + name: acake2php-db-data + - mountPath: /var/run/mysqld + name: acake2php-db-socket + - mountPath: /var/www + name: acake2php-data + restartPolicy: Always + serviceAccountName: "" + volumes: + - name: acake2php-db-data + persistentVolumeClaim: + claimName: acake2php-db-data + - name: acake2php-db-socket + persistentVolumeClaim: + claimName: acake2php-db-socket + - name: acake2php-data + persistentVolumeClaim: + claimName: acake2php-data +status: {} diff --git a/kubernetes/armhf/db-service.yaml b/kubernetes/armhf/db-service.yaml new file mode 100644 index 000000000..646f201ee --- /dev/null +++ b/kubernetes/armhf/db-service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + io.balena.features.dbus: "1" + kompose.cmd: kompose convert --controller deployment -o kubernetes/armhf/ -f docker-compose.armhf + kompose.version: 1.21.0 (992df58d8) + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + ports: + - name: "3306" + port: 3306 + targetPort: 3306 + selector: + io.kompose.service: db +status: + loadBalancer: {} diff --git a/kubernetes/x86_64/acake2php-data-persistentvolumeclaim.yaml b/kubernetes/x86_64/acake2php-data-persistentvolumeclaim.yaml new file mode 100644 index 000000000..4b4f1be84 --- /dev/null +++ b/kubernetes/x86_64/acake2php-data-persistentvolumeclaim.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: acake2php-data + name: acake2php-data +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +status: {} diff --git a/kubernetes/x86_64/acake2php-db-data-persistentvolumeclaim.yaml b/kubernetes/x86_64/acake2php-db-data-persistentvolumeclaim.yaml new file mode 100644 index 000000000..43b1c9942 --- /dev/null +++ b/kubernetes/x86_64/acake2php-db-data-persistentvolumeclaim.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: acake2php-db-data + name: acake2php-db-data +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +status: {} diff --git a/kubernetes/x86_64/acake2php-db-socket-persistentvolumeclaim.yaml b/kubernetes/x86_64/acake2php-db-socket-persistentvolumeclaim.yaml new file mode 100644 index 000000000..9de54c1e6 --- /dev/null +++ b/kubernetes/x86_64/acake2php-db-socket-persistentvolumeclaim.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: acake2php-db-socket + name: acake2php-db-socket +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +status: {} diff --git a/kubernetes/x86_64/acake2php-deployment.yaml b/kubernetes/x86_64/acake2php-deployment.yaml new file mode 100644 index 000000000..3455b620e --- /dev/null +++ b/kubernetes/x86_64/acake2php-deployment.yaml @@ -0,0 +1,94 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + io.balena.features.dbus: "1" + kompose.cmd: kompose convert --controller deployment -o kubernetes/x86_64/ -f + docker-compose.x86_64 + kompose.version: 1.21.0 (992df58d8) + creationTimestamp: null + labels: + io.kompose.service: acake2php + name: acake2php +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: acake2php + strategy: + type: Recreate + template: + metadata: + annotations: + io.balena.features.dbus: "1" + kompose.cmd: kompose convert --controller deployment -o kubernetes/x86_64/ + -f docker-compose.x86_64 + kompose.version: 1.21.0 (992df58d8) + creationTimestamp: null + labels: + io.kompose.network/acake2php_cake: "true" + io.kompose.service: acake2php + spec: + containers: + - env: + - name: BALENA_MACHINE_NAME + value: raspberrypi3 + - name: BALENA_PROJECTS + value: '(. ./mysqldb ./deployment/images/node-php7 ./deployment/images/apache-php7) + #(submodule deployment/images/primary' + - name: BALENA_PROJECTS_FLAGS + value: (IMG_TAG PRIMARY_HUB SECONDARY_HUB) + - name: CAKEPHP_DEBUG_LEVEL + value: "1" + - name: CAKEPHP_SECURITY_CIPHER_SEED + value: "01234" + - name: CAKEPHP_SECURITY_SALT + value: Word + - name: COLLECT_COVERAGE + value: "false" + - name: DATABASE_USER + value: root + - name: DKR_ARCH + value: armhf + - name: HTTPD_LISTEN + value: '*:80' + - name: IMG_TAG + value: latest + - name: MYPHPCMS_DIR + value: app/webroot/php_cms + - name: MYPHPCMS_LOG + value: app/tmp/logs + - name: PGID + value: "1000" + - name: PRIMARY_HUB + value: betothreeprod/apache-php7 + - name: PUID + value: "1000" + - name: SECONDARY_HUB + value: betothreeprod/mariadb-raspberrypi3 + - name: SERVER_NAME + value: acake2php.local + - name: TZ + value: Europe/Paris + image: betothreeprod/acake2php-intel-nuc + imagePullPolicy: "" + name: acake2php + ports: + - containerPort: 80 + - containerPort: 443 + resources: {} + volumeMounts: + - mountPath: /var/www + name: acake2php-data + - mountPath: /var/run/mysqld + name: acake2php-db-socket + restartPolicy: Always + serviceAccountName: "" + volumes: + - name: acake2php-data + persistentVolumeClaim: + claimName: acake2php-data + - name: acake2php-db-socket + persistentVolumeClaim: + claimName: acake2php-db-socket +status: {} diff --git a/kubernetes/x86_64/acake2php-service.yaml b/kubernetes/x86_64/acake2php-service.yaml new file mode 100644 index 000000000..51f36df15 --- /dev/null +++ b/kubernetes/x86_64/acake2php-service.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + io.balena.features.dbus: "1" + kompose.cmd: kompose convert --controller deployment -o kubernetes/x86_64/ -f + docker-compose.x86_64 + kompose.version: 1.21.0 (992df58d8) + creationTimestamp: null + labels: + io.kompose.service: acake2php + name: acake2php +spec: + ports: + - name: "80" + port: 80 + targetPort: 80 + - name: "443" + port: 443 + targetPort: 443 + selector: + io.kompose.service: acake2php +status: + loadBalancer: {} diff --git a/kubernetes/x86_64/acake2php_cake-networkpolicy.yaml b/kubernetes/x86_64/acake2php_cake-networkpolicy.yaml new file mode 100644 index 000000000..540fce6d3 --- /dev/null +++ b/kubernetes/x86_64/acake2php_cake-networkpolicy.yaml @@ -0,0 +1,14 @@ +apiVersion: extensions/v1beta1 +kind: NetworkPolicy +metadata: + creationTimestamp: null + name: acake2php_cake +spec: + ingress: + - from: + - podSelector: + matchLabels: + io.kompose.network/acake2php_cake: "true" + podSelector: + matchLabels: + io.kompose.network/acake2php_cake: "true" diff --git a/kubernetes/x86_64/db-deployment.yaml b/kubernetes/x86_64/db-deployment.yaml new file mode 100644 index 000000000..0d13bab10 --- /dev/null +++ b/kubernetes/x86_64/db-deployment.yaml @@ -0,0 +1,98 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + io.balena.features.dbus: "1" + kompose.cmd: kompose convert --controller deployment -o kubernetes/x86_64/ -f + docker-compose.x86_64 + kompose.version: 1.21.0 (992df58d8) + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: db + strategy: + type: Recreate + template: + metadata: + annotations: + io.balena.features.dbus: "1" + kompose.cmd: kompose convert --controller deployment -o kubernetes/x86_64/ + -f docker-compose.x86_64 + kompose.version: 1.21.0 (992df58d8) + creationTimestamp: null + labels: + io.kompose.network/acake2php_cake: "true" + io.kompose.service: db + spec: + containers: + - env: + - name: BALENA_MACHINE_NAME + value: raspberrypi3 + - name: BALENA_PROJECTS + value: '(. ./mysqldb ./deployment/images/node-php7 ./deployment/images/apache-php7) + #(submodule deployment/images/primary' + - name: BALENA_PROJECTS_FLAGS + value: (IMG_TAG PRIMARY_HUB SECONDARY_HUB) + - name: CAKEPHP_DEBUG_LEVEL + value: "1" + - name: CAKEPHP_SECURITY_CIPHER_SEED + value: "01234" + - name: CAKEPHP_SECURITY_SALT + value: Word + - name: COLLECT_COVERAGE + value: "false" + - name: DATABASE_USER + value: root + - name: DKR_ARCH + value: armhf + - name: HTTPD_LISTEN + value: '*:80' + - name: IMG_TAG + value: latest + - name: MYPHPCMS_DIR + value: app/webroot/php_cms + - name: MYPHPCMS_LOG + value: app/tmp/logs + - name: PGID + value: "1000" + - name: PRIMARY_HUB + value: betothreeprod/apache-php7 + - name: PUID + value: "1000" + - name: SECONDARY_HUB + value: betothreeprod/mariadb-raspberrypi3 + - name: SERVER_NAME + value: acake2php.local + - name: TZ + value: Europe/Paris + image: betothreeprod/mariadb-intel-nuc + imagePullPolicy: "" + name: db + ports: + - containerPort: 3306 + resources: {} + volumeMounts: + - mountPath: /config + name: acake2php-db-data + - mountPath: /var/run/mysqld + name: acake2php-db-socket + - mountPath: /var/www + name: acake2php-data + restartPolicy: Always + serviceAccountName: "" + volumes: + - name: acake2php-db-data + persistentVolumeClaim: + claimName: acake2php-db-data + - name: acake2php-db-socket + persistentVolumeClaim: + claimName: acake2php-db-socket + - name: acake2php-data + persistentVolumeClaim: + claimName: acake2php-data +status: {} diff --git a/kubernetes/x86_64/db-service.yaml b/kubernetes/x86_64/db-service.yaml new file mode 100644 index 000000000..e339a5d8b --- /dev/null +++ b/kubernetes/x86_64/db-service.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + io.balena.features.dbus: "1" + kompose.cmd: kompose convert --controller deployment -o kubernetes/x86_64/ -f + docker-compose.x86_64 + kompose.version: 1.21.0 (992df58d8) + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + ports: + - name: "3306" + port: 3306 + targetPort: 3306 + selector: + io.kompose.service: db +status: + loadBalancer: {} diff --git a/openshift/templates/acake2php-data-persistentvolumeclaim.json b/openshift/templates/acake2php-data-persistentvolumeclaim.json new file mode 100644 index 000000000..7afdb6e75 --- /dev/null +++ b/openshift/templates/acake2php-data-persistentvolumeclaim.json @@ -0,0 +1,22 @@ +{ + "kind": "PersistentVolumeClaim", + "apiVersion": "v1", + "metadata": { + "name": "acake2php-data", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "acake2php-data" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Mi" + } + } + }, + "status": {} +} \ No newline at end of file diff --git a/openshift/templates/acake2php-db-data-persistentvolumeclaim.json b/openshift/templates/acake2php-db-data-persistentvolumeclaim.json new file mode 100644 index 000000000..d87fc1d4a --- /dev/null +++ b/openshift/templates/acake2php-db-data-persistentvolumeclaim.json @@ -0,0 +1,22 @@ +{ + "kind": "PersistentVolumeClaim", + "apiVersion": "v1", + "metadata": { + "name": "acake2php-db-data", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "acake2php-db-data" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Mi" + } + } + }, + "status": {} +} \ No newline at end of file diff --git a/openshift/templates/acake2php-db-socket-persistentvolumeclaim.json b/openshift/templates/acake2php-db-socket-persistentvolumeclaim.json new file mode 100644 index 000000000..bf4ad583b --- /dev/null +++ b/openshift/templates/acake2php-db-socket-persistentvolumeclaim.json @@ -0,0 +1,22 @@ +{ + "kind": "PersistentVolumeClaim", + "apiVersion": "v1", + "metadata": { + "name": "acake2php-db-socket", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "acake2php-db-socket" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Mi" + } + } + }, + "status": {} +} \ No newline at end of file diff --git a/openshift/templates/acake2php-deployment.json b/openshift/templates/acake2php-deployment.json new file mode 100644 index 000000000..99b643da1 --- /dev/null +++ b/openshift/templates/acake2php-deployment.json @@ -0,0 +1,164 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "io.balena.features.dbus": "1", + "kompose.cmd": "kompose convert --build build-config --controller deployment -o openshift/templates/ -f docker-compose.x86_64 -j", + "kompose.version": "1.21.0 (992df58d8)" + }, + "creationTimestamp": null, + "labels": { + "io.kompose.service": "acake2php" + }, + "name": "acake2php" + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "io.kompose.service": "acake2php" + } + }, + "strategy": { + "type": "Recreate" + }, + "template": { + "metadata": { + "annotations": { + "io.balena.features.dbus": "1", + "kompose.cmd": "kompose convert --build build-config --controller deployment -o openshift/templates/ -f docker-compose.x86_64 -j", + "kompose.version": "1.21.0 (992df58d8)" + }, + "creationTimestamp": null, + "labels": { + "io.kompose.network/acake2php_cake": "true", + "io.kompose.service": "acake2php" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "BALENA_MACHINE_NAME", + "value": "raspberrypi3" + }, + { + "name": "BALENA_PROJECTS", + "value": "(. ./mysqldb ./deployment/images/node-php7 ./deployment/images/apache-php7) #(submodule deployment/images/primary" + }, + { + "name": "BALENA_PROJECTS_FLAGS", + "value": "(IMG_TAG PRIMARY_HUB SECONDARY_HUB)" + }, + { + "name": "CAKEPHP_DEBUG_LEVEL", + "value": "1" + }, + { + "name": "CAKEPHP_SECURITY_CIPHER_SEED", + "value": "01234" + }, + { + "name": "CAKEPHP_SECURITY_SALT", + "value": "Word" + }, + { + "name": "COLLECT_COVERAGE", + "value": "false" + }, + { + "name": "DATABASE_USER", + "value": "root" + }, + { + "name": "DKR_ARCH", + "value": "armhf" + }, + { + "name": "HTTPD_LISTEN", + "value": "*:80" + }, + { + "name": "IMG_TAG", + "value": "latest" + }, + { + "name": "MYPHPCMS_DIR", + "value": "app/webroot/php_cms" + }, + { + "name": "MYPHPCMS_LOG", + "value": "app/tmp/logs" + }, + { + "name": "PGID", + "value": "1000" + }, + { + "name": "PRIMARY_HUB", + "value": "betothreeprod/apache-php7" + }, + { + "name": "PUID", + "value": "1000" + }, + { + "name": "SECONDARY_HUB", + "value": "betothreeprod/mariadb-raspberrypi3" + }, + { + "name": "SERVER_NAME", + "value": "acake2php.local" + }, + { + "name": "TZ", + "value": "Europe/Paris" + } + ], + "image": "betothreeprod/acake2php-intel-nuc", + "imagePullPolicy": "", + "name": "acake2php", + "ports": [ + { + "containerPort": 80 + }, + { + "containerPort": 443 + } + ], + "resources": {}, + "volumeMounts": [ + { + "mountPath": "/var/www", + "name": "acake2php-data" + }, + { + "mountPath": "/var/run/mysqld", + "name": "acake2php-db-socket" + } + ] + } + ], + "restartPolicy": "Always", + "serviceAccountName": "", + "volumes": [ + { + "name": "acake2php-data", + "persistentVolumeClaim": { + "claimName": "acake2php-data" + } + }, + { + "name": "acake2php-db-socket", + "persistentVolumeClaim": { + "claimName": "acake2php-db-socket" + } + } + ] + } + } + }, + "status": {} +} \ No newline at end of file diff --git a/openshift/templates/acake2php-deploymentconfig.json b/openshift/templates/acake2php-deploymentconfig.json new file mode 100644 index 000000000..a41130bbd --- /dev/null +++ b/openshift/templates/acake2php-deploymentconfig.json @@ -0,0 +1,175 @@ +{ + "kind": "DeploymentConfig", + "apiVersion": "v1", + "metadata": { + "name": "acake2php", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "acake2php" + }, + "annotations": { + "io.balena.features.dbus": "1", + "kompose.cmd": "kompose convert -f docker-compose.x86_64 --provider openshift --out openshift/templates/ -j", + "kompose.version": "1.21.0 (992df58d8)" + } + }, + "spec": { + "strategy": { + "type": "Recreate", + "resources": {} + }, + "triggers": [ + { + "type": "ConfigChange" + }, + { + "type": "ImageChange", + "imageChangeParams": { + "automatic": true, + "containerNames": [ + "acake2php" + ], + "from": { + "kind": "ImageStreamTag", + "name": "acake2php:latest" + } + } + } + ], + "replicas": 1, + "test": false, + "selector": { + "io.kompose.service": "acake2php" + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "io.kompose.network/acake2php_cake": "true", + "io.kompose.service": "acake2php" + } + }, + "spec": { + "volumes": [ + { + "name": "acake2php-data", + "persistentVolumeClaim": { + "claimName": "acake2php-data" + } + }, + { + "name": "acake2php-db-socket", + "persistentVolumeClaim": { + "claimName": "acake2php-db-socket" + } + } + ], + "containers": [ + { + "name": "acake2php", + "image": " ", + "ports": [ + { + "containerPort": 80 + }, + { + "containerPort": 443 + } + ], + "env": [ + { + "name": "BALENA_MACHINE_NAME", + "value": "raspberrypi3" + }, + { + "name": "BALENA_PROJECTS", + "value": "(. ./mysqldb ./deployment/images/node-php7 ./deployment/images/apache-php7) #(submodule deployment/images/primary" + }, + { + "name": "BALENA_PROJECTS_FLAGS", + "value": "(IMG_TAG PRIMARY_HUB SECONDARY_HUB)" + }, + { + "name": "CAKEPHP_DEBUG_LEVEL", + "value": "1" + }, + { + "name": "CAKEPHP_SECURITY_CIPHER_SEED", + "value": "01234" + }, + { + "name": "CAKEPHP_SECURITY_SALT", + "value": "Word" + }, + { + "name": "COLLECT_COVERAGE", + "value": "false" + }, + { + "name": "DATABASE_USER", + "value": "root" + }, + { + "name": "DKR_ARCH", + "value": "armhf" + }, + { + "name": "HTTPD_LISTEN", + "value": "*:80" + }, + { + "name": "IMG_TAG", + "value": "latest" + }, + { + "name": "MYPHPCMS_DIR", + "value": "app/webroot/php_cms" + }, + { + "name": "MYPHPCMS_LOG", + "value": "app/tmp/logs" + }, + { + "name": "PGID", + "value": "1000" + }, + { + "name": "PRIMARY_HUB", + "value": "betothreeprod/apache-php7" + }, + { + "name": "PUID", + "value": "1000" + }, + { + "name": "SECONDARY_HUB", + "value": "betothreeprod/mariadb-raspberrypi3" + }, + { + "name": "SERVER_NAME", + "value": "acake2php.local" + }, + { + "name": "TZ", + "value": "Europe/Paris" + } + ], + "resources": {}, + "volumeMounts": [ + { + "name": "acake2php-data", + "mountPath": "/var/www" + }, + { + "name": "acake2php-db-socket", + "mountPath": "/var/run/mysqld" + } + ] + } + ], + "restartPolicy": "Always" + } + } + }, + "status": {} +} \ No newline at end of file diff --git a/openshift/templates/acake2php-imagestream.json b/openshift/templates/acake2php-imagestream.json new file mode 100644 index 000000000..387d40e9d --- /dev/null +++ b/openshift/templates/acake2php-imagestream.json @@ -0,0 +1,28 @@ +{ + "kind": "ImageStream", + "apiVersion": "v1", + "metadata": { + "name": "acake2php", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "acake2php" + } + }, + "spec": { + "tags": [ + { + "name": "latest", + "annotations": null, + "from": { + "kind": "DockerImage", + "name": "betothreeprod/acake2php-intel-nuc" + }, + "generation": null, + "importPolicy": {} + } + ] + }, + "status": { + "dockerImageRepository": "" + } +} \ No newline at end of file diff --git a/openshift/templates/acake2php-service.json b/openshift/templates/acake2php-service.json new file mode 100644 index 000000000..268c09a62 --- /dev/null +++ b/openshift/templates/acake2php-service.json @@ -0,0 +1,36 @@ +{ + "kind": "Service", + "apiVersion": "v1", + "metadata": { + "name": "acake2php", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "acake2php" + }, + "annotations": { + "io.balena.features.dbus": "1", + "kompose.cmd": "kompose convert --build build-config --controller deployment -o openshift/templates/ -f docker-compose.x86_64 -j", + "kompose.version": "1.21.0 (992df58d8)" + } + }, + "spec": { + "ports": [ + { + "name": "80", + "port": 80, + "targetPort": 80 + }, + { + "name": "443", + "port": 443, + "targetPort": 443 + } + ], + "selector": { + "io.kompose.service": "acake2php" + } + }, + "status": { + "loadBalancer": {} + } +} \ No newline at end of file diff --git a/openshift/templates/acake2php_cake-networkpolicy.json b/openshift/templates/acake2php_cake-networkpolicy.json new file mode 100644 index 000000000..97c832122 --- /dev/null +++ b/openshift/templates/acake2php_cake-networkpolicy.json @@ -0,0 +1,28 @@ +{ + "kind": "NetworkPolicy", + "apiVersion": "extensions/v1beta1", + "metadata": { + "name": "acake2php_cake", + "creationTimestamp": null + }, + "spec": { + "podSelector": { + "matchLabels": { + "io.kompose.network/acake2php_cake": "true" + } + }, + "ingress": [ + { + "from": [ + { + "podSelector": { + "matchLabels": { + "io.kompose.network/acake2php_cake": "true" + } + } + } + ] + } + ] + } +} \ No newline at end of file diff --git a/openshift/templates/cakephp-mysql-persistent.json b/openshift/templates/cakephp-mysql-persistent.json deleted file mode 100644 index 6ffe1cae8..000000000 --- a/openshift/templates/cakephp-mysql-persistent.json +++ /dev/null @@ -1,577 +0,0 @@ -{ - "kind": "Template", - "apiVersion": "v1", - "metadata": { - "name": "cakephp-mysql-persistent", - "annotations": { - "openshift.io/display-name": "CakePHP + MySQL (Persistent)", - "description": "An example CakePHP application with a MySQL database. For more information about using this template, including OpenShift considerations, see https://github.com/openshift/cakephp-ex/blob/master/README.md.", - "tags": "quickstart,php,cakephp", - "iconClass": "icon-php", - "template.openshift.io/long-description": "This template defines resources needed to develop a CakePHP application, including a build configuration, application deployment configuration, and database deployment configuration.", - "template.openshift.io/provider-display-name": "Red Hat, Inc.", - "template.openshift.io/documentation-url": "https://github.com/openshift/cakephp-ex", - "template.openshift.io/support-url": "https://access.redhat.com" - } - }, - "message": "The following service(s) have been created in your project: ${NAME}, ${DB}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/openshift/cake-ex/blob/master/README.md.", - "labels": { - "template": "cakephp-mysql-persistent" - }, - "objects": [ - { - "kind": "Secret", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}" - }, - "stringData" : { - "database-user" : "${DATABASE_USER}", - "database-password" : "${MYSQL_ROOT_PASSWORD}", - "cakephp-secret-token" : "${CAKEPHP_SECRET_TOKEN}", - "cakephp-security-salt" : "${CAKEPHP_SECURITY_SALT}", - "cakephp-security-cipher-seed" : "${CAKEPHP_SECURITY_CIPHER_SEED}" - } - }, - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}", - "annotations": { - "description": "Exposes and load balances the application pods", - "service.alpha.openshift.io/dependencies": "[{\"name\": \"${DB}\", \"kind\": \"Service\"}]" - } - }, - "spec": { - "ports": [ - { - "name": "web", - "port": 8080, - "targetPort": 8080 - } - ], - "selector": { - "name": "${NAME}" - } - } - }, - { - "kind": "Route", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}", - "annotations": { - "template.openshift.io/expose-uri": "http://{.spec.host}{.spec.path}" - } - }, - "spec": { - "host": "${APPLICATION_DOMAIN}", - "to": { - "kind": "Service", - "name": "${NAME}" - } - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}", - "annotations": { - "description": "Keeps track of changes in the application image" - } - } - }, - { - "kind": "BuildConfig", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}", - "annotations": { - "description": "Defines how to build the application", - "template.alpha.openshift.io/wait-for-ready": "true" - } - }, - "spec": { - "source": { - "type": "Git", - "git": { - "uri": "${SOURCE_REPOSITORY_URL}", - "ref": "${SOURCE_REPOSITORY_REF}" - }, - "contextDir": "${CONTEXT_DIR}" - }, - "strategy": { - "type": "Source", - "sourceStrategy": { - "from": { - "kind": "ImageStreamTag", - "namespace": "${NAMESPACE}", - "name": "php:7.0" - }, - "env": [ - { - "name": "COMPOSER_MIRROR", - "value": "${COMPOSER_MIRROR}" - } - ] - } - }, - "output": { - "to": { - "kind": "ImageStreamTag", - "name": "${NAME}:latest" - } - }, - "triggers": [ - { - "type": "ImageChange" - }, - { - "type": "ConfigChange" - }, - { - "type": "GitHub", - "github": { - "secret": "${GITHUB_WEBHOOK_SECRET}" - } - } - ], - "postCommit": { - "script": "./lib/Cake/Console/cake test app AllTests" - } - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}", - "annotations": { - "description": "Defines how to deploy the application server", - "template.alpha.openshift.io/wait-for-ready": "true" - } - }, - "spec": { - "strategy": { - "type": "Recreate", - "recreateParams": { - "pre": { - "failurePolicy": "Retry", - "execNewPod": { - "command": [ - "./migrate-database.sh" - ], - "containerName": "cakephp-mysql-persistent" - } - } - } - }, - "triggers": [ - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "cakephp-mysql-persistent" - ], - "from": { - "kind": "ImageStreamTag", - "name": "${NAME}:latest" - } - } - }, - { - "type": "ConfigChange" - } - ], - "replicas": 1, - "selector": { - "name": "${NAME}" - }, - "template": { - "metadata": { - "name": "${NAME}", - "labels": { - "name": "${NAME}" - } - }, - "spec": { - "containers": [ - { - "name": "cakephp-mysql-persistent", - "image": " ", - "ports": [ - { - "containerPort": 8080 - } - ], - "readinessProbe": { - "timeoutSeconds": 3, - "initialDelaySeconds": 3, - "httpGet": { - "path": "/health.php", - "port": 8080 - } - }, - "livenessProbe": { - "timeoutSeconds": 3, - "initialDelaySeconds": 30, - "httpGet": { - "path": "/", - "port": 8080 - } - }, - "env": [ - { - "name": "DB", - "value": "${DB}" - }, - { - "name": "MYSQL_DATABASE", - "value": "${MYSQL_DATABASE}" - }, - { - "name": "DATABASE_USER", - "valueFrom": { - "secretKeyRef" : { - "name" : "${NAME}", - "key" : "database-user" - } - } - }, - { - "name": "MYSQL_ROOT_PASSWORD", - "valueFrom": { - "secretKeyRef" : { - "name" : "${NAME}", - "key" : "database-password" - } - } - }, - { - "name": "CAKEPHP_SECRET_TOKEN", - "valueFrom": { - "secretKeyRef" : { - "name" : "${NAME}", - "key" : "cakephp-secret-token" - } - } - }, - { - "name": "CAKEPHP_SECURITY_SALT", - "valueFrom": { - "secretKeyRef" : { - "name" : "${NAME}", - "key" : "cakephp-security-salt" - } - } - }, - { - "name": "CAKEPHP_SECURITY_CIPHER_SEED", - "valueFrom": { - "secretKeyRef" : { - "name" : "${NAME}", - "key" : "cakephp-security-cipher-seed" - } - } - }, - { - "name": "OPCACHE_REVALIDATE_FREQ", - "value": "${OPCACHE_REVALIDATE_FREQ}" - } - ], - "resources": { - "limits": { - "memory": "${MEMORY_LIMIT}" - } - } - } - ] - } - } - } - }, - { - "kind": "PersistentVolumeClaim", - "apiVersion": "v1", - "metadata": { - "name": "${DB}" - }, - "spec": { - "accessModes": [ - "ReadWriteOnce" - ], - "resources": { - "requests": { - "storage": "${VOLUME_CAPACITY}" - } - } - } - }, - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "${DB}", - "annotations": { - "description": "Exposes the database server" - } - }, - "spec": { - "ports": [ - { - "name": "mysql", - "port": 3306, - "targetPort": 3306 - } - ], - "selector": { - "name": "${DB}" - } - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "${DB}", - "annotations": { - "description": "Defines how to deploy the database", - "template.alpha.openshift.io/wait-for-ready": "true" - } - }, - "spec": { - "strategy": { - "type": "Recreate" - }, - "triggers": [ - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "mysql" - ], - "from": { - "kind": "ImageStreamTag", - "namespace": "${NAMESPACE}", - "name": "mysql:5.7" - } - } - }, - { - "type": "ConfigChange" - } - ], - "replicas": 1, - "selector": { - "name": "${DB}" - }, - "template": { - "metadata": { - "name": "${DB}", - "labels": { - "name": "${DB}" - } - }, - "spec": { - "volumes": [ - { - "name": "${DB}-data", - "persistentVolumeClaim": { - "claimName": "${DB}" - } - } - ], - "containers": [ - { - "name": "mysql", - "image": " ", - "ports": [ - { - "containerPort": 3306 - } - ], - "volumeMounts": [ - { - "name": "${DB}-data", - "mountPath": "/var/lib/mysql/data" - } - ], - "readinessProbe": { - "timeoutSeconds": 1, - "initialDelaySeconds": 5, - "exec": { - "command": [ "/bin/sh", "-i", "-c", "MYSQL_PWD='${MYSQL_ROOT_PASSWORD}' mysql -h 127.0.0.1 -u ${DATABASE_USER} -D ${MYSQL_DATABASE} -e 'SELECT 1'" ] - } - }, - "livenessProbe": { - "timeoutSeconds": 1, - "initialDelaySeconds": 30, - "tcpSocket": { - "port": 3306 - } - }, - "env": [ - { - "name": "MYSQL_USER", - "valueFrom": { - "secretKeyRef" : { - "name" : "${NAME}", - "key" : "database-user" - } - } - }, - { - "name": "MYSQL_PASSWORD", - "valueFrom": { - "secretKeyRef" : { - "name" : "${NAME}", - "key" : "database-password" - } - } - }, - { - "name": "MYSQL_DATABASE", - "value": "${MYSQL_DATABASE}" - } - ], - "resources": { - "limits": { - "memory": "${MEMORY_MYSQL_LIMIT}" - } - } - } - ] - } - } - } - } - ], - "parameters": [ - { - "name": "NAME", - "displayName": "Name", - "description": "The name assigned to all of the frontend objects defined in this template.", - "required": true, - "value": "cakephp-mysql-persistent" - }, - { - "name": "NAMESPACE", - "displayName": "Namespace", - "description": "The OpenShift Namespace where the ImageStream resides.", - "required": true, - "value": "openshift" - }, - { - "name": "MEMORY_LIMIT", - "displayName": "Memory Limit", - "description": "Maximum amount of memory the CakePHP container can use.", - "required": true, - "value": "512Mi" - }, - { - "name": "MEMORY_MYSQL_LIMIT", - "displayName": "Memory Limit (MySQL)", - "description": "Maximum amount of memory the MySQL container can use.", - "required": true, - "value": "512Mi" - }, - { - "name": "VOLUME_CAPACITY", - "displayName": "Volume Capacity", - "description": "Volume space available for data, e.g. 512Mi, 2Gi", - "value": "1Gi", - "required": true - }, - { - "name": "SOURCE_REPOSITORY_URL", - "displayName": "Git Repository URL", - "description": "The URL of the repository with your application source code.", - "required": true, - "value": "https://github.com/openshift/cakephp-ex.git" - }, - { - "name": "SOURCE_REPOSITORY_REF", - "displayName": "Git Reference", - "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch." - }, - { - "name": "CONTEXT_DIR", - "displayName": "Context Directory", - "description": "Set this to the relative path to your project if it is not in the root of your repository." - }, - { - "name": "APPLICATION_DOMAIN", - "displayName": "Application Hostname", - "description": "The exposed hostname that will route to the CakePHP service, if left blank a value will be defaulted.", - "value": "" - }, - { - "name": "GITHUB_WEBHOOK_SECRET", - "displayName": "GitHub Webhook Secret", - "description": "Github trigger secret. A difficult to guess string encoded as part of the webhook URL. Not encrypted.", - "generate": "expression", - "from": "[a-zA-Z0-9]{40}" - }, - { - "name": "DB", - "displayName": "Database Service Name", - "required": true, - "value": "Mysql" - }, - { - "name": "MYSQL_DATABASE", - "displayName": "Database Name", - "required": true, - "value": "default" - }, - { - "name": "DATABASE_USER", - "displayName": "Database User", - "required": true, - "value": "cakephp" - }, - { - "name": "MYSQL_ROOT_PASSWORD", - "displayName": "Database Password", - "generate": "expression", - "from": "[a-zA-Z0-9]{16}" - }, - { - "name": "CAKEPHP_SECRET_TOKEN", - "displayName": "CakePHP secret token", - "description": "Set this to a long random string.", - "generate": "expression", - "from": "[\\w]{50}" - }, - { - "name": "CAKEPHP_SECURITY_SALT", - "displayName": "CakePHP Security Salt", - "description": "Security salt for session hash.", - "generate": "expression", - "from": "[a-zA-Z0-9]{40}" - }, - { - "name": "CAKEPHP_SECURITY_CIPHER_SEED", - "displayName": "CakePHP Security Cipher Seed", - "description": "Security cipher seed for session hash.", - "generate": "expression", - "from": "[0-9]{30}" - }, - { - "name": "OPCACHE_REVALIDATE_FREQ", - "displayName": "OPcache Revalidation Frequency", - "description": "How often to check script timestamps for updates, in seconds. 0 will result in OPcache checking for updates on every request.", - "value": "2" - }, - { - "name": "COMPOSER_MIRROR", - "displayName": "Custom Composer Mirror URL", - "description": "The custom Composer mirror URL", - "value": "" - } - ] -} diff --git a/openshift/templates/cakephp-mysql.json b/openshift/templates/cakephp-mysql.json deleted file mode 100644 index dc0822e33..000000000 --- a/openshift/templates/cakephp-mysql.json +++ /dev/null @@ -1,551 +0,0 @@ -{ - "kind": "Template", - "apiVersion": "v1", - "metadata": { - "name": "cakephp-mysql-example", - "annotations": { - "openshift.io/display-name": "CakePHP + MySQL (Ephemeral)", - "description": "An example CakePHP application with a MySQL database. For more information about using this template, including OpenShift considerations, see https://github.com/openshift/cakephp-ex/blob/master/README.md.\n\nWARNING: Any data stored will be lost upon pod destruction. Only use this template for testing.", - "tags": "quickstart,php,cakephp", - "iconClass": "icon-php", - "template.openshift.io/long-description": "This template defines resources needed to develop a CakePHP application, including a build configuration, application deployment configuration, and database deployment configuration. The database is stored in non-persistent storage, so this configuration should be used for experimental purposes only.", - "template.openshift.io/provider-display-name": "Red Hat, Inc.", - "template.openshift.io/documentation-url": "https://github.com/openshift/cakephp-ex", - "template.openshift.io/support-url": "https://access.redhat.com" - } - }, - "message": "The following service(s) have been created in your project: ${NAME}, ${DB}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/openshift/cake-ex/blob/master/README.md.", - "labels": { - "template": "cakephp-mysql-example" - }, - "objects": [ - { - "kind": "Secret", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}" - }, - "stringData" : { - "database-user" : "${DATABASE_USER}", - "database-password" : "${MYSQL_ROOT_PASSWORD}", - "cakephp-secret-token" : "${CAKEPHP_SECRET_TOKEN}", - "cakephp-security-salt" : "${CAKEPHP_SECURITY_SALT}", - "cakephp-security-cipher-seed" : "${CAKEPHP_SECURITY_CIPHER_SEED}" - } - }, - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}", - "annotations": { - "description": "Exposes and load balances the application pods", - "service.alpha.openshift.io/dependencies": "[{\"name\": \"${DB}\", \"kind\": \"Service\"}]" - } - }, - "spec": { - "ports": [ - { - "name": "web", - "port": 8080, - "targetPort": 8080 - } - ], - "selector": { - "name": "${NAME}" - } - } - }, - { - "kind": "Route", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}", - "annotations": { - "template.openshift.io/expose-uri": "http://{.spec.host}{.spec.path}" - } - }, - "spec": { - "host": "${APPLICATION_DOMAIN}", - "to": { - "kind": "Service", - "name": "${NAME}" - } - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}", - "annotations": { - "description": "Keeps track of changes in the application image" - } - } - }, - { - "kind": "BuildConfig", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}", - "annotations": { - "description": "Defines how to build the application", - "template.alpha.openshift.io/wait-for-ready": "true" - } - }, - "spec": { - "source": { - "type": "Git", - "git": { - "uri": "${SOURCE_REPOSITORY_URL}", - "ref": "${SOURCE_REPOSITORY_REF}" - }, - "contextDir": "${CONTEXT_DIR}" - }, - "strategy": { - "type": "Source", - "sourceStrategy": { - "from": { - "kind": "ImageStreamTag", - "namespace": "${NAMESPACE}", - "name": "php:7.0" - }, - "env": [ - { - "name": "COMPOSER_MIRROR", - "value": "${COMPOSER_MIRROR}" - } - ] - } - }, - "output": { - "to": { - "kind": "ImageStreamTag", - "name": "${NAME}:latest" - } - }, - "triggers": [ - { - "type": "ImageChange" - }, - { - "type": "ConfigChange" - }, - { - "type": "GitHub", - "github": { - "secret": "${GITHUB_WEBHOOK_SECRET}" - } - } - ], - "postCommit": { - "script": "./lib/Cake/Console/cake test app AllTests" - } - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}", - "annotations": { - "description": "Defines how to deploy the application server", - "template.alpha.openshift.io/wait-for-ready": "true" - } - }, - "spec": { - "strategy": { - "type": "Recreate", - "recreateParams": { - "pre": { - "failurePolicy": "Retry", - "execNewPod": { - "command": [ - "./migrate-database.sh" - ], - "containerName": "cakephp-mysql-example" - } - } - } - }, - "triggers": [ - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "cakephp-mysql-example" - ], - "from": { - "kind": "ImageStreamTag", - "name": "${NAME}:latest" - } - } - }, - { - "type": "ConfigChange" - } - ], - "replicas": 1, - "selector": { - "name": "${NAME}" - }, - "template": { - "metadata": { - "name": "${NAME}", - "labels": { - "name": "${NAME}" - } - }, - "spec": { - "containers": [ - { - "name": "cakephp-mysql-example", - "image": " ", - "ports": [ - { - "containerPort": 8080 - } - ], - "readinessProbe": { - "timeoutSeconds": 3, - "initialDelaySeconds": 3, - "httpGet": { - "path": "/health.php", - "port": 8080 - } - }, - "livenessProbe": { - "timeoutSeconds": 3, - "initialDelaySeconds": 30, - "httpGet": { - "path": "/", - "port": 8080 - } - }, - "env": [ - { - "name": "DB", - "value": "${DB}" - }, - { - "name": "MYSQL_DATABASE", - "value": "${MYSQL_DATABASE}" - }, - { - "name": "DATABASE_USER", - "valueFrom": { - "secretKeyRef" : { - "name" : "${NAME}", - "key" : "database-user" - } - } - }, - { - "name": "MYSQL_ROOT_PASSWORD", - "valueFrom": { - "secretKeyRef" : { - "name" : "${NAME}", - "key" : "database-password" - } - } - }, - { - "name": "CAKEPHP_SECRET_TOKEN", - "valueFrom": { - "secretKeyRef" : { - "name" : "${NAME}", - "key" : "cakephp-secret-token" - } - } - }, - { - "name": "CAKEPHP_SECURITY_SALT", - "valueFrom": { - "secretKeyRef" : { - "name" : "${NAME}", - "key" : "cakephp-security-salt" - } - } - }, - { - "name": "CAKEPHP_SECURITY_CIPHER_SEED", - "valueFrom": { - "secretKeyRef" : { - "name" : "${NAME}", - "key" : "cakephp-security-cipher-seed" - } - } - }, - { - "name": "OPCACHE_REVALIDATE_FREQ", - "value": "${OPCACHE_REVALIDATE_FREQ}" - } - ], - "resources": { - "limits": { - "memory": "${MEMORY_LIMIT}" - } - } - } - ] - } - } - } - }, - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "${DB}", - "annotations": { - "description": "Exposes the database server" - } - }, - "spec": { - "ports": [ - { - "name": "mysql", - "port": 3306, - "targetPort": 3306 - } - ], - "selector": { - "name": "${DB}" - } - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "${DB}", - "annotations": { - "description": "Defines how to deploy the database", - "template.alpha.openshift.io/wait-for-ready": "true" - } - }, - "spec": { - "strategy": { - "type": "Recreate" - }, - "triggers": [ - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "mysql" - ], - "from": { - "kind": "ImageStreamTag", - "namespace": "${NAMESPACE}", - "name": "mysql:5.7" - } - } - }, - { - "type": "ConfigChange" - } - ], - "replicas": 1, - "selector": { - "name": "${DB}" - }, - "template": { - "metadata": { - "name": "${DB}", - "labels": { - "name": "${DB}" - } - }, - "spec": { - "volumes": [ - { - "name": "data", - "emptyDir": {} - } - ], - "containers": [ - { - "name": "mysql", - "image": " ", - "ports": [ - { - "containerPort": 3306 - } - ], - "volumeMounts": [ - { - "name": "data", - "mountPath": "/var/lib/mysql/data" - } - ], - "readinessProbe": { - "timeoutSeconds": 1, - "initialDelaySeconds": 5, - "exec": { - "command": [ "/bin/sh", "-i", "-c", "MYSQL_PWD='${MYSQL_ROOT_PASSWORD}' mysql -h 127.0.0.1 -u ${DATABASE_USER} -D ${MYSQL_DATABASE} -e 'SELECT 1'" ] - } - }, - "livenessProbe": { - "timeoutSeconds": 1, - "initialDelaySeconds": 30, - "tcpSocket": { - "port": 3306 - } - }, - "env": [ - { - "name": "MYSQL_USER", - "valueFrom": { - "secretKeyRef" : { - "name" : "${NAME}", - "key" : "database-user" - } - } - }, - { - "name": "MYSQL_PASSWORD", - "valueFrom": { - "secretKeyRef" : { - "name" : "${NAME}", - "key" : "database-password" - } - } - }, - { - "name": "MYSQL_DATABASE", - "value": "${MYSQL_DATABASE}" - } - ], - "resources": { - "limits": { - "memory": "${MEMORY_MYSQL_LIMIT}" - } - } - } - ] - } - } - } - } - ], - "parameters": [ - { - "name": "NAME", - "displayName": "Name", - "description": "The name assigned to all of the frontend objects defined in this template.", - "required": true, - "value": "cakephp-mysql-example" - }, - { - "name": "NAMESPACE", - "displayName": "Namespace", - "description": "The OpenShift Namespace where the ImageStream resides.", - "required": true, - "value": "openshift" - }, - { - "name": "MEMORY_LIMIT", - "displayName": "Memory Limit", - "description": "Maximum amount of memory the CakePHP container can use.", - "required": true, - "value": "512Mi" - }, - { - "name": "MEMORY_MYSQL_LIMIT", - "displayName": "Memory Limit (MySQL)", - "description": "Maximum amount of memory the MySQL container can use.", - "required": true, - "value": "512Mi" - }, - { - "name": "SOURCE_REPOSITORY_URL", - "displayName": "Git Repository URL", - "description": "The URL of the repository with your application source code.", - "required": true, - "value": "https://github.com/openshift/cakephp-ex.git" - }, - { - "name": "SOURCE_REPOSITORY_REF", - "displayName": "Git Reference", - "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch." - }, - { - "name": "CONTEXT_DIR", - "displayName": "Context Directory", - "description": "Set this to the relative path to your project if it is not in the root of your repository." - }, - { - "name": "APPLICATION_DOMAIN", - "displayName": "Application Hostname", - "description": "The exposed hostname that will route to the CakePHP service, if left blank a value will be defaulted.", - "value": "" - }, - { - "name": "GITHUB_WEBHOOK_SECRET", - "displayName": "GitHub Webhook Secret", - "description": "Github trigger secret. A difficult to guess string encoded as part of the webhook URL. Not encrypted.", - "generate": "expression", - "from": "[a-zA-Z0-9]{40}" - }, - { - "name": "DB", - "displayName": "Database Service Name", - "required": true, - "value": "Mysql" - }, - { - "name": "MYSQL_DATABASE", - "displayName": "Database Name", - "required": true, - "value": "default" - }, - { - "name": "DATABASE_USER", - "displayName": "Database User", - "required": true, - "value": "cakephp" - }, - { - "name": "MYSQL_ROOT_PASSWORD", - "displayName": "Database Password", - "generate": "expression", - "from": "[a-zA-Z0-9]{16}" - }, - { - "name": "CAKEPHP_SECRET_TOKEN", - "displayName": "CakePHP secret token", - "description": "Set this to a long random string.", - "generate": "expression", - "from": "[\\w]{50}" - }, - { - "name": "CAKEPHP_SECURITY_SALT", - "displayName": "CakePHP Security Salt", - "description": "Security salt for session hash.", - "generate": "expression", - "from": "[a-zA-Z0-9]{40}" - }, - { - "name": "CAKEPHP_SECURITY_CIPHER_SEED", - "displayName": "CakePHP Security Cipher Seed", - "description": "Security cipher seed for session hash.", - "generate": "expression", - "from": "[0-9]{30}" - }, - { - "name": "OPCACHE_REVALIDATE_FREQ", - "displayName": "OPcache Revalidation Frequency", - "description": "How often to check script timestamps for updates, in seconds. 0 will result in OPcache checking for updates on every request.", - "value": "2" - }, - { - "name": "COMPOSER_MIRROR", - "displayName": "Custom Composer Mirror URL", - "description": "The custom Composer mirror URL", - "value": "" - } - ] -} diff --git a/openshift/templates/cakephp.json b/openshift/templates/cakephp.json deleted file mode 100644 index cfe8d84ba..000000000 --- a/openshift/templates/cakephp.json +++ /dev/null @@ -1,343 +0,0 @@ -{ - "kind": "Template", - "apiVersion": "v1", - "metadata": { - "name": "cakephp-example", - "annotations": { - "openshift.io/display-name": "CakePHP", - "description": "An example CakePHP application with no database. For more information about using this template, including OpenShift considerations, see https://github.com/openshift/cake-ex/blob/master/README.md.", - "tags": "quickstart,php,cakephp", - "iconClass": "icon-php", - "template.openshift.io/long-description": "This template defines resources needed to develop a CakePHP application, including a build configuration and application deployment configuration. It does not include a database.", - "template.openshift.io/provider-display-name": "Red Hat, Inc.", - "template.openshift.io/documentation-url": "https://github.com/openshift/cakephp-ex", - "template.openshift.io/support-url": "https://access.redhat.com" - } - }, - "message": "The following service(s) have been created in your project: ${NAME}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/openshift/cake-ex/blob/master/README.md.", - "labels": { - "template": "cakephp-example" - }, - "objects": [ - { - "kind": "Secret", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}" - }, - "stringData" : { - "cakephp-secret-token" : "${CAKEPHP_SECRET_TOKEN}", - "cakephp-security-salt" : "${CAKEPHP_SECURITY_SALT}", - "cakephp-security-cipher-seed" : "${CAKEPHP_SECURITY_CIPHER_SEED}" - } - }, - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}", - "annotations": { - "description": "Exposes and load balances the application pods" - } - }, - "spec": { - "ports": [ - { - "name": "web", - "port": 8080, - "targetPort": 8080 - } - ], - "selector": { - "name": "${NAME}" - } - } - }, - { - "kind": "Route", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}", - "annotations": { - "template.openshift.io/expose-uri": "http://{.spec.host}{.spec.path}" - } - }, - "spec": { - "host": "${APPLICATION_DOMAIN}", - "to": { - "kind": "Service", - "name": "${NAME}" - } - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}", - "annotations": { - "description": "Keeps track of changes in the application image" - } - } - }, - { - "kind": "BuildConfig", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}", - "annotations": { - "description": "Defines how to build the application", - "template.alpha.openshift.io/wait-for-ready": "true" - } - }, - "spec": { - "source": { - "type": "Git", - "git": { - "uri": "${SOURCE_REPOSITORY_URL}", - "ref": "${SOURCE_REPOSITORY_REF}" - }, - "contextDir": "${CONTEXT_DIR}" - }, - "strategy": { - "type": "Source", - "sourceStrategy": { - "from": { - "kind": "ImageStreamTag", - "namespace": "${NAMESPACE}", - "name": "php:7.0" - }, - "env": [ - { - "name": "COMPOSER_MIRROR", - "value": "${COMPOSER_MIRROR}" - } - ] - } - }, - "output": { - "to": { - "kind": "ImageStreamTag", - "name": "${NAME}:latest" - } - }, - "triggers": [ - { - "type": "ImageChange" - }, - { - "type": "ConfigChange" - }, - { - "type": "GitHub", - "github": { - "secret": "${GITHUB_WEBHOOK_SECRET}" - } - } - ], - "postCommit": { - "script": "./lib/Cake/Console/cake test app AllTests" - } - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}", - "annotations": { - "description": "Defines how to deploy the application server", - "template.alpha.openshift.io/wait-for-ready": "true" - } - }, - "spec": { - "strategy": { - "type": "Rolling" - }, - "triggers": [ - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "cakephp-example" - ], - "from": { - "kind": "ImageStreamTag", - "name": "${NAME}:latest" - } - } - }, - { - "type": "ConfigChange" - } - ], - "replicas": 1, - "selector": { - "name": "${NAME}" - }, - "template": { - "metadata": { - "name": "${NAME}", - "labels": { - "name": "${NAME}" - } - }, - "spec": { - "containers": [ - { - "name": "cakephp-example", - "image": " ", - "ports": [ - { - "containerPort": 8080 - } - ], - "readinessProbe": { - "timeoutSeconds": 3, - "initialDelaySeconds": 3, - "httpGet": { - "path": "/", - "port": 8080 - } - }, - "livenessProbe": { - "timeoutSeconds": 3, - "initialDelaySeconds": 30, - "httpGet": { - "path": "/", - "port": 8080 - } - }, - "env": [ - { - "name": "CAKEPHP_SECRET_TOKEN", - "valueFrom": { - "secretKeyRef" : { - "name" : "${NAME}", - "key" : "cakephp-secret-token" - } - } - }, - { - "name": "CAKEPHP_SECURITY_SALT", - "valueFrom": { - "secretKeyRef" : { - "name" : "${NAME}", - "key" : "cakephp-security-salt" - } - } - }, - { - "name": "CAKEPHP_SECURITY_CIPHER_SEED", - "valueFrom": { - "secretKeyRef" : { - "name" : "${NAME}", - "key" : "cakephp-security-cipher-seed" - } - } - }, - { - "name": "OPCACHE_REVALIDATE_FREQ", - "value": "${OPCACHE_REVALIDATE_FREQ}" - } - ], - "resources": { - "limits": { - "memory": "${MEMORY_LIMIT}" - } - } - } - ] - } - } - } - } - ], - "parameters": [ - { - "name": "NAME", - "displayName": "Name", - "description": "The name assigned to all of the frontend objects defined in this template.", - "required": true, - "value": "cakephp-example" - }, - { - "name": "NAMESPACE", - "displayName": "Namespace", - "description": "The OpenShift Namespace where the ImageStream resides.", - "required": true, - "value": "openshift" - }, - { - "name": "MEMORY_LIMIT", - "displayName": "Memory Limit", - "description": "Maximum amount of memory the container can use.", - "required": true, - "value": "512Mi" - }, - { - "name": "SOURCE_REPOSITORY_URL", - "displayName": "Git Repository URL", - "description": "The URL of the repository with your application source code.", - "required": true, - "value": "https://github.com/openshift/cakephp-ex.git" - }, - { - "name": "SOURCE_REPOSITORY_REF", - "displayName": "Git Reference", - "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch." - }, - { - "name": "CONTEXT_DIR", - "displayName": "Context Directory", - "description": "Set this to the relative path to your project if it is not in the root of your repository." - }, - { - "name": "APPLICATION_DOMAIN", - "displayName": "Application Hostname", - "description": "The exposed hostname that will route to the CakePHP service, if left blank a value will be defaulted.", - "value": "" - }, - { - "name": "GITHUB_WEBHOOK_SECRET", - "displayName": "GitHub Webhook Secret", - "description": "Github trigger secret. A difficult to guess string encoded as part of the webhook URL. Not encrypted.", - "generate": "expression", - "from": "[a-zA-Z0-9]{40}" - }, - { - "name": "CAKEPHP_SECRET_TOKEN", - "displayName": "CakePHP Secret Token", - "description": "Set this to a long random string.", - "generate": "expression", - "from": "[\\w]{50}" - }, - { - "name": "CAKEPHP_SECURITY_SALT", - "displayName": "CakePHP Security Salt", - "description": "Security salt for session hash.", - "generate": "expression", - "from": "[a-zA-Z0-9]{40}" - }, - { - "name": "CAKEPHP_SECURITY_CIPHER_SEED", - "displayName": "CakePHP Security Cipher Seed", - "description": "Security cipher seed for session hash.", - "generate": "expression", - "from": "[0-9]{30}" - }, - { - "name": "OPCACHE_REVALIDATE_FREQ", - "displayName": "OPcache Revalidation Frequency", - "description": "How often to check script timestamps for updates, in seconds. 0 will result in OPcache checking for updates on every request.", - "value": "2" - }, - { - "name": "COMPOSER_MIRROR", - "displayName": "Custom Composer Mirror URL", - "description": "The custom Composer mirror URL", - "value": "" - } - ] -} diff --git a/openshift/templates/db-deployment.json b/openshift/templates/db-deployment.json new file mode 100644 index 000000000..ea95022f1 --- /dev/null +++ b/openshift/templates/db-deployment.json @@ -0,0 +1,171 @@ +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "io.balena.features.dbus": "1", + "kompose.cmd": "kompose convert --build build-config --controller deployment -o openshift/templates/ -f docker-compose.x86_64 -j", + "kompose.version": "1.21.0 (992df58d8)" + }, + "creationTimestamp": null, + "labels": { + "io.kompose.service": "db" + }, + "name": "db" + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "io.kompose.service": "db" + } + }, + "strategy": { + "type": "Recreate" + }, + "template": { + "metadata": { + "annotations": { + "io.balena.features.dbus": "1", + "kompose.cmd": "kompose convert --build build-config --controller deployment -o openshift/templates/ -f docker-compose.x86_64 -j", + "kompose.version": "1.21.0 (992df58d8)" + }, + "creationTimestamp": null, + "labels": { + "io.kompose.network/acake2php_cake": "true", + "io.kompose.service": "db" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "BALENA_MACHINE_NAME", + "value": "raspberrypi3" + }, + { + "name": "BALENA_PROJECTS", + "value": "(. ./mysqldb ./deployment/images/node-php7 ./deployment/images/apache-php7) #(submodule deployment/images/primary" + }, + { + "name": "BALENA_PROJECTS_FLAGS", + "value": "(IMG_TAG PRIMARY_HUB SECONDARY_HUB)" + }, + { + "name": "CAKEPHP_DEBUG_LEVEL", + "value": "1" + }, + { + "name": "CAKEPHP_SECURITY_CIPHER_SEED", + "value": "01234" + }, + { + "name": "CAKEPHP_SECURITY_SALT", + "value": "Word" + }, + { + "name": "COLLECT_COVERAGE", + "value": "false" + }, + { + "name": "DATABASE_USER", + "value": "root" + }, + { + "name": "DKR_ARCH", + "value": "armhf" + }, + { + "name": "HTTPD_LISTEN", + "value": "*:80" + }, + { + "name": "IMG_TAG", + "value": "latest" + }, + { + "name": "MYPHPCMS_DIR", + "value": "app/webroot/php_cms" + }, + { + "name": "MYPHPCMS_LOG", + "value": "app/tmp/logs" + }, + { + "name": "PGID", + "value": "1000" + }, + { + "name": "PRIMARY_HUB", + "value": "betothreeprod/apache-php7" + }, + { + "name": "PUID", + "value": "1000" + }, + { + "name": "SECONDARY_HUB", + "value": "betothreeprod/mariadb-raspberrypi3" + }, + { + "name": "SERVER_NAME", + "value": "acake2php.local" + }, + { + "name": "TZ", + "value": "Europe/Paris" + } + ], + "image": "betothreeprod/mariadb-intel-nuc", + "imagePullPolicy": "", + "name": "db", + "ports": [ + { + "containerPort": 3306 + } + ], + "resources": {}, + "volumeMounts": [ + { + "mountPath": "/config", + "name": "acake2php-db-data" + }, + { + "mountPath": "/var/run/mysqld", + "name": "acake2php-db-socket" + }, + { + "mountPath": "/var/www", + "name": "acake2php-data" + } + ] + } + ], + "restartPolicy": "Always", + "serviceAccountName": "", + "volumes": [ + { + "name": "acake2php-db-data", + "persistentVolumeClaim": { + "claimName": "acake2php-db-data" + } + }, + { + "name": "acake2php-db-socket", + "persistentVolumeClaim": { + "claimName": "acake2php-db-socket" + } + }, + { + "name": "acake2php-data", + "persistentVolumeClaim": { + "claimName": "acake2php-data" + } + } + ] + } + } + }, + "status": {} +} \ No newline at end of file diff --git a/openshift/templates/db-deploymentconfig.json b/openshift/templates/db-deploymentconfig.json new file mode 100644 index 000000000..50fd154e8 --- /dev/null +++ b/openshift/templates/db-deploymentconfig.json @@ -0,0 +1,182 @@ +{ + "kind": "DeploymentConfig", + "apiVersion": "v1", + "metadata": { + "name": "db", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "db" + }, + "annotations": { + "io.balena.features.dbus": "1", + "kompose.cmd": "kompose convert -f docker-compose.x86_64 --provider openshift --out openshift/templates/ -j", + "kompose.version": "1.21.0 (992df58d8)" + } + }, + "spec": { + "strategy": { + "type": "Recreate", + "resources": {} + }, + "triggers": [ + { + "type": "ConfigChange" + }, + { + "type": "ImageChange", + "imageChangeParams": { + "automatic": true, + "containerNames": [ + "db" + ], + "from": { + "kind": "ImageStreamTag", + "name": "db:latest" + } + } + } + ], + "replicas": 1, + "test": false, + "selector": { + "io.kompose.service": "db" + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "io.kompose.network/acake2php_cake": "true", + "io.kompose.service": "db" + } + }, + "spec": { + "volumes": [ + { + "name": "acake2php-db-data", + "persistentVolumeClaim": { + "claimName": "acake2php-db-data" + } + }, + { + "name": "acake2php-db-socket", + "persistentVolumeClaim": { + "claimName": "acake2php-db-socket" + } + }, + { + "name": "acake2php-data", + "persistentVolumeClaim": { + "claimName": "acake2php-data" + } + } + ], + "containers": [ + { + "name": "db", + "image": " ", + "ports": [ + { + "containerPort": 3306 + } + ], + "env": [ + { + "name": "BALENA_MACHINE_NAME", + "value": "raspberrypi3" + }, + { + "name": "BALENA_PROJECTS", + "value": "(. ./mysqldb ./deployment/images/node-php7 ./deployment/images/apache-php7) #(submodule deployment/images/primary" + }, + { + "name": "BALENA_PROJECTS_FLAGS", + "value": "(IMG_TAG PRIMARY_HUB SECONDARY_HUB)" + }, + { + "name": "CAKEPHP_DEBUG_LEVEL", + "value": "1" + }, + { + "name": "CAKEPHP_SECURITY_CIPHER_SEED", + "value": "01234" + }, + { + "name": "CAKEPHP_SECURITY_SALT", + "value": "Word" + }, + { + "name": "COLLECT_COVERAGE", + "value": "false" + }, + { + "name": "DATABASE_USER", + "value": "root" + }, + { + "name": "DKR_ARCH", + "value": "armhf" + }, + { + "name": "HTTPD_LISTEN", + "value": "*:80" + }, + { + "name": "IMG_TAG", + "value": "latest" + }, + { + "name": "MYPHPCMS_DIR", + "value": "app/webroot/php_cms" + }, + { + "name": "MYPHPCMS_LOG", + "value": "app/tmp/logs" + }, + { + "name": "PGID", + "value": "1000" + }, + { + "name": "PRIMARY_HUB", + "value": "betothreeprod/apache-php7" + }, + { + "name": "PUID", + "value": "1000" + }, + { + "name": "SECONDARY_HUB", + "value": "betothreeprod/mariadb-raspberrypi3" + }, + { + "name": "SERVER_NAME", + "value": "acake2php.local" + }, + { + "name": "TZ", + "value": "Europe/Paris" + } + ], + "resources": {}, + "volumeMounts": [ + { + "name": "acake2php-db-data", + "mountPath": "/config" + }, + { + "name": "acake2php-db-socket", + "mountPath": "/var/run/mysqld" + }, + { + "name": "acake2php-data", + "mountPath": "/var/www" + } + ] + } + ], + "restartPolicy": "Always" + } + } + }, + "status": {} +} \ No newline at end of file diff --git a/openshift/templates/db-imagestream.json b/openshift/templates/db-imagestream.json new file mode 100644 index 000000000..f8a8a16bc --- /dev/null +++ b/openshift/templates/db-imagestream.json @@ -0,0 +1,28 @@ +{ + "kind": "ImageStream", + "apiVersion": "v1", + "metadata": { + "name": "db", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "db" + } + }, + "spec": { + "tags": [ + { + "name": "latest", + "annotations": null, + "from": { + "kind": "DockerImage", + "name": "betothreeprod/mariadb-intel-nuc" + }, + "generation": null, + "importPolicy": {} + } + ] + }, + "status": { + "dockerImageRepository": "" + } +} \ No newline at end of file diff --git a/openshift/templates/db-service.json b/openshift/templates/db-service.json new file mode 100644 index 000000000..4253a9bb9 --- /dev/null +++ b/openshift/templates/db-service.json @@ -0,0 +1,31 @@ +{ + "kind": "Service", + "apiVersion": "v1", + "metadata": { + "name": "db", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "db" + }, + "annotations": { + "io.balena.features.dbus": "1", + "kompose.cmd": "kompose convert --build build-config --controller deployment -o openshift/templates/ -f docker-compose.x86_64 -j", + "kompose.version": "1.21.0 (992df58d8)" + } + }, + "spec": { + "ports": [ + { + "name": "3306", + "port": 3306, + "targetPort": 3306 + } + ], + "selector": { + "io.kompose.service": "db" + } + }, + "status": { + "loadBalancer": {} + } +} \ No newline at end of file