gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-deployment] branch master updated: Dockerfile OK - wp-cli command


From: gnunet
Subject: [taler-deployment] branch master updated: Dockerfile OK - wp-cli commands:pending
Date: Mon, 27 Mar 2023 10:09:28 +0200

This is an automated email from the git hooks/post-receive script.

javier-sepulveda pushed a commit to branch master
in repository deployment.

The following commit(s) were added to refs/heads/master by this push:
     new 4c5ea9d  Dockerfile OK - wp-cli commands:pending
4c5ea9d is described below

commit 4c5ea9dde09588126afd5672e9a5dae913894138
Author: Javier Sepulveda <javier.sepulveda@uv.es>
AuthorDate: Mon Mar 27 10:01:43 2023 +0200

    Dockerfile OK - wp-cli commands:pending
---
 sandcastle/images/woocommerce/Dockerfile         | 33 ++++++++++++-----
 sandcastle/images/woocommerce/docker-compose.yml | 31 +++++++++++-----
 sandcastle/images/woocommerce/entry-point.sh     | 34 ++++++++---------
 sandcastle/images/woocommerce/tags.conf          | 12 ++++++
 sandcastle/images/woocommerce/woocommerce.conf   | 47 ++++++++++++++++++++++++
 5 files changed, 121 insertions(+), 36 deletions(-)

diff --git a/sandcastle/images/woocommerce/Dockerfile 
b/sandcastle/images/woocommerce/Dockerfile
index 01070d4..0d16df7 100644
--- a/sandcastle/images/woocommerce/Dockerfile
+++ b/sandcastle/images/woocommerce/Dockerfile
@@ -3,12 +3,14 @@ FROM debian:bullseye
 # This file is in the public domain.
 
 LABEL docker-woocommerce.demo.taler.net="0.0.1-beta"
+RUN echo "avoid docker cache..."
+
+EXPOSE 9001
 
 WORKDIR /root/
 
-COPY tags.conf /root/
-COPY entry-point.sh /root/
-COPY setup-mariadb.sql /root/
+COPY tags.conf .
+COPY entry-point.sh .
 
 # Install dependencies
 
@@ -22,7 +24,8 @@ RUN apt-get update && apt-get install -y \
     curl \
     git \
     unzip \
-    gnupg
+    gnupg \
+    nginx 
 
 RUN sh -c 'echo "deb https://packages.sury.org/php/ bullseye main" > 
/etc/apt/sources.list.d/php.list' 
 
@@ -67,20 +70,30 @@ RUN . /root/tags.conf \
 # 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
+     && 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
+# Remove downloads from root directory
+
+RUN rm -Rf /root/*.zip
+
+# Copy nginx configuration from host, to container
+
+COPY woocommerce.conf /etc/nginx/sites-available
+
+RUN ln -s /etc/nginx/sites-available/woocommerce.conf 
/etc/nginx/sites-enabled/woocommerce.conf \
+ && rm /etc/nginx/sites-enabled/default
+
 
-RUN rm -Rf *.zip 
+# Execute entrypoint
 
 RUN chmod +x entry-point.sh
 
-#ENTRYPOINT /root/entry-point.sh
+ENTRYPOINT /root/entry-point.sh
 
 # Additional steps after entrypoint.
 
-#CMD  [".sh", "command"]
+#CMD ["nginx", "-g", "daemon off;"]
diff --git a/sandcastle/images/woocommerce/docker-compose.yml 
b/sandcastle/images/woocommerce/docker-compose.yml
index b29d0f8..63850d6 100644
--- a/sandcastle/images/woocommerce/docker-compose.yml
+++ b/sandcastle/images/woocommerce/docker-compose.yml
@@ -3,15 +3,12 @@ services:
   db:
     image: mariadb
     environment:
-      MYSQL_DATABASE: exampledb
+      MARIADB_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
@@ -19,15 +16,31 @@ services:
     depends_on:
       - db
     ports:
-      - 8080:80
-    restart: always
+      - "9001:80"
     environment:
-      WORDPRESS_DB_HOST: mysql:3306
+      WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress_user
       WORDPRESS_DB_PASSWORD: wordpress_password
       WORDPRESS_DB_NAME: exampledb
+      WORDPRESS_TABLE_PREFIX: "wp_"
+      WORDPRESS_DEBUG: 1
     volumes:
-      - /var/www/wordpress:/var/www/wordpress
-
+      - wp_data:/var/www/wordpress
+      - /home/jj/final-woocommerce-docker/nginx-conf:/etc/nginx/conf.d
+  wordpress-cli:
+     container_name: wp_cli
+     #entrypoint: wordpress
+     depends_on:
+      - db
+      - wordpress
+     volumes:
+       - wp_data:/var/www/wordpress
+     image: wordpress:cli
+     links: 
+       - db:db
+     working_dir: /var/www/wordpress
+     user: "33"
+     command: wp core install --path="/var/www/wordpress" 
--url="http://woocommerce.valenciatech.com"; --title=gnu-taler 
--admin_user=admin --admin_password=admin --admin_email=your-email-here
 volumes:
+  wp_data:
   mariadb_data:
diff --git a/sandcastle/images/woocommerce/entry-point.sh 
b/sandcastle/images/woocommerce/entry-point.sh
index 8c62f05..d954d78 100755
--- a/sandcastle/images/woocommerce/entry-point.sh
+++ b/sandcastle/images/woocommerce/entry-point.sh
@@ -2,15 +2,7 @@
 
 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)
+# Import the whole database (if wp-cli works, this wont be necessary)
 
 #mysql -u ${MARIADB_USER} -p${MARIADB_PASSWORD} ${MARIADB_DATABASE_NAME} < 
woocommerce.sql
 
@@ -24,27 +16,35 @@ mv /var/www/wordpress/wp-config-sample.php 
/var/www/wordpress/wp-config.php
 
 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
+    && sed -ie "s/password_here/${WORDPRESS_DATABASE_PASSWORD}/g" 
/var/www/wordpress/wp-config.php \
+    && sed -ie "s/localhost/${WORDPRESS_DATABASE_HOST}/g" 
/var/www/wordpress/wp-config.php
+
 
-# Install WP
+# Install WP (either do it here, or through the docker-compose.yml). 
 
-wp core install --url=test.woocommerce.taler.net --title=GNU Taler for 
WooCommerce --admin_user=supervisor --admin_password=strongpassword 
--admin_email=info@example.com
+#wp core install --allow-root --url=test.woocommerce.taler.net --title=GNU 
Taler for WooCommerce --admin_user=admin --admin_password=admin 
--admin_email=info@example.com
 
 # Enable theme shop-here
 
-wp theme enable shop-here
+#wp theme enable shop-here
 
 # Activate Woocommerce plugin
 
-wp plugin activate woocommerce
+#wp plugin  activate woocommerce
 
 # Activate GNU Taler plugin
 
-wp plugin activate gnu-taler-payment-for-woocommerce
+#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
 
+service nginx start
+
+service php${PHP_VERSION}-fpm start
+
+
+while true; do
+        sleep 100;
+        done
diff --git a/sandcastle/images/woocommerce/tags.conf 
b/sandcastle/images/woocommerce/tags.conf
index d7510d6..2ac9d96 100644
--- a/sandcastle/images/woocommerce/tags.conf
+++ b/sandcastle/images/woocommerce/tags.conf
@@ -7,3 +7,15 @@ WORDPRESS_VERSION="6.1"
 WORDPRESS_PARENT_THEME_VERSION="1.3.9"
 WORDPRESS_CHILD_THEME_VERSION="1.0.2"
 
+# MariaDB credentials (just in case)
+
+MARIADB_USER="wordpress_user"
+MARIADB_PASSWORD="wordpress_password"
+MARIADB_DATABASE_NAME="exampledb"
+
+# Database connection details
+
+WORDPRESS_DATABASE_NAME="exampledb"
+WORDPRESS_DATABASE_USER="wordpress_user"
+WORDPRESS_DATABASE_PASSWORD="wordpress_password"
+WORDPRESS_DATABASE_HOST="db"
diff --git a/sandcastle/images/woocommerce/woocommerce.conf 
b/sandcastle/images/woocommerce/woocommerce.conf
new file mode 100644
index 0000000..b560802
--- /dev/null
+++ b/sandcastle/images/woocommerce/woocommerce.conf
@@ -0,0 +1,47 @@
+# Upstream to abstract backend connection(s) for php
+upstream php {
+        server unix:/var/run/php/php8.2-fpm.sock;
+        server 127.0.0.1:9000;
+}
+
+server {
+        listen 80;
+        server_name _;
+        ## Your website name goes here.
+        # server_name woocommerce.valenciatech.cloud;
+        ## Your only path reference.
+        root /var/www/wordpress;
+        ## This should be in your http block and if it is, it's not needed 
here.
+        index index.php;
+
+        location = /favicon.ico {
+                log_not_found off;
+                access_log off;
+        }
+
+        location = /robots.txt {
+                allow all;
+                log_not_found off;
+                access_log off;
+        }
+
+        location / {
+                # This is cool because no php is touched for static content.
+                # include the "?$args" part so non-default permalinks doesn't 
break when using query string
+                try_files $uri $uri/ /index.php?$args;
+        }
+
+        location ~ \.php$ {
+                #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
+                include fastcgi_params;
+                fastcgi_intercept_errors on;
+                fastcgi_pass php;
+                #The following parameter can be also included in 
fastcgi_params file
+                fastcgi_param  SCRIPT_FILENAME 
$document_root$fastcgi_script_name;
+        }
+
+        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
+                expires max;
+                log_not_found off;
+        }
+}

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]