diff --git a/Targets/Wordpress/docker-compose.yml b/Targets/Wordpress/docker-compose.yml new file mode 100644 index 0000000..73a75d6 --- /dev/null +++ b/Targets/Wordpress/docker-compose.yml @@ -0,0 +1,53 @@ +version: "3.3" + +services: + + wordpress_server: + #build: ./wordpress_server/ + image: wordpress + container_name: wordpress_server + networks: + - net + depends_on: + - wordpress_data + ports: + - "80:80" + devices: + - "/dev/tty:/dev/tty" + links: + - "wordpress_data:wordpress_data" + volumes: + - wordpress_server:/var/www/html + + wordpress_data: + build: ./wordpress_data/ + container_name: wordpress_data + networks: + - net + volumes: + - wordpress_data:/var/lib/mysql + + wordpress_cli: + #image: wordpress:cli + build: ./wordpress_cli/ + links: + - "wordpress_server:wordpress_server" + user: xfs + command: bash -c 'if [ ! -s /var/www/html/wp-config.php ]; then sleep 10; wp config create --dbname=wordpress --dbuser=wordpress --dbpass=54y6RxN7GfC7aes3 --dbhost=wordpress_data; sleep 3; wp core install --url="http://localhost/" --title="wordpress" --admin_user="admin" --admin_password="54y6RxN7GfC7aes3" --admin_email="sentrifugo.container@gmail.com"; sed -i "s/<\/IfModule>/RewriteCond \%{HTTP:Authorization} \^\(\.\*\)\nRewriteRule \^\(\.\*\) - [E=HTTP_AUTHORIZATION:\%1]\n<\/IfModule>\nSetEnvIf Authorization "\(\.\*\)" HTTP_AUTHORIZATION=\$$1/" /var/www/html/.htaccess; /tmp/sed.sh; wp plugin install jwt-authentication-for-wp-rest-api --activate; fi' + container_name: wordpress_cli + networks: + - net + depends_on: + - wordpress_data + - wordpress_server + volumes: + - wordpress_server:/var/www/html + +networks: + net: + driver: bridge + +volumes: + wordpress_data: + wordpress_server: + diff --git a/Targets/Wordpress/readme.txt b/Targets/Wordpress/readme.txt new file mode 100644 index 0000000..593c9e4 --- /dev/null +++ b/Targets/Wordpress/readme.txt @@ -0,0 +1,16 @@ +# This is a set of containers for +# bringing up a mariadb and wordpress +# instance that is fully configured and +# has the JWT for REST APIs plugin +# installed and enabled. + +# The purpose for these are for easy +# testing of the APIs from provisioning +# platforms. + +# After running the docker-compose up -d +# You shold be able to login at +# http://localhost/wp-admin with +# admin/54y6RxN7GfC7aes3 + + diff --git a/Targets/Wordpress/wordpress_cli/Dockerfile b/Targets/Wordpress/wordpress_cli/Dockerfile new file mode 100644 index 0000000..6a5554c --- /dev/null +++ b/Targets/Wordpress/wordpress_cli/Dockerfile @@ -0,0 +1,5 @@ +from wordpress:cli +USER xfs +VOLUME /var/www/html +COPY sed.sh /tmp +#RUN chmod 777 /var/www/html/sed.sh diff --git a/Targets/Wordpress/wordpress_cli/sed.sh b/Targets/Wordpress/wordpress_cli/sed.sh new file mode 100755 index 0000000..2592740 --- /dev/null +++ b/Targets/Wordpress/wordpress_cli/sed.sh @@ -0,0 +1,6 @@ +#!/bin/bash +#echo "define('JWT_AUTH_SECRET_KEY', 'your-top-secret-key');" >> /var/www/html/wp-config.php; +#echo "define('JWT_AUTH_CORS_ENABLE', true);" >> /var/www/html/wp-config.php +sed -i "s/define( 'DB_COLLATE', '' );/define( 'DB_COLLATE', '' );\ndefine('JWT_AUTH_SECRET_KEY', 'your-top-secret-key');\ndefine('JWT_AUTH_CORS_ENABLE', true);\n/" /var/www/html/wp-config.php +sed -i "s/RewriteBase \//RewriteBase \/\nRewriteRule \^wp-json\/\(\.\*\) \/?rest_route=\/\$1 \[L\]\n/" /var/www/html/.htaccess + diff --git a/Targets/Wordpress/wordpress_cli/wp-config.php b/Targets/Wordpress/wordpress_cli/wp-config.php new file mode 100644 index 0000000..d2f18df --- /dev/null +++ b/Targets/Wordpress/wordpress_cli/wp-config.php @@ -0,0 +1,89 @@ +|u>t[Cmv'); +define('LOGGED_IN_KEY', '-rlFxPNHu|?qMY.]9M8B|WwheVIBHqxP=fcd42P^C./e)v[87?>ma$KSK=zsBe+h'); +define('NONCE_KEY', '59vz[Q_#}~~TOZ|%7.rvj?[Hc3]}Q0,.kB(vcA.K4hn:W K*tpH_me{0G6P^qey('); +define('AUTH_SALT', 'Snd__*ZhB{ih~qs20iwU||0}B,*tvFY*1tzzOb~]D~y/Kk4R?]B90+(d< -{_Ax9*@uewcP!Sc2T@AWI`%]^=I>IZ`99;W:z4J>K'); +define('LOGGED_IN_SALT', 'u?KRIqFtiOoG/wg*}u3QEC.~S<3S|^<`zTH*Z%&pwiW[.~]k+*uE0[*-3O-t~9JOx=-Sb ,F!%1q{Q/=9)h;>nhN~d'); + +/**#@-*/ + +/** + * WordPress Database Table prefix. + * + * You can have multiple installations in one database if you give each + * a unique prefix. Only numbers, letters, and underscores please! + */ +$table_prefix = 'wp_'; + +/** + * For developers: WordPress debugging mode. + * + * Change this to true to enable the display of notices during development. + * It is strongly recommended that plugin and theme developers use WP_DEBUG + * in their development environments. + * + * For information on other constants that can be used for debugging, + * visit the Codex. + * + * @link https://codex.wordpress.org/Debugging_in_WordPress + */ +define('WP_DEBUG', false); + +/* That's all, stop editing! Happy blogging. */ + +/** Absolute path to the WordPress directory. */ +if ( !defined('ABSPATH') ) + define('ABSPATH', dirname(__FILE__) . '/'); + +/** Sets up WordPress vars and included files. */ +require_once(ABSPATH . 'wp-settings.php'); diff --git a/Targets/Wordpress/wordpress_data/Dockerfile b/Targets/Wordpress/wordpress_data/Dockerfile new file mode 100644 index 0000000..48d4f16 --- /dev/null +++ b/Targets/Wordpress/wordpress_data/Dockerfile @@ -0,0 +1,14 @@ +from mariadb:latest +RUN apt-get update +#RUN apt-get install wget gcc libmysql++-dev librabbitmq-dev pkg-config libbsd-dev -y +#ENV MYSQL_RANDOM_ROOT_PASSWORD=true +ENV MYSQL_ROOT_PASSWORD=54y6RxN7GfC7aes3 +ENV MYSQL_DATABASE=wordpress +ENV MYSQL_USER=wordpress +ENV MYSQL_PASSWORD=54y6RxN7GfC7aes3 +#WORKDIR /tmp +#RUN wget https://github.com/ssimicro/lib_mysqludf_amqp/releases/download/v2.0.0/lib_mysqludf_amqp-2.0.0.tar.gz +#RUN tar zxf lib_mysqludf_amqp-2.0.0.tar.gz +#WORKDIR /tmp/lib_mysqludf_amqp-2.0.0 +#RUN ./configure && make && make install #mysql -u root --password=54y6RxN7GfC7aes3 < installdb.sql +EXPOSE 3306