Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* If the given URL is http://github.com/... and returns 404, then try to download the archive with the `gh` command and try to download the archive at http://github.com/...
* Allow starman's --user option to be specified in the MT_UID environment variable.
* Changed to not bind mount files whenever possible. This is because bind mounting files on Docker Desktop on Mac causes an error.

### Changed

Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export MT_HOME_PATH:=${MAKEFILE_DIR}/../movabletype
export HTTPD_HOST_NAME:=localhost
export HTTPD_EXPOSE_PORT:=80
export UPDATE_BRANCH:=yes
export BIND_MOUNT_DIRECTORIES_ONLY:=no
export UPDATE_DOCKER_IMAGE:=yes
export CREATE_DATABASE_IF_NOT_EXISTS:=yes
export DOCKER_MT_CPANFILES:=t/cpanfile
Expand Down Expand Up @@ -121,6 +122,7 @@ up-cgi: MT_RUN_VIA=cgi
up-cgi: up-common

up-psgi: MT_RUN_VIA=psgi
up-psgi: BIND_MOUNT_DIRECTORIES_ONLY:=yes
up-psgi: up-common


Expand All @@ -142,7 +144,7 @@ ifeq (${RECIPE},)
endif
endif

$(eval export _ARGS=$(shell UPDATE_BRANCH=${UPDATE_BRANCH} ${MAKEFILE_DIR}/bin/setup-environment --recipe "$(shell echo ${RECIPE} | tr ',' ' ')" --repo "$(shell echo ${REPO} | tr ',' ' ')" --pr "$(shell echo ${PR} | tr ',' ' ')" --archive "$(shell echo ${ARCHIVE_FOR_SETUP} | tr ',' ' ')"))
$(eval export _ARGS=$(shell UPDATE_BRANCH=${UPDATE_BRANCH} BIND_MOUNT_DIRECTORIES_ONLY=${BIND_MOUNT_DIRECTORIES_ONLY} ${MAKEFILE_DIR}/bin/setup-environment --recipe "$(shell echo ${RECIPE} | tr ',' ' ')" --repo "$(shell echo ${REPO} | tr ',' ' ')" --pr "$(shell echo ${PR} | tr ',' ' ')" --archive "$(shell echo ${ARCHIVE_FOR_SETUP} | tr ',' ' ')"))
ifneq (${RECIPE},)
@perl -e 'exit(length($$ENV{_ARGS}) > 0 ? 0 : 1)'
endif
Expand Down
3 changes: 3 additions & 0 deletions bin/setup-environment
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ sub handle_recipe {
}

for my $l (@$links) {
next
if $ENV{BIND_MOUNT_DIRECTORIES_ONLY} eq 'yes'
&& !-d "$plugin_dir/$l";
push @volumes,
" - '$plugin_dir/$l:/var/www/cgi-bin/mt/$l:\${DOCKER_VOLUME_MOUNT_FLAG:-rw}'";
}
Expand Down
5 changes: 0 additions & 5 deletions mt/cgi-bin-mt.htaccess

This file was deleted.

11 changes: 6 additions & 5 deletions mt/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ services:
DOCKER_MT_CPANFILES: ${DOCKER_MT_CPANFILES}
APACHE_LOG_DIR: ${APACHE_LOG_DIR:-/tmp/apache2/log}
APACHE_PID_FILE: ${APACHE_PID_FILE:-/tmp/apache2/run/apache2.pid}
MT_HOME: /var/www/cgi-bin/mt
MT_CONFIG: ${MT_CONFIG_CGI_DEST_PATH:-/etc/mt/mt-config.cgi}
volumes:
- "..:/mt-dev"
- "${MT_HOME_PATH:-../../movabletype}:/var/www/cgi-bin/mt:${DOCKER_VOLUME_MOUNT_FLAG:-rw}"
- "${MT_CONFIG_CGI_SRC_PATH:-../mt-config.cgi-original}:${MT_CONFIG_CGI_DEST_PATH:-/var/www/cgi-bin/mt/mt-config.cgi}:${DOCKER_VOLUME_MOUNT_FLAG:-rw}"
- "${MT_CONFIG_CGI_SRC_PATH:-../mt-config.cgi-original}:${MT_CONFIG_CGI_DEST_PATH:-/etc/mt/mt-config.cgi}:${DOCKER_VOLUME_MOUNT_FLAG:-rw}"
- "${BASE_SITE_PATH:-site}:/var/www/html:${DOCKER_VOLUME_MOUNT_FLAG:-rw}"
- "support:/var/www/cgi-bin/mt/mt-static/support:${DOCKER_VOLUME_MOUNT_FLAG:-rw}"
# override entrypoint
Expand All @@ -39,17 +41,16 @@ services:
NLS_LANG: ${NLS_LANG:-Japanese_Japan.UTF8}
APACHE_LOG_DIR: ${APACHE_LOG_DIR:-/tmp/apache2/log}
APACHE_PID_FILE: ${APACHE_PID_FILE:-/tmp/apache2/run/apache2.pid}
MT_HOME: /var/www/cgi-bin/mt
MT_CONFIG: ${MT_CONFIG_CGI_DEST_PATH:-/etc/mt/mt-config.cgi}
volumes:
- "..:/mt-dev"
- "${MT_HOME_PATH:-../../movabletype}:/var/www/cgi-bin/mt:${DOCKER_VOLUME_MOUNT_FLAG:-rw}"
- "${MT_CONFIG_CGI_SRC_PATH:-../mt-config.cgi-original}:${MT_CONFIG_CGI_DEST_PATH:-/var/www/cgi-bin/mt/mt-config.cgi}:${DOCKER_VOLUME_MOUNT_FLAG:-rw}"
- "${MT_CONFIG_CGI_SRC_PATH:-../mt-config.cgi-original}:${MT_CONFIG_CGI_DEST_PATH:-/etc/mt/mt-config.cgi}:${DOCKER_VOLUME_MOUNT_FLAG:-rw}"
- "${BASE_SITE_PATH:-site}:/var/www/html:${DOCKER_VOLUME_MOUNT_FLAG:-rw}"
- "support:/var/www/cgi-bin/mt/mt-static/support:${DOCKER_VOLUME_MOUNT_FLAG:-rw}"
# override entrypoint
- "./docker-entrypoint.sh:/usr/local/bin/docker-entrypoint.sh"
# proxy setting
- "./cgi-bin-mt.htaccess:/var/www/html/cgi-bin/mt/.htaccess"
- "./cgi-bin-mt.htaccess:/var/www/cgi-bin/mt/.htaccess"
ports:
- "${HTTPD_EXPOSE_PORT:-80}:80"
command: apache2-foreground
Expand Down
13 changes: 12 additions & 1 deletion mt/httpd/build-script/apache2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ Alias /mt-static/ /var/www/cgi-bin/mt/mt-static/
# Workaround to run amd64 image on arm64
Mutex posixsem
CONF
for d in /var/www/html/cgi-bin/mt /var/www/cgi-bin/mt; do
cat >> $httpd_conf_d/mt.conf <<CONF
<Directory $d>
Options +SymLinksIfOwnerMatch

RewriteEngine on
RewriteRule ^mt-static - [L]
RewriteRule (.*) http://mt/cgi-bin/mt/\$1 [P,L]
</Directory>
CONF
done

mod_rewrite_so=`find $module_dirs -name 'mod_rewrite.so' 2>/dev/null | head -1`
if [ -n "$mod_rewrite_so" ]; then
Expand Down Expand Up @@ -65,6 +76,6 @@ mod_env_so=`find $module_dirs -name 'mod_env.so' 2>/dev/null | head -1`
if [ -n "$mod_env_so" ]; then
cat > $httpd_conf_d/mt-env.conf <<CONF
LoadModule env_module $mod_env_so
PassEnv NLS_LANG
PassEnv NLS_LANG MT_CONFIG MT_HOME
CONF
fi
2 changes: 1 addition & 1 deletion mt/mt/build-script/apache2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ mod_env_so=`find $module_dirs -name 'mod_env.so' 2>/dev/null | head -1`
if [ -n "$mod_env_so" ]; then
cat > $httpd_conf_d/mt-env.conf <<CONF
LoadModule env_module $mod_env_so
PassEnv NLS_LANG
PassEnv NLS_LANG MT_CONFIG MT_HOME
CONF
fi