-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add SSL development option (fix #8211)
- Loading branch information
Showing
3 changed files
with
28 additions
and
7 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,13 +27,21 @@ if [ "$1" == '--e2e_tests' ]; then | |
fi | ||
fi | ||
|
||
# By default we use HTTP to serve the site, but we allow SSL sites with a | ||
# flag. | ||
PROTOCOL='http' | ||
if [ "$1" == '--ssl' ]; then | ||
HOST_PORT=$(docker-compose port wordpress 443 | awk -F : '{printf $2}') | ||
PROTOCOL='https' | ||
fi | ||
|
||
# Get the host port for the WordPress container. | ||
HOST_PORT=$(docker-compose port $CONTAINER 80 | awk -F : '{printf $2}') | ||
|
||
# Wait until the Docker containers are running and the WordPress site is | ||
# responding to requests. | ||
echo -en $(status_message "Attempting to connect to WordPress...") | ||
until $(curl -L http://localhost:$HOST_PORT -so - 2>&1 | grep -q "WordPress"); do | ||
until $(curl -L --insecure $PROTOCOL://localhost:$HOST_PORT -so - 2>&1 | grep -q "WordPress"); do | ||
echo -n '.' | ||
sleep 5 | ||
done | ||
|
@@ -50,7 +58,7 @@ fi | |
echo -e $(status_message "Installing WordPress...") | ||
# The `-u 33` flag tells Docker to run the command as a particular user and | ||
# prevents permissions errors. See: https://github.com/WordPress/gutenberg/pull/8427#issuecomment-410232369 | ||
docker-compose run --rm -u 33 $CLI core install --title="$SITE_TITLE" --admin_user=admin --admin_password=password [email protected] --skip-email --url=http://localhost:$HOST_PORT >/dev/null | ||
docker-compose run --rm -u 33 $CLI core install --title="$SITE_TITLE" --admin_user=admin --admin_password=password [email protected] --skip-email --url=$PROTOCOL://localhost:$HOST_PORT >/dev/null | ||
|
||
if [ "$WP_VERSION" == "latest" ]; then | ||
# Check for WordPress updates, to make sure we're running the very latest version. | ||
|
@@ -59,9 +67,9 @@ fi | |
|
||
# If the 'wordpress' volume wasn't during the down/up earlier, but the post port has changed, we need to update it. | ||
CURRENT_URL=$(docker-compose run -T --rm $CLI option get siteurl) | ||
if [ "$CURRENT_URL" != "http://localhost:$HOST_PORT" ]; then | ||
docker-compose run --rm $CLI option update home "http://localhost:$HOST_PORT" >/dev/null | ||
docker-compose run --rm $CLI option update siteurl "http://localhost:$HOST_PORT" >/dev/null | ||
if [ "$CURRENT_URL" != "$PROTOCOL://localhost:$HOST_PORT" ]; then | ||
docker-compose run --rm $CLI option update home "$PROTOCOL://localhost:$HOST_PORT" >/dev/null | ||
docker-compose run --rm $CLI option update siteurl "$PROTOCOL://localhost:$HOST_PORT" >/dev/null | ||
fi | ||
|
||
# Activate Gutenberg. | ||
|
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