mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-30 23:38:13 +02:00
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:
@@ -1,4 +1,7 @@
|
||||
docker:
|
||||
services:
|
||||
openresty:
|
||||
name: "openresty"
|
||||
name: "openresty"
|
||||
volumes:
|
||||
www: "/var/www/"
|
||||
nginx: "/etc/nginx/"
|
@@ -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 you’ll 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
|
||||
```
|
@@ -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
|
||||
|
@@ -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;"]
|
@@ -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) }}"
|
||||
|
||||
|
Reference in New Issue
Block a user