Compare commits

...

2 Commits

Author SHA1 Message Date
Ray Elliott 8f0497844b update enable mod_rewrite on container 2020-03-19 13:25:29 +00:00
Ray Elliott 6bd3bf2b50 update README 2020-03-19 12:09:50 +00:00
4 changed files with 27 additions and 4 deletions

View File

@ -4,10 +4,9 @@ TODO
## TODO ## TODO
* implement option to not have remote url include hostname (i.e., bare domain)
* convert scripts to use ssh pipes/bash here documents.
see [ssh pipes](https://stackoverflow.com/a/4412324), [Bash Here Document](https://stackoverflow.com/a/4412338)
* Script to export database from production database * Script to export database from production database
* Script to export wordpress directory from production * Script to export wordpress directory from production
* Script to set up local container using exported database/wordpress installation * Script to set up local container using exported database/wordpress installation
* Refactor duplicated code (e.g., creating containers, exporting data) * Refactor duplicated code (e.g., creating containers, exporting data)
* convert all scripts to use ssh pipes/bash here documents.
see [ssh pipes](https://stackoverflow.com/a/4412324), [Bash Here Document](https://stackoverflow.com/a/4412338)

View File

@ -0,0 +1,11 @@
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/wordpress
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<Directory /var/www/html/wordpress>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

View File

@ -5,6 +5,7 @@ set -e
_host="$_local_hostname.$_local_domain" _host="$_local_hostname.$_local_domain"
_user_root='root' _user_root='root'
_ssh_cmd_root="ssh $_user_root@$_host" _ssh_cmd_root="ssh $_user_root@$_host"
_scp_to="$_user_root@$_host"
_ssh_cmd_www="sshpass -p$_passwd_www ssh $_user_www@$_host" _ssh_cmd_www="sshpass -p$_passwd_www ssh $_user_www@$_host"
_ssh_cmd_www_cd="$_ssh_cmd_www cd /var/www/html/wordpress &&" _ssh_cmd_www_cd="$_ssh_cmd_www cd /var/www/html/wordpress &&"
@ -15,7 +16,8 @@ printf "\nInstalling requirements ..."
$_ssh_cmd_root 'apt-get update && apt-get -y upgrade && apt-get -y install apache2 mariadb-server php php-common libapache2-mod-php python-mysqldb php-gd php-ssh2 php-mysql php-dom php-simplexml php-xml php-xmlreader php-curl php-ftp php-iconv php-imagick php-mbstring php-posix php-sockets php-tokenizer php-zip' $_ssh_cmd_root 'apt-get update && apt-get -y upgrade && apt-get -y install apache2 mariadb-server php php-common libapache2-mod-php python-mysqldb php-gd php-ssh2 php-mysql php-dom php-simplexml php-xml php-xmlreader php-curl php-ftp php-iconv php-imagick php-mbstring php-posix php-sockets php-tokenizer php-zip'
printf "\nConfiguring Apache ..." printf "\nConfiguring Apache ..."
$_ssh_cmd_root 'sed -i '\''s+DocumentRoot /var/www/html$+DocumentRoot /var/www/html/wordpress+'\'' /etc/apache2/sites-enabled/000-default.conf && systemctl restart apache2' scp ./dev/config/000-default.conf "$_scp_to":/etc/apache2/sites-enabled/000-default.conf
$_ssh_cmd_root 'a2enmod rewrite; systemctl restart apache2'
printf "\nSetting %s permissions ..." "$_user_www" printf "\nSetting %s permissions ..." "$_user_www"
$_ssh_cmd_root "echo \"$_user_www:$_passwd_www\" | chpasswd" $_ssh_cmd_root "echo \"$_user_www:$_passwd_www\" | chpasswd"

11
incorporate-this.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
. ./env.sh
ssh "$remote_username@$remote_url" wget -O testdata.xml 'https://raw.githubusercontent.com/WPTRT/theme-unit-test/master/themeunittestdata.wordpress.xml'
ssh "$remote_username@$remote_url" wp "--path=$remote_path" \
import testdata.xml \
--authors=create
ssh "$remote_username@$remote_url" rm testdata.xml