Compare commits
18 Commits
trunk
...
c800c8e775
| Author | SHA1 | Date | |
|---|---|---|---|
| c800c8e775 | |||
| 3f494b037d | |||
| b165c2112e | |||
| f9ef223cf1 | |||
| 5d7896e9e5 | |||
| 0cc8f18302 | |||
| be52884226 | |||
| 3cb0b83e8a | |||
| ca15a32429 | |||
| 82f4e9c92e | |||
| eb896676cc | |||
| 766c9bad62 | |||
| c26453415d | |||
| dce537b50c | |||
| b7e6a93bf9 | |||
| 95b3589d22 | |||
| 4ad479f8f9 | |||
| 0e848c5e7b |
62
Dockerfile
62
Dockerfile
@@ -1,64 +1,15 @@
|
|||||||
FROM buildpack-deps:trixie
|
FROM openresty/openresty:bookworm-buildpack
|
||||||
|
|
||||||
ARG version=3.8.2.1
|
WORKDIR /opt/app
|
||||||
|
|
||||||
|
ARG version=3.7.0.1
|
||||||
ARG pkgname=pandoc-$version-1-amd64.deb
|
ARG pkgname=pandoc-$version-1-amd64.deb
|
||||||
ARG pkgurl=https://github.com/jgm/pandoc/releases/download/$version/$pkgname
|
ARG pkgurl=https://github.com/jgm/pandoc/releases/download/$version/$pkgname
|
||||||
|
|
||||||
ARG RESTY_DEB_FLAVOR=""
|
|
||||||
ARG RESTY_DEB_VERSION="=1.27.1.2-1~bookworm1"
|
|
||||||
ARG RESTY_LUAROCKS_VERSION="3.12.2"
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
python3-pygments lua-inotify wget && \
|
python3-pygments lua-inotify wget && \
|
||||||
wget -q -O $pkgname $pkgurl && dpkg -i $pkgname && rm $pkgname
|
wget -q -O $pkgname $pkgurl && dpkg -i $pkgname && rm $pkgname
|
||||||
|
|
||||||
RUN wget -qO - https://openresty.org/package/pubkey.gpg | gpg --dearmor > /etc/apt/trusted.gpg.d/openresty-keyring.gpg \
|
|
||||||
&& chown root:root /etc/apt/trusted.gpg.d/openresty-keyring.gpg \
|
|
||||||
&& chmod ugo+r /etc/apt/trusted.gpg.d/openresty-keyring.gpg \
|
|
||||||
&& chmod go-w /etc/apt/trusted.gpg.d/openresty-keyring.gpg \
|
|
||||||
&& echo "\nTypes: deb\nURIs: https://openresty.org/package/debian\nSuites: bookworm\nComponents: openresty\nEnabled: yes\nSigned-By: /etc/apt/trusted.gpg.d/openresty-keyring.gpg" >> /etc/apt/sources.list.d/debian.sources \
|
|
||||||
&& DEBIAN_FRONTEND=noninteractive apt-get update \
|
|
||||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
|
||||||
openresty${RESTY_DEB_FLAVOR}${RESTY_DEB_VERSION} \
|
|
||||||
openresty-resty${RESTY_DEB_FLAVOR}${RESTY_DEB_VERSION} \
|
|
||||||
openresty-opm${RESTY_DEB_FLAVOR}${RESTY_DEB_VERSION} \
|
|
||||||
openresty-openssl3${RESTY_DEB_FLAVOR}-dev \
|
|
||||||
openresty-pcre2${RESTY_DEB_FLAVOR}-dev \
|
|
||||||
openresty-zlib${RESTY_DEB_FLAVOR}-dev \
|
|
||||||
&& mkdir -p /var/run/openresty \
|
|
||||||
&& ln -sf /dev/stdout /usr/local/openresty${RESTY_DEB_FLAVOR}/nginx/logs/access.log \
|
|
||||||
&& ln -sf /dev/stderr /usr/local/openresty${RESTY_DEB_FLAVOR}/nginx/logs/error.log
|
|
||||||
|
|
||||||
# Install LuaRocks
|
|
||||||
RUN curl -fSL https://luarocks.github.io/luarocks/releases/luarocks-${RESTY_LUAROCKS_VERSION}.tar.gz -o luarocks-${RESTY_LUAROCKS_VERSION}.tar.gz \
|
|
||||||
&& tar xzf luarocks-${RESTY_LUAROCKS_VERSION}.tar.gz \
|
|
||||||
&& cd luarocks-${RESTY_LUAROCKS_VERSION} \
|
|
||||||
&& mkdir -p /usr/local/openresty/luajit \
|
|
||||||
&& ./configure \
|
|
||||||
--prefix=/usr/local/openresty/luajit \
|
|
||||||
--with-lua=/usr/local/openresty/luajit \
|
|
||||||
--with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1 \
|
|
||||||
&& make build \
|
|
||||||
&& make install \
|
|
||||||
&& cd /tmp \
|
|
||||||
&& rm -rf luarocks-${RESTY_LUAROCKS_VERSION} luarocks-${RESTY_LUAROCKS_VERSION}.tar.gz
|
|
||||||
|
|
||||||
# Add additional binaries into PATH for convenience
|
|
||||||
ENV PATH="$PATH:/usr/local/openresty${RESTY_DEB_FLAVOR}/luajit/bin:/usr/local/openresty${RESTY_DEB_FLAVOR}/nginx/sbin:/usr/local/openresty${RESTY_DEB_FLAVOR}/bin"
|
|
||||||
|
|
||||||
# Add LuaRocks paths
|
|
||||||
# If OpenResty changes, these may need updating:
|
|
||||||
# /usr/local/openresty/bin/resty -e 'print(package.path)'
|
|
||||||
# /usr/local/openresty/bin/resty -e 'print(package.cpath)'
|
|
||||||
ENV LUA_PATH="/usr/local/openresty/site/lualib/?.ljbc;/usr/local/openresty/site/lualib/?/init.ljbc;/usr/local/openresty/lualib/?.ljbc;/usr/local/openresty/lualib/?/init.ljbc;/usr/local/openresty/site/lualib/?.lua;/usr/local/openresty/site/lualib/?/init.lua;/usr/local/openresty/lualib/?.lua;/usr/local/openresty/lualib/?/init.lua;./?.lua;/usr/local/openresty/luajit/share/luajit-2.1/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/openresty/luajit/share/lua/5.1/?.lua;/usr/local/openresty/luajit/share/lua/5.1/?/init.lua"
|
|
||||||
ENV LUA_CPATH="/usr/local/openresty/site/lualib/?.so;/usr/local/openresty/lualib/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/openresty/luajit/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so;/usr/local/openresty/luajit/lib/lua/5.1/?.so"
|
|
||||||
|
|
||||||
WORKDIR /opt/app
|
|
||||||
|
|
||||||
# Copy nginx configuration files
|
|
||||||
COPY nginx.conf /usr/local/openresty${RESTY_DEB_FLAVOR}/nginx/conf/nginx.conf
|
|
||||||
COPY nginx.vh.default.conf /etc/nginx/conf.d/default.conf
|
|
||||||
|
|
||||||
RUN luarocks install sitegen
|
RUN luarocks install sitegen
|
||||||
|
|
||||||
# needed for sitegen watcher
|
# needed for sitegen watcher
|
||||||
@@ -84,8 +35,3 @@ RUN mkdir -p /var/www/certs/webdevcat.me \
|
|||||||
-addext "subjectAltName=DNS:webdevcat.me,DNS:git.webdevcat.me,DNS:apps.webdevcat.me"
|
-addext "subjectAltName=DNS:webdevcat.me,DNS:git.webdevcat.me,DNS:apps.webdevcat.me"
|
||||||
|
|
||||||
CMD ["sh", "-c", "openresty -p `pwd` -g 'daemon off;'"]
|
CMD ["sh", "-c", "openresty -p `pwd` -g 'daemon off;'"]
|
||||||
|
|
||||||
# Use SIGQUIT instead of default SIGTERM to cleanly drain requests
|
|
||||||
# See https://github.com/openresty/docker-openresty/blob/master/README.md#tips--pitfalls
|
|
||||||
STOPSIGNAL SIGQUIT
|
|
||||||
|
|
||||||
|
|||||||
3
Makefile
3
Makefile
@@ -5,9 +5,6 @@ serve:
|
|||||||
docker run --rm -it --init -v $(PWD):/opt/app -p 8080:80 $(image) \
|
docker run --rm -it --init -v $(PWD):/opt/app -p 8080:80 $(image) \
|
||||||
sh -c "openresty -p /opt/app -g 'daemon off;' -c conf/dev.nginx.conf"
|
sh -c "openresty -p /opt/app -g 'daemon off;' -c conf/dev.nginx.conf"
|
||||||
|
|
||||||
shell:
|
|
||||||
docker run --rm -it --init -v $(PWD):/opt/app -p 8080:80 $(image) bash
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
$(if $(file), $(docker-run) sitegen build $(file), $(docker-run) sitegen)
|
$(if $(file), $(docker-run) sitegen build $(file), $(docker-run) sitegen)
|
||||||
|
|
||||||
|
|||||||
50
README.md
50
README.md
@@ -1,26 +1,23 @@
|
|||||||
## requirements
|
## requirements
|
||||||
|
|
||||||
* Docker
|
`pandoc` utility must be installed
|
||||||
|
|
||||||
## up and running
|
- Debian Bookworm:
|
||||||
|
|
||||||
### build container image
|
$ apt-get update && apt-get install -y pandoc
|
||||||
|
|
||||||
|
## start default openresty
|
||||||
|
|
||||||
|
1. Run `docker run --rm -it --init -w /opt -v $PWD:/opt -p 80:80 openresty/openresty:1.27.1.2-0-bookworm-buildpack`
|
||||||
|
2. Visit `localhost` in web browser.
|
||||||
|
|
||||||
|
## start a custom site
|
||||||
|
|
||||||
|
### build docker image
|
||||||
|
|
||||||
$ make image-build
|
$ make image-build
|
||||||
|
|
||||||
### build site
|
### rebuild an existing docker image
|
||||||
|
|
||||||
$ make build
|
|
||||||
|
|
||||||
### start dev server
|
|
||||||
|
|
||||||
$ make serve
|
|
||||||
|
|
||||||
Visit `localhost:8080` in web browser
|
|
||||||
|
|
||||||
## getting around
|
|
||||||
|
|
||||||
### rebuild the container image
|
|
||||||
|
|
||||||
$ make image-rm image-build
|
$ make image-rm image-build
|
||||||
|
|
||||||
@@ -30,11 +27,9 @@ Visit `localhost:8080` in web browser
|
|||||||
|
|
||||||
### add an index page
|
### add an index page
|
||||||
|
|
||||||
#### create the file
|
|
||||||
|
|
||||||
$ docker run --rm -w /opt/app -v $PWD:/opt/app miti.sh sitegen page /opt/app index
|
$ docker run --rm -w /opt/app -v $PWD:/opt/app miti.sh sitegen page /opt/app index
|
||||||
|
|
||||||
#### add to `site.moon`
|
### add to `site.moon`
|
||||||
|
|
||||||
add "index.md"
|
add "index.md"
|
||||||
|
|
||||||
@@ -57,13 +52,19 @@ Visit `localhost:8080` in web browser
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
### build site
|
||||||
|
|
||||||
|
$ make build
|
||||||
|
|
||||||
### build a single file
|
### build a single file
|
||||||
|
|
||||||
$ make build file=index.html
|
$ make build file=index.html
|
||||||
|
|
||||||
### start a shell
|
### start dev server
|
||||||
|
|
||||||
$ make shell
|
$ make serve
|
||||||
|
|
||||||
|
Visit `localhost:8080` in web browser
|
||||||
|
|
||||||
### start watcher
|
### start watcher
|
||||||
|
|
||||||
@@ -89,13 +90,6 @@ example:
|
|||||||
|
|
||||||
$ make deploy
|
$ make deploy
|
||||||
|
|
||||||
### renew server TSL certs
|
|
||||||
|
|
||||||
SSH into server admin account and run:
|
|
||||||
|
|
||||||
$ cd www
|
|
||||||
$ dehydrated --config config -c
|
|
||||||
|
|
||||||
## gotchas
|
## gotchas
|
||||||
|
|
||||||
### What is error `cosmo failed: [string "..."]:62: cannot resume dead coroutine`?
|
### What is error `cosmo failed: [string "..."]:62: cannot resume dead coroutine`?
|
||||||
|
|||||||
BIN
html/images/openresty-splash-page.png
Normal file
BIN
html/images/openresty-splash-page.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
117
nginx.conf
117
nginx.conf
@@ -1,117 +0,0 @@
|
|||||||
|
|
||||||
#user nobody;
|
|
||||||
worker_processes 1;
|
|
||||||
|
|
||||||
#error_log logs/error.log;
|
|
||||||
#error_log logs/error.log notice;
|
|
||||||
#error_log logs/error.log info;
|
|
||||||
|
|
||||||
#pid logs/nginx.pid;
|
|
||||||
|
|
||||||
|
|
||||||
events {
|
|
||||||
worker_connections 1024;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
http {
|
|
||||||
include mime.types;
|
|
||||||
default_type application/octet-stream;
|
|
||||||
|
|
||||||
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
||||||
# '$status $body_bytes_sent "$http_referer" '
|
|
||||||
# '"$http_user_agent" "$http_x_forwarded_for"';
|
|
||||||
|
|
||||||
#access_log logs/access.log main;
|
|
||||||
|
|
||||||
sendfile on;
|
|
||||||
#tcp_nopush on;
|
|
||||||
|
|
||||||
#keepalive_timeout 0;
|
|
||||||
keepalive_timeout 65;
|
|
||||||
|
|
||||||
#gzip on;
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name localhost;
|
|
||||||
|
|
||||||
#charset koi8-r;
|
|
||||||
|
|
||||||
#access_log logs/host.access.log main;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
root html;
|
|
||||||
index index.html index.htm;
|
|
||||||
}
|
|
||||||
|
|
||||||
#error_page 404 /404.html;
|
|
||||||
|
|
||||||
# redirect server error pages to the static page /50x.html
|
|
||||||
#
|
|
||||||
error_page 500 502 503 504 /50x.html;
|
|
||||||
location = /50x.html {
|
|
||||||
root html;
|
|
||||||
}
|
|
||||||
|
|
||||||
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
|
||||||
#
|
|
||||||
#location ~ \.php$ {
|
|
||||||
# proxy_pass http://127.0.0.1;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
|
||||||
#
|
|
||||||
#location ~ \.php$ {
|
|
||||||
# root html;
|
|
||||||
# fastcgi_pass 127.0.0.1:9000;
|
|
||||||
# fastcgi_index index.php;
|
|
||||||
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
|
||||||
# include fastcgi_params;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# deny access to .htaccess files, if Apache's document root
|
|
||||||
# concurs with nginx's one
|
|
||||||
#
|
|
||||||
#location ~ /\.ht {
|
|
||||||
# deny all;
|
|
||||||
#}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# another virtual host using mix of IP-, name-, and port-based configuration
|
|
||||||
#
|
|
||||||
#server {
|
|
||||||
# listen 8000;
|
|
||||||
# listen somename:8080;
|
|
||||||
# server_name somename alias another.alias;
|
|
||||||
|
|
||||||
# location / {
|
|
||||||
# root html;
|
|
||||||
# index index.html index.htm;
|
|
||||||
# }
|
|
||||||
#}
|
|
||||||
|
|
||||||
|
|
||||||
# HTTPS server
|
|
||||||
#
|
|
||||||
#server {
|
|
||||||
# listen 443 ssl;
|
|
||||||
# server_name localhost;
|
|
||||||
|
|
||||||
# ssl_certificate cert.pem;
|
|
||||||
# ssl_certificate_key cert.key;
|
|
||||||
|
|
||||||
# ssl_session_cache shared:SSL:1m;
|
|
||||||
# ssl_session_timeout 5m;
|
|
||||||
|
|
||||||
# ssl_ciphers HIGH:!aNULL:!MD5;
|
|
||||||
# ssl_prefer_server_ciphers on;
|
|
||||||
|
|
||||||
# location / {
|
|
||||||
# root html;
|
|
||||||
# index index.html index.htm;
|
|
||||||
# }
|
|
||||||
#}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
# nginx.vh.default.conf -- docker-openresty
|
|
||||||
#
|
|
||||||
# This file is installed to:
|
|
||||||
# `/etc/nginx/conf.d/default.conf`
|
|
||||||
#
|
|
||||||
# It tracks the `server` section of the upstream OpenResty's `nginx.conf`.
|
|
||||||
#
|
|
||||||
# This config (and any other configs in `etc/nginx/conf.d/`) is loaded by
|
|
||||||
# default by the `include` directive in `/usr/local/openresty/nginx/conf/nginx.conf`.
|
|
||||||
#
|
|
||||||
# See https://github.com/openresty/docker-openresty/blob/master/README.md#nginx-config-files
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name localhost;
|
|
||||||
|
|
||||||
#charset koi8-r;
|
|
||||||
#access_log /var/log/nginx/host.access.log main;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
root /usr/local/openresty/nginx/html;
|
|
||||||
index index.html index.htm;
|
|
||||||
}
|
|
||||||
|
|
||||||
#error_page 404 /404.html;
|
|
||||||
|
|
||||||
# redirect server error pages to the static page /50x.html
|
|
||||||
#
|
|
||||||
error_page 500 502 503 504 /50x.html;
|
|
||||||
location = /50x.html {
|
|
||||||
root /usr/local/openresty/nginx/html;
|
|
||||||
}
|
|
||||||
|
|
||||||
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
|
||||||
#
|
|
||||||
#location ~ \.php$ {
|
|
||||||
# proxy_pass http://127.0.0.1;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
|
||||||
#
|
|
||||||
#location ~ \.php$ {
|
|
||||||
# root /usr/local/openresty/nginx/html;
|
|
||||||
# fastcgi_pass 127.0.0.1:9000;
|
|
||||||
# fastcgi_index index.php;
|
|
||||||
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
|
||||||
# include fastcgi_params;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# deny access to .htaccess files, if Apache's document root
|
|
||||||
# concurs with nginx's one
|
|
||||||
#
|
|
||||||
#location ~ /\.ht {
|
|
||||||
# deny all;
|
|
||||||
#}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user