Add tests for nginx.conf directives #1

Merged
ccm merged 26 commits from ccm-test-nginx-directives into trunk 2025-06-14 21:54:22 +00:00
3 changed files with 37 additions and 14 deletions
Showing only changes of commit ab20e4ad36 - Show all commits

View File

@ -1,9 +1,14 @@
image = miti.sh
run:
docker run --rm -it --init -v $(PWD):/opt/app -p 8080:8080 \
sitegen-openresty
--add-host=miti.sh=127.0.0.1 $(image)
build:
docker run --rm -w /opt/app -v $(PWD):/opt/app sitegen-openresty sitegen
docker run --rm -w /opt/app -v $(PWD):/opt/app $(image) sitegen
lint:
docker run --rm -w /opt/app -v $(PWD):/opt/app sitegen-openresty moonc -l .
docker run --rm -w /opt/app -v $(PWD):/opt/app $(image) moonc -l .
test:
./test.sh

View File

@ -7,15 +7,16 @@ events {
http {
server {
listen 80;
listen 443 ssl;
# listen 80;
listen 8080;
# listen 443 ssl;
include mime.types;
charset utf-8;
default_type text/html;
ssl_certificate /var/www/certs/miti.sh/fullchain.pem;
ssl_certificate_key /var/www/certs/miti.sh/privkey.pem;
# ssl_certificate /var/www/certs/miti.sh/fullchain.pem;
# ssl_certificate_key /var/www/certs/miti.sh/privkey.pem;
location ^~ /.well-known/acme-challenge {
alias /var/www/dehydrated;
@ -40,7 +41,7 @@ http {
}
server {
listen 443 ssl;
# listen 443 ssl;
server_name git.miti.sh;
location ^~ /.well-known/acme-challenge {
@ -60,7 +61,7 @@ http {
}
server {
listen 443 ssl;
# listen 443 ssl;
server_name apps.miti.sh;
root /var/www/sites/apps.miti.sh;
@ -75,15 +76,15 @@ http {
}
server {
listen 443 ssl;
# listen 443 ssl;
server_name webdevcat.me;
include mime.types;
charset utf-8;
default_type text/html;
ssl_certificate /var/www/certs/webdevcat.me/fullchain.pem;
ssl_certificate_key /var/www/certs/webdevcat.me/privkey.pem;
# ssl_certificate /var/www/certs/webdevcat.me/fullchain.pem;
# ssl_certificate_key /var/www/certs/webdevcat.me/privkey.pem;
location ^~ /.well-known/acme-challenge {
alias /var/www/dehydrated;
@ -102,7 +103,7 @@ http {
}
}
server {
listen 443 ssl;
# listen 443 ssl;
server_name git.webdevcat.me;
location ^~ /.well-known/acme-challenge {
@ -110,7 +111,7 @@ http {
}
}
server {
listen 443 ssl;
# listen 443 ssl;
server_name apps.webdevcat.me;
location ^~ /.well-known/acme-challenge {

17
test.sh Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
# echo "hello"
# curl http://webdevcat.me:8080
image=miti.sh
echo "starting container..."
container_id=$(docker run --rm -d -v $(pwd):/opt/app -p 8080:8080 \
--add-host=miti.sh=127.0.0.1 \
--add-host=webdevcat.me=127.0.0.1 \
$image)
echo "container $container_id started"
echo "stopping container $container_id"
stop_cmd_result=$(docker stop $container_id)
echo "container $stop_cmd_result stopped"
# curl http://miti.sh:8080