Skip to content

Commit

Permalink
Initial wordpress containers for provisioning tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ethan committed Feb 22, 2019
1 parent 0607b3a commit 2a6f9f7
Show file tree
Hide file tree
Showing 6 changed files with 183 additions and 0 deletions.
53 changes: 53 additions & 0 deletions Targets/Wordpress/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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:

16 changes: 16 additions & 0 deletions Targets/Wordpress/readme.txt
Original file line number Diff line number Diff line change
@@ -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


5 changes: 5 additions & 0 deletions Targets/Wordpress/wordpress_cli/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions Targets/Wordpress/wordpress_cli/sed.sh
Original file line number Diff line number Diff line change
@@ -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

89 changes: 89 additions & 0 deletions Targets/Wordpress/wordpress_cli/wp-config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the
* installation. You don't have to use the web site, you can
* copy this file to "wp-config.php" and fill in the values.
*
* This file contains the following configurations:
*
* * MySQL settings
* * Secret keys
* * Database table prefix
* * ABSPATH
*
* @link https://codex.wordpress.org/Editing_wp-config.php
*
* @package WordPress
*/

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');

/** MySQL database username */
define('DB_USER', 'wordpress');

/** MySQL database password */
define('DB_PASSWORD', '54y6RxN7GfC7aes3');

/** MySQL hostname */
define('DB_HOST', 'wordpress_data');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8mb4');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
define('AUTH_KEY', '<_IPVJ^rd7p@8UIRrT}7U6pE[f(8[L99[}Kr,}Gz-o4}8D7`p$?zb nyAnnpO9J<');
define('SECURE_AUTH_KEY', '1GO6 `<h3&4:yd,K&+cv/SkFGT5b$&xModZdCHV^XPQQTMXqj:,[i|x>|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?]B9<H%+[8&IHZ0{');
define('SECURE_AUTH_SALT', 'pyt]JLvOmrYL)**>0+(d< -{_Ax9*@uewcP!Sc2T@AWI`%]^=I>IZ`99;W:z4J>K');
define('LOGGED_IN_SALT', 'u?KRIqFtiOoG/wg*}u3QEC.~S<3S|^<`zTH*Z%&pw<tq&ix*8TfzulWa/7b2}7Y4');
define('NONCE_SALT', '~P?E&HbjW,QN5p>iW[.~]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');
14 changes: 14 additions & 0 deletions Targets/Wordpress/wordpress_data/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2a6f9f7

Please sign in to comment.