THE HUGE REFACTORING CALENDER WEEK 33; Optimized Matrix and during this updated variables, and implemented better reset and cleanup mode handling, also solved some initial setup bugs

This commit is contained in:
2025-08-15 15:15:48 +02:00
parent 0228014d34
commit 022800425d
271 changed files with 1098 additions and 916 deletions

View File

@@ -1,4 +1,7 @@
docker:
services:
openresty:
name: "openresty"
name: "openresty"
volumes:
www: "/var/www/"
nginx: "/etc/nginx/"

View File

@@ -9,7 +9,7 @@ This document provides commands and tips to validate and inspect the OpenResty (
* **Quick syntax check (quiet):**
```bash
docker exec {{ openresty_container }} openresty -t -q
docker exec {{ OPENRESTY_CONTAINER }} openresty -t -q
```
*Returns only errors.*
@@ -17,13 +17,13 @@ This document provides commands and tips to validate and inspect the OpenResty (
* **Detailed syntax check (show warnings):**
```bash
docker exec {{ openresty_container }} openresty -t
docker exec {{ OPENRESTY_CONTAINER }} openresty -t
```
or:
```bash
docker exec {{ openresty_container }} nginx -t
docker exec {{ OPENRESTY_CONTAINER }} nginx -t
```
---
@@ -34,9 +34,9 @@ To see the full configuration after all `include` directives are processed:
```bash
# Within the running container
docker exec {{ openresty_container }} openresty -T
docker exec {{ OPENRESTY_CONTAINER }} openresty -T
# or equivalently
docker exec {{ openresty_container }} nginx -T
docker exec {{ OPENRESTY_CONTAINER }} nginx -T
```
This outputs every directive from `nginx.conf` and all files in `conf.d` in the order Nginx will use them.
@@ -103,5 +103,5 @@ That way youll see exactly which domains your server is serving and which nam
* After fixing issues, reload without downtime:
```bash
docker exec {{ openresty_container }} openresty -s reload
docker exec {{ OPENRESTY_CONTAINER }} openresty -s reload
```

View File

@@ -1,12 +1,15 @@
---
- name: Validate OpenResty configuration
command: >
docker exec {{ openresty_container }} openresty -t -q
docker exec {{ OPENRESTY_CONTAINER }} openresty -t -q
register: openresty_test
changed_when: false
failed_when: openresty_test.rc != 0
failed_when: >
openresty_test.rc != 0 and
('is not running' not in ((openresty_test.stderr | default('')) | lower)) and
('no such container' not in ((openresty_test.stderr | default('')) | lower))
listen: restart openresty
- name: Restart OpenResty container
command: docker restart {{ openresty_container }}
command: docker restart {{ OPENRESTY_CONTAINER }}
listen: restart openresty

View File

@@ -1,15 +1,15 @@
{% include 'roles/docker-compose/templates/base.yml.j2' %}
openresty:
container_name: {{ openresty_container }}
image: {{ openresty_image }}:{{ openresty_version }}
container_name: {{ OPENRESTY_CONTAINER }}
image: {{ OPENRESTY_IMAGE }}:{{ OPENRESTY_VERSION }}
network_mode: "host"
volumes:
- {{ nginx.files.configuration }}:/usr/local/openresty/nginx/conf/nginx.conf:ro
- {{ nginx.directories.configuration }}:/usr/local/openresty/nginx/conf/conf.d:ro
- {{ nginx.files.configuration }}:{{ nginx.files.configuration }}:ro
- {{ nginx.directories.configuration }}:{{ nginx.directories.configuration }}:ro
- {{ nginx.directories.data.www }}:{{ nginx.directories.data.www }}:ro
- {{ nginx.directories.data.well_known }}:{{ nginx.directories.data.well_known }}:ro
- {{ NGINX.FILES.CONFIGURATION }}:/usr/local/openresty/nginx/conf/nginx.conf:ro
- {{ NGINX.DIRECTORIES.CONFIGURATION }}:/usr/local/openresty/nginx/conf/conf.d:ro
- {{ NGINX.FILES.CONFIGURATION }}:{{ NGINX.FILES.CONFIGURATION }}:ro
- {{ NGINX.DIRECTORIES.CONFIGURATION }}:{{ NGINX.DIRECTORIES.CONFIGURATION }}:ro
- {{ NGINX.DIRECTORIES.DATA.WWW }}:{{ NGINX.DIRECTORIES.DATA.WWW }}:ro
- {{ NGINX.DIRECTORIES.DATA.WELL_KNOWN }}:{{ NGINX.DIRECTORIES.DATA.WELL_KNOWN }}:ro
- {{ LETSENCRYPT_WEBROOT_PATH }}:{{ LETSENCRYPT_WEBROOT_PATH }}:ro
- {{ LETSENCRYPT_BASE_PATH }}:{{ LETSENCRYPT_BASE_PATH }}:ro
command: ["openresty", "-g", "daemon off;"]

View File

@@ -5,6 +5,7 @@ application_id: "svc-prx-openresty"
database_type: ""
# Openresty
openresty_image: "openresty/openresty"
openresty_version: "alpine"
openresty_container: "{{ applications | get_app_conf(application_id, 'docker.services.openresty.name', True) }}"
OPENRESTY_IMAGE: "openresty/openresty"
OPENRESTY_VERSION: "alpine"
OPENRESTY_CONTAINER: "{{ applications | get_app_conf(application_id, 'docker.services.openresty.name', True) }}"