Use the mysql data loading
Last active
March 28, 2017 19:37
-
-
Save majorgreys/7292688fcaace156a4b1d3434a205b70 to your computer and use it in GitHub Desktop.
setting up a docker environment for CAC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// THE DOMAIN | |
$baseDomain = 'commons.gc.cuny.edu'; | |
// WORDPRESS | |
define( 'DB_NAME', getenv('WORDPRESS_DB_NAME') ); | |
define( 'DB_USER', getenv('WORDPRESS_DB_USER') ); | |
define( 'DB_PASSWORD', getenv('WORDPRESS_DB_PASSWORD') ); | |
define( 'DB_HOST', getenv('WORDPRESS_DB_HOST') ); | |
// BBPRESS | |
define( 'BBDB_NAME', getenv('WORDPRESS_DB_NAME') ); | |
define( 'BBDB_USER', getenv('WORDPRESS_DB_USER') ); | |
define( 'BBDB_PASSWORD', getenv('WORDPRESS_DB_PASSWORD') ); | |
define( 'BBDB_HOST', getenv('WORDPRESS_DB_HOST') ); | |
define( 'BBDB_CHARSET', 'utf8' ); | |
define( 'BBDB_COLLATE', '' ); | |
// WIKI | |
define( 'MW_DB_SERVER', '127.0.0.1'); | |
define( 'MW_DB_NAME', ''); | |
define( 'MW_DB_USER', ''); | |
define( 'MW_DB_PASSWORD', ''); | |
// Miscellaneous config | |
define( 'WP_DEBUG', true ); | |
// Development | |
define( 'ENV_TYPE', 'local' ); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Fill our vars and run on cli | |
# $ php -f db-connect-test.php | |
$dbname = 'wordpress'; | |
$dbuser = 'wordpress'; | |
$dbpass = getenv('WORDPRESS_DB_PASSWORD'); | |
$dbhost = getenv('WORDPRESS_DB_HOST'); | |
$connect = mysqli_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'"); | |
mysqli_select_db($connect, $dbname) or die("Could not open the db '$dbname'"); | |
$test_query = "SHOW TABLES FROM $dbname"; | |
$result = mysqli_query($connect, $test_query); | |
$tblCnt = 0; | |
while($tbl = mysqli_fetch_array($result)) { | |
$tblCnt++; | |
#echo $tbl[0]."<br />\n"; | |
} | |
if (!$tblCnt) { | |
echo "There are no tables<br />\n"; | |
} else { | |
echo "There are $tblCnt tables<br />\n"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
services: | |
db: | |
image: mysql:5.7 | |
restart: always | |
environment: | |
MYSQL_ROOT_PASSWORD: wordpress | |
MYSQL_DATABASE: wordpress | |
MYSQL_USER: wordpress | |
MYSQL_PASSWORD: wordpress | |
volumes: | |
- ./../commons-data:/docker-entrypoint-initdb.d | |
- ./.data/db:/var/lib/mysql | |
web: | |
depends_on: | |
- db | |
links: | |
- db | |
ports: | |
- 80:80 | |
restart: always | |
hostname: commons | |
domainname: gc.cuny.edu | |
build: . | |
environment: | |
WORDPRESS_DB_HOST: db:3306 | |
WORDPRESS_DB_NAME: wordpress | |
WORDPRESS_DB_USER: wordpress | |
WORDPRESS_DB_PASSWORD: wordpress | |
WP_HOME: http://commons.gc.cuny.edu | |
WP_SITEURL: http://commons.gc.cuny.edu | |
XDEBUG_CONFIG: remote_host=10.0.1.100 | |
volumes: | |
- ./../cac:/var/www/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM wordpress | |
RUN yes | pecl install xdebug \ | |
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \ | |
&& echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \ | |
&& echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini \ | |
&& echo "xdebug.remote_log=\"/var/log/xdebug.log\"" >> /usr/local/etc/php/conf.d/xdebug.ini |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment