forked from coop-cloud/wordpress
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e748cae5c7 | ||
|
|
c93d95696b
|
||
|
|
effd0531c2
|
||
|
|
fadb247d47 | ||
|
|
3efe1104d1 | ||
|
|
17f9f2fae5 | ||
|
|
10f45bbfa3 | ||
|
|
a4792eab37 | ||
|
|
adcd0e9ff1 | ||
|
|
17b2cbb3bd | ||
|
|
652fcf0383 | ||
|
|
5d891c88c7 | ||
|
|
a2bf10a442 | ||
|
|
b64ab47051 | ||
|
|
96612a988a | ||
|
|
3a4c8f9f22
|
||
|
|
d8bdf8588f | ||
|
|
36591c4d20 | ||
|
|
f59fef5502 | ||
|
|
6f23a5dfae | ||
|
|
6d1b370cde | ||
|
|
c5fb2ebaf3 | ||
|
|
a34d7af280 | ||
|
|
12d1e4e371 | ||
|
|
8407a00942 | ||
|
|
90d34543db | ||
|
|
47fbba1505 | ||
|
|
32062bff94 | ||
|
|
c7f500c428 | ||
|
|
15dd324102 |
+1
-1
@@ -4,7 +4,7 @@ name: test
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: test
|
- name: test
|
||||||
image: alpine:3.21
|
image: alpine:3.24
|
||||||
environment:
|
environment:
|
||||||
SHELLCHECK_OPTS: -s bash
|
SHELLCHECK_OPTS: -s bash
|
||||||
commands:
|
commands:
|
||||||
|
|||||||
@@ -13,52 +13,18 @@ Coöp Cloud + [Wordpress](https://wordpress.org) = 🥳
|
|||||||
* **Backups**: Yes
|
* **Backups**: Yes
|
||||||
* **Email**: 3
|
* **Email**: 3
|
||||||
* **Tests**: 2
|
* **Tests**: 2
|
||||||
* **SSO**: No
|
* **SSO**: 2
|
||||||
|
|
||||||
<!-- endmetadata -->
|
<!-- endmetadata -->
|
||||||
|
|
||||||
|
|
||||||
## Quick start
|
## Quick start
|
||||||
|
|
||||||
|
|
||||||
* `abra app new wordpress`
|
* `abra app new wordpress`
|
||||||
* `abra app config <app-name>`
|
* `abra app config <app-name>`
|
||||||
* `abra app secret generate -a <app-name>`
|
* `abra app secret generate -a <app-name>`
|
||||||
* `abra app deploy <app-name>`
|
* `abra app deploy <app-name>`
|
||||||
* `abra app cmd <app-name> app core_install`
|
* `abra app cmd <app-name> app core_install`
|
||||||
|
|
||||||
### Authentik Integration
|
|
||||||
|
|
||||||
|
|
||||||
`abra app config <app-name>`
|
|
||||||
Configure the following envs:
|
|
||||||
```
|
|
||||||
COMPOSE_FILE="$COMPOSE_FILE:compose.authentik.yml"
|
|
||||||
AUTHENTIK_DOMAIN=authentik.example.com
|
|
||||||
AUTHENTIK_SECRET_NAME=authentik_example_com_wordpress_secret_v1 # the same as in authentik
|
|
||||||
AUTHENTIK_ID_NAME=authentik_example_com_wordpress_id_v1 # the same as in authentik
|
|
||||||
```
|
|
||||||
|
|
||||||
`abra app cmd <app-name> app set_authentik`
|
|
||||||
|
|
||||||
## Running WP-CLI
|
|
||||||
|
|
||||||
`abra app cmd <app-name> app wp -- core check-update --major`
|
|
||||||
|
|
||||||
## Network (Multi-site)
|
|
||||||
|
|
||||||
1. Set up as above
|
|
||||||
2. `abra app config <app-name>`, and uncomment `#MULTISITE=enable`
|
|
||||||
3. `abra app deploy <app-name>`
|
|
||||||
4. Log into the Wordpress admin dashboard, go to Tools » Network Setup
|
|
||||||
5. Don't worry about the suggested file changes
|
|
||||||
6. `abra app config <app-name>` again and set `MULTISITE` to either `subdomain` or `subfolder` depending on your setup.
|
|
||||||
7. `abra app deploy <app-name>`
|
|
||||||
|
|
||||||
## Installing a custom theme
|
|
||||||
|
|
||||||
`abra app cp <app-name> ~/path/to/local/theme wordpress:/var/www/html/wp-content/themes/`
|
|
||||||
|
|
||||||
## Email
|
## Email
|
||||||
|
|
||||||
There is a local or remote SMTP relay configuration available.
|
There is a local or remote SMTP relay configuration available.
|
||||||
@@ -74,9 +40,46 @@ Below are the instructions for the local relay.
|
|||||||
`$DOMAIN` or in its `$EXTRA_SENDER_DOMAINS`
|
`$DOMAIN` or in its `$EXTRA_SENDER_DOMAINS`
|
||||||
3. `abra app deploy <app-name>`
|
3. `abra app deploy <app-name>`
|
||||||
|
|
||||||
|
## WP-CLI
|
||||||
|
|
||||||
|
You can either run using `abra app cmd`:
|
||||||
|
```bash
|
||||||
|
abra app cmd <app-name> app wp -- core check-update --major
|
||||||
|
```
|
||||||
|
|
||||||
|
Or by entering the app shell:
|
||||||
|
1. `abra app run <app-name> app bash`
|
||||||
|
2. `su -s /bin/bash www-data -c "wp core check-update --major"`
|
||||||
|
|
||||||
|
## Network (Multi-site)
|
||||||
|
|
||||||
|
1. Set up as above
|
||||||
|
2. `abra app config <app-name>`, and uncomment `#MULTISITE=enable`
|
||||||
|
3. `abra app deploy <app-name>`
|
||||||
|
4. Log into the WordPress admin dashboard, go to **Tools → Network Setup**
|
||||||
|
5. Don't worry about the suggested file changes
|
||||||
|
6. `abra app config <app-name>` again and set `MULTISITE` to either `subdomain` or `subfolder` depending on your setup.
|
||||||
|
7. `abra app deploy <app-name>`
|
||||||
|
|
||||||
|
## Installing a custom theme
|
||||||
|
|
||||||
|
`abra app cp <app-name> ~/path/to/local/theme wordpress:/var/www/html/wp-content/themes/`
|
||||||
|
|
||||||
|
## Authentik Integration
|
||||||
|
|
||||||
|
Configure the following envs via `abra app config <app-name>`:
|
||||||
|
```bash
|
||||||
|
COMPOSE_FILE="$COMPOSE_FILE:compose.authentik.yml"
|
||||||
|
AUTHENTIK_DOMAIN=authentik.example.com
|
||||||
|
AUTHENTIK_SECRET_NAME=authentik_example_com_wordpress_secret_v1 # the same as in authentik
|
||||||
|
AUTHENTIK_ID_NAME=authentik_example_com_wordpress_id_v1 # the same as in authentik
|
||||||
|
```
|
||||||
|
|
||||||
|
`abra app cmd <app-name> app set_authentik`
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
Run the full test suite:
|
Run the full test suite for this repository:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
bash tests/run.sh
|
bash tests/run.sh
|
||||||
@@ -91,17 +94,12 @@ brew install shellcheck gomplate
|
|||||||
```
|
```
|
||||||
Some tests skip gracefully if their dependencies are missing.
|
Some tests skip gracefully if their dependencies are missing.
|
||||||
|
|
||||||
[abra]: https://git.autonomic.zone/autonomic-cooperative/abra
|
## Migrate from a non-Co-op Cloud WordPress install
|
||||||
|
|
||||||
## Migrate from a non-Co-op Cloud Wordpress install
|
Make a `.tar.gz` backup of the site's `wp-content` dir and a `.sql.gz` backup of the database.
|
||||||
|
|
||||||
Make a .tar.gz backup of the site's wp-content dir and an .sql.gz backup of the database.
|
|
||||||
|
|
||||||
1. `abra app wp.example.com restore app wp-content.tar.gz`
|
1. `abra app wp.example.com restore app wp-content.tar.gz`
|
||||||
2. `abra app wp.example.com restore db wordpress.sql.gz`
|
2. `abra app wp.example.com restore db wordpress.sql.gz`
|
||||||
|
|
||||||
Lastly, if there's a domain name change, run a search and replace:
|
Lastly, if there's a domain name change, run a search and replace:
|
||||||
`abra app wp.example.com wp "search-replace https://old.example.com https://wp.example.com"`
|
`abra app wp.example.com wp "search-replace https://old.example.com https://wp.example.com"`
|
||||||
|
|
||||||
[cc-traefik]: https://git.autonomic.zone/coop-cloud/traefik
|
|
||||||
[cc-postfix-relay]: https://git.autonomic.zone/coop-cloud/traefik
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
export PHP_UPLOADS_CONF_VERSION=v4
|
export PHP_UPLOADS_CONF_VERSION=v4
|
||||||
export ENTRYPOINT_CONF_VERSION=v9
|
export ENTRYPOINT_CONF_VERSION=v10
|
||||||
export ENTRYPOINT_MAILRELAY_CONF_VERSION=v2
|
export ENTRYPOINT_MAILRELAY_CONF_VERSION=v2
|
||||||
export MSMTP_CONF_VERSION=v4
|
export MSMTP_CONF_VERSION=v4
|
||||||
export HTACCESS_CONF_VERSION=v3
|
export HTACCESS_CONF_VERSION=v3
|
||||||
export USERS_CONF_VERSION=v1
|
export USERS_CONF_VERSION=v1
|
||||||
|
|
||||||
wp() {
|
wp() {
|
||||||
su -p www-data -s /bin/bash -c "/usr/local/bin/wp $@"
|
su -p www-data -s /bin/bash -c "/usr/local/bin/wp $*"
|
||||||
}
|
}
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ version: "3.8"
|
|||||||
services:
|
services:
|
||||||
ftp:
|
ftp:
|
||||||
ports:
|
ports:
|
||||||
- 2220:22
|
- 2220:22
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ version: "3.8"
|
|||||||
services:
|
services:
|
||||||
ftp:
|
ftp:
|
||||||
ports:
|
ports:
|
||||||
- 2221:22
|
- 2221:22
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ version: "3.8"
|
|||||||
services:
|
services:
|
||||||
ftp:
|
ftp:
|
||||||
ports:
|
ports:
|
||||||
- 2222:22
|
- 2222:22
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ version: "3.8"
|
|||||||
services:
|
services:
|
||||||
ftp:
|
ftp:
|
||||||
ports:
|
ports:
|
||||||
- 2223:22
|
- 2223:22
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ version: "3.8"
|
|||||||
services:
|
services:
|
||||||
ftp:
|
ftp:
|
||||||
ports:
|
ports:
|
||||||
- 2224:22
|
- 2224:22
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ version: "3.8"
|
|||||||
services:
|
services:
|
||||||
ftp:
|
ftp:
|
||||||
ports:
|
ports:
|
||||||
- 2220:22
|
- 2220:22
|
||||||
|
|||||||
+1
-1
@@ -7,4 +7,4 @@ services:
|
|||||||
labels:
|
labels:
|
||||||
- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect-matrix-well-known"
|
- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect-matrix-well-known"
|
||||||
- "traefik.http.middlewares.${STACK_NAME}-redirect-matrix-well-known.redirectregex.regex=^https://(.*)/.well-known/matrix/(.*)"
|
- "traefik.http.middlewares.${STACK_NAME}-redirect-matrix-well-known.redirectregex.regex=^https://(.*)/.well-known/matrix/(.*)"
|
||||||
- "traefik.http.middlewares.${STACK_NAME}-redirect-matrix-well-known.redirectregex.replacement=https://${MATRIX_DOMAIN}/.well-known/matrix/$$2"
|
- "traefik.http.middlewares.${STACK_NAME}-redirect-matrix-well-known.redirectregex.replacement=https://${MATRIX_DOMAIN}/.well-known/matrix/$$2"
|
||||||
@@ -3,7 +3,6 @@ version: "3.8"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: "wordpress:7.0.0"
|
|
||||||
volumes:
|
volumes:
|
||||||
- "wordpress:/var/www/html/"
|
- "wordpress:/var/www/html/"
|
||||||
environment:
|
environment:
|
||||||
@@ -13,9 +12,9 @@ services:
|
|||||||
define( 'FS_METHOD', 'direct' );
|
define( 'FS_METHOD', 'direct' );
|
||||||
${WORDPRESS_CONFIG_EXTRA}
|
${WORDPRESS_CONFIG_EXTRA}
|
||||||
|
|
||||||
ftp:
|
#ftp:
|
||||||
volumes:
|
# volumes:
|
||||||
- "wordpress:/home/ftp_user/"
|
# - "wordpress:/home/ftp_user/"
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
wordpress:
|
wordpress:
|
||||||
|
|||||||
+2
-2
@@ -3,7 +3,7 @@ version: "3.8"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: "wordpress:7.0.0"
|
image: "wordpress:7.0.4"
|
||||||
volumes:
|
volumes:
|
||||||
- "wordpress_content:/var/www/html/wp-content/"
|
- "wordpress_content:/var/www/html/wp-content/"
|
||||||
networks:
|
networks:
|
||||||
@@ -62,7 +62,7 @@ services:
|
|||||||
- "traefik.http.middlewares.${STACK_NAME}-redirect.redirectregex.replacement=https://${DOMAIN}/$${2}"
|
- "traefik.http.middlewares.${STACK_NAME}-redirect.redirectregex.replacement=https://${DOMAIN}/$${2}"
|
||||||
- "traefik.http.middlewares.${STACK_NAME}-redirect.redirectregex.permanent=true"
|
- "traefik.http.middlewares.${STACK_NAME}-redirect.redirectregex.permanent=true"
|
||||||
- "coop-cloud.${STACK_NAME}.timeout=${TIMEOUT}"
|
- "coop-cloud.${STACK_NAME}.timeout=${TIMEOUT}"
|
||||||
- "coop-cloud.${STACK_NAME}.version=3.0.0+7.0.0"
|
- "coop-cloud.${STACK_NAME}.version=3.0.6+7.0.4"
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: "mariadb:12.3"
|
image: "mariadb:12.3"
|
||||||
|
|||||||
+7
-7
@@ -1,13 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
{{ if (getenv "PHP_EXTENSIONS") }}
|
{{ if (env "PHP_EXTENSIONS") }}
|
||||||
docker-php-ext-install {{ getenv "PHP_EXTENSIONS" }}
|
docker-php-ext-install {{ env "PHP_EXTENSIONS" }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
curl -z /usr/local/bin/wp -o /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
curl -z /usr/local/bin/wp -o /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
||||||
chmod +x /usr/local/bin/wp
|
chmod +x /usr/local/bin/wp
|
||||||
|
|
||||||
{{ if eq (getenv "ENABLE_COMPOSER") "1" }}
|
{{ if eq (env "ENABLE_COMPOSER") "1" }}
|
||||||
mkdir -p /var/www/.composer
|
mkdir -p /var/www/.composer
|
||||||
chown www-data:www-data /var/www/.composer /var/www/html/composer
|
chown www-data:www-data /var/www/.composer /var/www/html/composer
|
||||||
|
|
||||||
@@ -19,18 +19,18 @@ rm /tmp/composer-setup.php
|
|||||||
mv /var/www/html/composer.phar /usr/local/bin/composer
|
mv /var/www/html/composer.phar /usr/local/bin/composer
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if eq (getenv "CORS_ALLOW_ALL") "1" }}
|
{{ if eq (env "CORS_ALLOW_ALL") "1" }}
|
||||||
a2enmod headers
|
a2enmod headers
|
||||||
sed -ri -e 's/^([ \t]*)(<\/VirtualHost>)/\1\tHeader set Access-Control-Allow-Origin "*"\n\1\2/g' /etc/apache2/sites-available/*.conf
|
sed -ri -e 's/^([ \t]*)(<\/VirtualHost>)/\1\tHeader set Access-Control-Allow-Origin "*"\n\1\2/g' /etc/apache2/sites-available/*.conf
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if eq (getenv "MULTISITE") "enable" }}
|
{{ if eq (env "MULTISITE") "enable" }}
|
||||||
export WORDPRESS_CONFIG_EXTRA="$WORDPRESS_CONFIG_EXTRA
|
export WORDPRESS_CONFIG_EXTRA="$WORDPRESS_CONFIG_EXTRA
|
||||||
define('WP_CACHE', false);
|
define('WP_CACHE', false);
|
||||||
define('WP_ALLOW_MULTISITE', true );"
|
define('WP_ALLOW_MULTISITE', true );"
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if or (eq (getenv "MULTISITE") "subdomain") (eq (getenv "MULTISITE") "subfolder") }}
|
{{ if or (eq (env "MULTISITE") "subdomain") (eq (env "MULTISITE") "subfolder") }}
|
||||||
export WORDPRESS_CONFIG_EXTRA="$WORDPRESS_CONFIG_EXTRA
|
export WORDPRESS_CONFIG_EXTRA="$WORDPRESS_CONFIG_EXTRA
|
||||||
define('MULTISITE', true);
|
define('MULTISITE', true);
|
||||||
define('SUBDOMAIN_INSTALL', true);
|
define('SUBDOMAIN_INSTALL', true);
|
||||||
@@ -56,7 +56,7 @@ fi
|
|||||||
|
|
||||||
chown -R --from=root:root www-data:www-data /var/www/html/wp-content/
|
chown -R --from=root:root www-data:www-data /var/www/html/wp-content/
|
||||||
|
|
||||||
if [ $# -gt 0 ]; then
|
if [ -n "$@" ]; then
|
||||||
"$@"
|
"$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -3,7 +3,7 @@
|
|||||||
Require all denied
|
Require all denied
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
|
|
||||||
{{ if eq (getenv "MULTISITE") "" -}}
|
{{ if eq (env "MULTISITE") "" -}}
|
||||||
# BEGIN WordPress
|
# BEGIN WordPress
|
||||||
|
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
@@ -17,7 +17,7 @@ RewriteRule . /index.php [L]
|
|||||||
# END WordPress
|
# END WordPress
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- if eq (getenv "MULTISITE") "subfolder" -}}
|
{{- if eq (env "MULTISITE") "subfolder" -}}
|
||||||
# BEGIN WordPress Multisite
|
# BEGIN WordPress Multisite
|
||||||
# Using subfolder network type: https://wordpress.org/documentation/article/htaccess/#multisite
|
# Using subfolder network type: https://wordpress.org/documentation/article/htaccess/#multisite
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ RewriteRule . index.php [L]
|
|||||||
# END WordPress Multisite
|
# END WordPress Multisite
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- if eq (getenv "MULTISITE") "subdomain" -}}
|
{{- if eq (env "MULTISITE") "subdomain" -}}
|
||||||
# BEGIN WordPress Multisite
|
# BEGIN WordPress Multisite
|
||||||
# Using subdomain network type: https://wordpress.org/documentation/article/htaccess/#multisite
|
# Using subdomain network type: https://wordpress.org/documentation/article/htaccess/#multisite
|
||||||
|
|
||||||
|
|||||||
+9
-9
@@ -1,19 +1,19 @@
|
|||||||
account default
|
account default
|
||||||
host {{ getenv "SMTP_HOST" }}
|
host {{ env "SMTP_HOST" }}
|
||||||
from {{ getenv "MAIL_FROM" }}
|
from {{ env "MAIL_FROM" }}
|
||||||
user {{ or (getenv "SMTP_USER") (getenv "MAIL_FROM") }}
|
user {{ or (env "SMTP_USER") (env "MAIL_FROM") }}
|
||||||
port {{ getenv "SMTP_PORT" }}
|
port {{ env "SMTP_PORT" }}
|
||||||
|
|
||||||
{{ if eq (getenv "SMTP_OVERRIDE_FROM") "on" }}
|
{{ if eq (env "SMTP_OVERRIDE_FROM") "on" }}
|
||||||
set_from_header on
|
set_from_header on
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if eq (getenv "SMTP_AUTH") "on" }}
|
{{ if eq (env "SMTP_AUTH") "on" }}
|
||||||
auth {{ getenv "SMTP_AUTH" }}
|
auth {{ env "SMTP_AUTH" }}
|
||||||
passwordeval "cat /run/secrets/smtp_password"
|
passwordeval "cat /run/secrets/smtp_password"
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if eq (getenv "SMTP_TLS") "on" }}
|
{{ if eq (env "SMTP_TLS") "on" }}
|
||||||
tls {{ getenv "SMTP_TLS" }}
|
tls {{ env "SMTP_TLS" }}
|
||||||
tls_trust_file /etc/ssl/certs/ca-certificates.crt
|
tls_trust_file /etc/ssl/certs/ca-certificates.crt
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Bumps Wordpress version to 7.0.2 which fixes CVE-2026-63030
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Fixes last release which is broken.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
fix broken conf version in recipe.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Includes security fix
|
||||||
+1
-1
@@ -19,7 +19,7 @@ done < <(find "$ROOT/.." -maxdepth 1 -name 'compose*.yml' | sort)
|
|||||||
SHELL_TMPL_FILES=()
|
SHELL_TMPL_FILES=()
|
||||||
while IFS= read -r f; do
|
while IFS= read -r f; do
|
||||||
SHELL_TMPL_FILES+=("$f")
|
SHELL_TMPL_FILES+=("$f")
|
||||||
done < <(find "$ROOT/.." -maxdepth 1 -name '*.sh.tmpl' | sort)
|
done < <(find "$ROOT/.." -maxdepth 1 -name '*.tmpl' | sort)
|
||||||
|
|
||||||
# Track total failures across all test suites
|
# Track total failures across all test suites
|
||||||
failures=0
|
failures=0
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ fi
|
|||||||
|
|
||||||
# Validate a compose file against the Docker Compose specification
|
# Validate a compose file against the Docker Compose specification
|
||||||
test_compose_config() {
|
test_compose_config() {
|
||||||
local file=$1 main=${2:-}
|
local file=$1
|
||||||
|
|
||||||
# Skip if Docker Compose is not available on this system
|
# Skip if Docker Compose is not available on this system
|
||||||
if [ -z "$compose_cmd" ]; then
|
if [ -z "$compose_cmd" ]; then
|
||||||
@@ -23,27 +23,13 @@ test_compose_config() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Main compose file is validated standalone
|
# config -q exits with non-zero if the compose file is invalid
|
||||||
if [ -z "$main" ]; then
|
if $compose_cmd -f "$file" config -q 2>/dev/null; then
|
||||||
if $compose_cmd -f "$file" config -q 2>/dev/null; then
|
|
||||||
echo " PASS $file"
|
|
||||||
pass=$((pass + 1))
|
|
||||||
else
|
|
||||||
echo " FAIL $file"
|
|
||||||
fail=$((fail + 1))
|
|
||||||
fi
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Override files are validated combined with the main compose file.
|
|
||||||
# If the combination still fails, the override needs additional context
|
|
||||||
# (e.g. other override files) and is skipped rather than failed.
|
|
||||||
if $compose_cmd -f "$main" -f "$file" config -q 2>/dev/null; then
|
|
||||||
echo " PASS $file"
|
echo " PASS $file"
|
||||||
pass=$((pass + 1))
|
pass=$((pass + 1))
|
||||||
else
|
else
|
||||||
echo " SKIP $file (partial override, needs additional context)"
|
echo " FAIL $file"
|
||||||
pass=$((pass + 1))
|
fail=$((fail + 1))
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +41,7 @@ test_compose_config "$ROOT/compose.yml"
|
|||||||
while IFS= read -r f; do
|
while IFS= read -r f; do
|
||||||
# Skip the main compose file (already tested above)
|
# Skip the main compose file (already tested above)
|
||||||
[ "$f" = "$ROOT/compose.yml" ] && continue
|
[ "$f" = "$ROOT/compose.yml" ] && continue
|
||||||
[ -f "$f" ] && test_compose_config "$f" "$ROOT/compose.yml"
|
[ -f "$f" ] && test_compose_config "$f"
|
||||||
done < <(find "$ROOT" -maxdepth 1 -name 'compose*.yml' | sort)
|
done < <(find "$ROOT" -maxdepth 1 -name 'compose*.yml' | sort)
|
||||||
|
|
||||||
echo "---"
|
echo "---"
|
||||||
|
|||||||
@@ -4,15 +4,6 @@ set -euo pipefail
|
|||||||
pass=0
|
pass=0
|
||||||
fail=0
|
fail=0
|
||||||
|
|
||||||
# Skip if shellcheck is not installed
|
|
||||||
if ! command -v shellcheck &>/dev/null; then
|
|
||||||
echo "=== ShellCheck ==="
|
|
||||||
echo " SKIP shellcheck not found"
|
|
||||||
echo "---"
|
|
||||||
echo "Passed: 0 Failed: 0"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Allow overriding shellcheck options via env var (e.g. -s bash)
|
# Allow overriding shellcheck options via env var (e.g. -s bash)
|
||||||
EXTRA_SHELLCHECK_OPTS="${SHELLCHECK_OPTS:-}"
|
EXTRA_SHELLCHECK_OPTS="${SHELLCHECK_OPTS:-}"
|
||||||
|
|
||||||
|
|||||||
+14
-7
@@ -11,20 +11,27 @@ gomplate="${GOMPLATE_BIN:-gomplate}"
|
|||||||
# Ensure gomplate is installed before running template tests
|
# Ensure gomplate is installed before running template tests
|
||||||
require_gomplate() {
|
require_gomplate() {
|
||||||
if ! command -v "$gomplate" &>/dev/null; then
|
if ! command -v "$gomplate" &>/dev/null; then
|
||||||
echo " SKIP gomplate not found (install from https://github.com/hairyhenderson/gomplate or set GOMPLATE_BIN)"
|
echo "gomplate not found. Install it from https://github.com/hairyhenderson/gomplate"
|
||||||
exit 0
|
echo "or set GOMPLATE_BIN env var."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
local tmpl=$1 envfile=$2
|
||||||
|
"$gomplate" \
|
||||||
|
--template t="$tmpl" \
|
||||||
|
--context "_=fmt:%s" \
|
||||||
|
--datasource "env=env://?$envfile" \
|
||||||
|
-f "$tmpl" 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
# Render a template by exporting env vars directly
|
# Render a template by exporting env vars directly
|
||||||
# This avoids gomplate datasource quirks with .env files
|
# This avoids gomplate datasource quirks with .env files
|
||||||
render_via_env() {
|
render_via_env() {
|
||||||
local tmpl=$1 envfile=$2
|
local tmpl=$1 envfile=$2
|
||||||
set -a
|
# shellcheck disable=2046
|
||||||
# shellcheck disable=1090,1091
|
env $(xargs < "$envfile") "$gomplate" -f "$tmpl" 2>/dev/null
|
||||||
. "$envfile"
|
|
||||||
set +a
|
|
||||||
"$gomplate" -f "$tmpl" 2>/dev/null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|||||||
+5
-5
@@ -1,10 +1,10 @@
|
|||||||
{{- $upload_max_size := "256M" -}}
|
{{ $upload_max_size := "256M" }}
|
||||||
{{- if ne (getenv "UPLOAD_MAX_SIZE") "" }}{{ $upload_max_size = getenv "UPLOAD_MAX_SIZE" }}{{ end -}}
|
{{ if ne (env "UPLOAD_MAX_SIZE") "" }} {{ $upload_max_size = env "UPLOAD_MAX_SIZE" }} {{ end }}
|
||||||
{{- $upload_max_time := "30" -}}
|
{{ $upload_max_time := "30" }}
|
||||||
{{- if ne (getenv "UPLOAD_MAX_TIME") "" }}{{ $upload_max_time = getenv "UPLOAD_MAX_TIME" }}{{ end -}}
|
{{ if ne (env "UPLOAD_MAX_TIME") "" }} {{ $upload_max_time = env "UPLOAD_MAX_TIME" }} {{ end }}
|
||||||
|
|
||||||
file_uploads = On
|
file_uploads = On
|
||||||
upload_max_filesize = {{ $upload_max_size }}
|
upload_max_filesize = {{ $upload_max_size }}
|
||||||
post_max_size = {{ $upload_max_size }}
|
post_max_size = {{ $upload_max_size }}
|
||||||
memory_limit = {{ $upload_max_size }}
|
memory_limit = {{ $upload_max_size }}
|
||||||
max_execution_time = {{ $upload_max_time }}
|
max_execution_time = {{ $upload_max_time }}
|
||||||
|
|||||||
Reference in New Issue
Block a user