taler-deployment

Deployment scripts and configuration files
Log | Files | Refs | README

commit 1022ff4302d59bb8456784867cca649d196f77f7
parent 800f9bd771f4566717c1f55286e093a39182ae17
Author: Javier Sepulveda <javier.sepulveda@uv.es>
Date:   Tue, 21 Mar 2023 12:42:18 +0100

Sandcastle, woocommerce, Docker deployment

Diffstat:
Asandcastle/images/woocommerce/Dockerfile | 86+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asandcastle/images/woocommerce/docker-compose.yml | 33+++++++++++++++++++++++++++++++++
Asandcastle/images/woocommerce/entry-point.sh | 50++++++++++++++++++++++++++++++++++++++++++++++++++
Asandcastle/images/woocommerce/tags.conf | 9+++++++++
4 files changed, 178 insertions(+), 0 deletions(-)

diff --git a/sandcastle/images/woocommerce/Dockerfile b/sandcastle/images/woocommerce/Dockerfile @@ -0,0 +1,86 @@ +FROM debian:bullseye + +# This file is in the public domain. + +LABEL docker-woocommerce.demo.taler.net="0.0.1-beta" + +WORKDIR /root/ + +COPY tags.conf /root/ +COPY entry-point.sh /root/ +COPY setup-mariadb.sql /root/ + +# Install dependencies + + +RUN apt-get update && apt-get install -y \ + software-properties-common \ + ca-certificates \ + lsb-release \ + apt-transport-https \ + wget \ + curl \ + git \ + unzip \ + gnupg + +RUN sh -c 'echo "deb https://packages.sury.org/php/ bullseye main" > /etc/apt/sources.list.d/php.list' + +RUN wget -qO - https://packages.sury.org/php/apt.gpg | apt-key add - + +RUN apt-get update + +RUN . /root/tags.conf \ + && apt-get install \ + php${PHP_VERSION} \ + php${PHP_VERSION}-common \ + php${PHP_VERSION}-mbstring \ + php${PHP_VERSION}-xmlrpc \ + php${PHP_VERSION}-soap \ + php${PHP_VERSION}-gd \ + php${PHP_VERSION}-xml \ + php${PHP_VERSION}-intl \ + php${PHP_VERSION}-mysql \ + php${PHP_VERSION}-cli \ + php${PHP_VERSION}-ldap \ + php${PHP_VERSION}-zip \ + php${PHP_VERSION}-curl\ + php${PHP_VERSION}-zip \ + php${PHP_VERSION}-fpm -y + +# Download Wordpress, plugins and theme + extract + +RUN . /root/tags.conf \ + && mkdir -p /var/www/wordpress/wp-content/plugins \ + && mkdir -p /var/www/wordpress/wp-content/themes \ + && wget https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz \ + && tar -xzf wordpress-${WORDPRESS_VERSION}.tar.gz -C /var/www/ \ + && wget https://downloads.wordpress.org/plugin/woocommerce.${WOOCOMMERCE_VERSION}.zip \ + && unzip woocommerce.${WOOCOMMERCE_VERSION}.zip -d /var/www/wordpress/wp-content/plugins \ + && wget https://downloads.wordpress.org/theme/ecommerce-star.${WORDPRESS_PARENT_THEME_VERSION}.zip \ + && unzip ecommerce-star.${WORDPRESS_PARENT_THEME_VERSION}.zip -d /var/www/wordpress/wp-content/themes \ + && wget https://downloads.wordpress.org/theme/shop-here.${WORDPRESS_CHILD_THEME_VERSION}.zip \ + && unzip shop-here.${WORDPRESS_CHILD_THEME_VERSION}.zip -d /var/www/wordpress/wp-content/themes \ + && wget https://downloads.wordpress.org/plugin/gnu-taler-payment-for-woocommerce.zip \ + && unzip gnu-taler-payment-for-woocommerce.zip -d /var/www/wordpress/wp-content/plugins + +# Install wp-cli + +RUN wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \ + && chmod +x wp-cli.phar \ + && mv wp-cli.phar /usr/local/bin/wp + + +RUN chown -R www-data:www-data /var/www/wordpress + +# Remove downloads + +RUN rm -Rf *.zip + +RUN chmod +x entry-point.sh + +#ENTRYPOINT /root/entry-point.sh + +# Additional steps after entrypoint. + +#CMD [".sh", "command"] diff --git a/sandcastle/images/woocommerce/docker-compose.yml b/sandcastle/images/woocommerce/docker-compose.yml @@ -0,0 +1,33 @@ +version: '3' +services: + db: + image: mariadb + environment: + MYSQL_DATABASE: exampledb + MYSQL_USER: wordpress_user + MYSQL_PASSWORD: wordpress_password + MYSQL_RANDOM_ROOT_PASSWORD: "1" + ports: + - "3306:3306" + volumes: + - mariadb_data:/var/lib/mysql + + wordpress: + build: images/woocommerce + image: woo + container_name: woocommerce_taler + depends_on: + - db + ports: + - 8080:80 + restart: always + environment: + WORDPRESS_DB_HOST: mysql:3306 + WORDPRESS_DB_USER: wordpress_user + WORDPRESS_DB_PASSWORD: wordpress_password + WORDPRESS_DB_NAME: exampledb + volumes: + - /var/www/wordpress:/var/www/wordpress + +volumes: + mariadb_data: diff --git a/sandcastle/images/woocommerce/entry-point.sh b/sandcastle/images/woocommerce/entry-point.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +source /root/tags.conf + +# Enable php-fpm NGINX + +#systemctl reload nginx + +# Enable MariaDB + +#systemctl restart mariadb + +# Import datbase (if wp-cli works, this wont be necessary) + +#mysql -u ${MARIADB_USER} -p${MARIADB_PASSWORD} ${MARIADB_DATABASE_NAME} < woocommerce.sql + +# Rename wordpress config file + +mv /var/www/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php + +# Replace values database connection + +# Replace values with .env VARIABLES + +sed -ie "s/database_name_here/${WORDPRESS_DATABASE_NAME}/g" /var/www/wordpress/wp-config.php \ + && sed -ie "s/username_here/${WORDPRESS_DATABASE_USER}/g" /var/www/wordpress/wp-config.php \ + && sed -ie "s/password_here/${WORDPRESS_DATABASE_PASSWORD}/g" /var/www/wordpress/wp-config.php + +# Install WP + +wp core install --url=test.woocommerce.taler.net --title=GNU Taler for WooCommerce --admin_user=supervisor --admin_password=strongpassword --admin_email=info@example.com + +# Enable theme shop-here + +wp theme enable shop-here + +# Activate Woocommerce plugin + +wp plugin activate woocommerce + +# Activate GNU Taler plugin + +wp plugin activate gnu-taler-payment-for-woocommerce + +# Import products into database + +# Need to prepare the export.xml file first + +#wp import /woocommerce-products-backup.xml --authors=create + diff --git a/sandcastle/images/woocommerce/tags.conf b/sandcastle/images/woocommerce/tags.conf @@ -0,0 +1,9 @@ + +# Software versions + +PHP_VERSION="8.2" +WOOCOMMERCE_VERSION="7.1.1" +WORDPRESS_VERSION="6.1" +WORDPRESS_PARENT_THEME_VERSION="1.3.9" +WORDPRESS_CHILD_THEME_VERSION="1.0.2" +