-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: autoupdating works now also added working example docker-compos…
…e.yml
- Loading branch information
Giesenberg, Jan
committed
Nov 25, 2021
1 parent
443c523
commit 9063197
Showing
12 changed files
with
228 additions
and
145 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Change these values to your liking | ||
# Timezone for the containers | ||
TZ = Europe/Berlin | ||
|
||
# The passwords must match | ||
MODX_DB_PASSWORD = "my-strong-random-mysql-password" | ||
MARIADB_PASSWORD = "my-strong-random-mysql-password" | ||
|
||
# These are the login details for the modx manager | ||
MODX_ADMIN_USER=my-username | ||
MODX_ADMIN_PASSWORD=my-password | ||
MODX_ADMIN_EMAIL=[email protected] | ||
|
||
# Do not change the values below unless you know what you are doing | ||
|
||
MODX_DB_HOST = "modx_mysql:3306" | ||
|
||
MODX_DB_USER = "modx" | ||
MARIADB_USER = modx | ||
|
||
|
||
MODX_DB_NAME = "modx" | ||
MARIADB_DATABASE = modx |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
localhost { | ||
root * /srv | ||
@rewritable { | ||
not file | ||
not path /assets/* /manager/* /connectors/* | ||
} | ||
rewrite @rewritable /index.php?{query}&q={path} | ||
rewrite /manager/ /manager/index.php | ||
@no_exec { | ||
not file | ||
not path /assets/* /setup/* | ||
} | ||
reverse_proxy @no_exec modx_php:9000 { | ||
transport fastcgi { | ||
root /modx/public | ||
split .php | ||
} | ||
} | ||
file_server | ||
} |
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 |
---|---|---|
@@ -1,2 +1,7 @@ | ||
# ModX Revolution Docker | ||
A docker setup that can autoupdate ModX Revolution. | ||
A docker setup that can autoupdate ModX Revolution. | ||
|
||
## Simplified Usage | ||
1. Copy the `.env.example` file to `.env` | ||
2. Run `docker-compose up` | ||
3. The Webserver will now listen on Ports `80` and `443` |
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 |
---|---|---|
|
@@ -15,37 +15,45 @@ FROM php:7-fpm-alpine | |
|
||
LABEL org.opencontainers.image.authors="Jan Giesenberg <[email protected]>" | ||
|
||
RUN mkdir -p /modx/core/config /modx/core/packages /modx/core/components /modx/public/assets | ||
|
||
VOLUME /modx/core/config | ||
VOLUME /modx/core/packages | ||
VOLUME /modx/core/components | ||
VOLUME /modx/public/assets | ||
|
||
EXPOSE 9000 | ||
|
||
WORKDIR /modx/public | ||
|
||
RUN apk add --no-cache freetype-dev libpng-dev jpeg-dev unzip sudo bash \ | ||
RUN apk add --no-cache rsync freetype-dev libpng-dev jpeg-dev unzip sudo bash gettext \ | ||
&& docker-php-ext-configure gd --with-freetype --with-jpeg \ | ||
&& docker-php-ext-install -j$(nproc) gd opcache mysqli pdo pdo_mysql | ||
&& docker-php-ext-install -j$(nproc) gd opcache mysqli pdo pdo_mysql \ | ||
&& rm -rf /usr/src/php/ | ||
|
||
ARG MODX_VERSION 2.8.2 | ||
ENV MODX_VERSION ${MODX_VERSION} | ||
|
||
# upstream tarballs include ./modx-${MODX_VERSION}/ | ||
RUN echo ${MODX_VERSION} \ | ||
RUN cd / \ | ||
&& echo ${MODX_VERSION} \ | ||
&& curl -o modx.zip -SL http://modx.com/download/direct/modx-${MODX_VERSION}-pl.zip \ | ||
&& unzip -q modx.zip -d /usr/src \ | ||
&& mv /usr/src/modx-${MODX_VERSION}-pl /usr/src/modx \ | ||
&& find /usr/src/modx -name 'ht.access' -exec bash -c 'rm $0' {} \; \ | ||
&& rm -rf /modx \ | ||
&& mkdir -p /modx /usr/src/modx \ | ||
&& mv /usr/src/modx-${MODX_VERSION}-pl/ /modx/public \ | ||
&& find /modx -name 'ht.access' -exec bash -c 'rm $0' {} \; \ | ||
&& mv /modx/public/core /modx/ \ | ||
&& cp -r /modx/public/setup /usr/src/modx \ | ||
&& rm modx.zip \ | ||
&& chown -R www-data:www-data /usr/src/modx \ | ||
&& chown -R www-data:www-data /modx | ||
|
||
COPY files/docker-entrypoint.sh /entrypoint.sh | ||
COPY --chown=www-data files/docker-entrypoint.sh /entrypoint.sh | ||
COPY --chown=www-data:www-data files/docker-entrypoint /docker-entrypoint | ||
COPY files/php-config/ /usr/local/etc/php/conf.d/ | ||
COPY files/config.core.php /modx/config.core.php.tmpl | ||
COPY --chown=www-data:www-data files/config.core.php /modx/config.core.php.tmpl | ||
|
||
RUN chmod +x /entrypoint.sh \ | ||
&& mkdir -p /modx/static/manager /modx/core/config /modx/core/packages /modx/core/components /modx/public/assets | ||
|
||
VOLUME /modx/static/manager | ||
VOLUME /modx/core/config | ||
VOLUME /modx/core/packages | ||
VOLUME /modx/core/components | ||
VOLUME /modx/public/assets | ||
|
||
|
||
WORKDIR /modx/public | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
CMD ["php-fpm"] |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
$currentInstallVersion = trim(file_get_contents('/modx/core/config/install_version.txt')); | ||
if($currentInstallVersion == '') { | ||
echo '/modx/core/config/install_version.txt does not contain a valid version number!'; | ||
} else if (version_compare($currentInstallVersion, $argv[1]) < 0) { | ||
echo '1'; | ||
} else { | ||
echo '0'; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
$stderr = fopen('php://stderr', 'w'); | ||
|
||
list($host, $port) = explode(':', $argv[1], 2); | ||
|
||
$maxTries = 10; | ||
do { | ||
$mysql = new mysqli($host, $argv[2], $argv[3], '', (int)$port); | ||
if ($mysql->connect_error) { | ||
fwrite($stderr, "\n" . 'MySQL Connection Error: (' . $mysql->connect_errno . ') ' . $mysql->connect_error . "\n"); | ||
--$maxTries; | ||
if ($maxTries <= 0) { | ||
exit(1); | ||
} | ||
sleep(3); | ||
} | ||
} while ($mysql->connect_error); | ||
|
||
if (!$mysql->query('CREATE DATABASE IF NOT EXISTS `' . $mysql->real_escape_string($argv[4]) . '` ' . | ||
'DEFAULT CHARACTER SET = \'utf8\' DEFAULT COLLATE \'utf8_general_ci\'')) { | ||
|
||
fwrite($stderr, "\n" . 'MySQL "CREATE DATABASE" Error: ' . $mysql->error . "\n"); | ||
$mysql->close(); | ||
exit(1); | ||
} | ||
|
||
$mysql->close(); |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<modx> | ||
<database_type>mysql</database_type> | ||
<database_server>$MODX_DB_HOST</database_server> | ||
<database>$MODX_DB_NAME</database> | ||
<database_user>$MODX_DB_USER</database_user> | ||
<database_password>$MODX_DB_PASSWORD</database_password> | ||
<database_connection_charset>utf8</database_connection_charset> | ||
<database_charset>utf8</database_charset> | ||
<database_collation>utf8_general_ci</database_collation> | ||
<table_prefix>$MODX_TABLE_PREFIX</table_prefix> | ||
<https_port>443</https_port> | ||
<http_host>localhost</http_host> | ||
<cache_disabled>0</cache_disabled> | ||
|
||
<inplace>1</inplace> | ||
<unpacked>0</unpacked> | ||
<language>en</language> | ||
|
||
<cmsadmin>$MODX_ADMIN_USER</cmsadmin> | ||
<cmspassword>$MODX_ADMIN_PASSWORD</cmspassword> | ||
<cmsadminemail>$MODX_ADMIN_EMAIL</cmsadminemail> | ||
|
||
<core_path>/modx/core/</core_path> | ||
<context_mgr_path>/modx/public/manager/</context_mgr_path> | ||
<context_mgr_url>/manager/</context_mgr_url> | ||
<context_connectors_path>/modx/public/connectors/</context_connectors_path> | ||
<context_connectors_url>/connectors/</context_connectors_url> | ||
<context_web_path>/modx/public/</context_web_path> | ||
<context_web_url>/</context_web_url> | ||
|
||
<remove_setup_directory>1</remove_setup_directory> | ||
</modx> |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<modx> | ||
<inplace>1</inplace> | ||
<unpacked>0</unpacked> | ||
<language>en</language> | ||
<remove_setup_directory>1</remove_setup_directory> | ||
</modx> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.