save
This commit is contained in:
parent
b3dba4542f
commit
0c98334d1c
9 changed files with 151 additions and 0 deletions
|
@ -36,7 +36,15 @@ module Make
|
|||
@name = options.name
|
||||
@use_cache = options.use_cache || false
|
||||
|
||||
#System.detect_os
|
||||
# rbenv: brew install rbenv && rbenv install 3.0.0
|
||||
# asdf: asdf install ruby 3.0.0
|
||||
|
||||
makefile_path = "#{ENV["DAT_ROOT"]}/recipes/#{@name}.yml"
|
||||
unless File.file?(makefile_path)
|
||||
makefile_path = "#{ENV["DAT_ROOT"]}/recipes/#{@name}/#{System.detect_os}.yml"
|
||||
end
|
||||
|
||||
puts "recipe at: #{makefile_path}"
|
||||
makefile = YAML.load_file(makefile_path)
|
||||
|
||||
|
|
5
recipes/nginx/default.erb
Normal file
5
recipes/nginx/default.erb
Normal file
|
@ -0,0 +1,5 @@
|
|||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
37
recipes/nginx/generate.rb
Normal file
37
recipes/nginx/generate.rb
Normal file
|
@ -0,0 +1,37 @@
|
|||
require 'erb'
|
||||
|
||||
|
||||
class NGINXProxy
|
||||
class << self
|
||||
attr_accessor :domain, :port, :service
|
||||
|
||||
def domain(value = nil)
|
||||
@domain = value unless value.nil?
|
||||
@domain
|
||||
end
|
||||
|
||||
def port(value = nil)
|
||||
@port = value unless value.nil?
|
||||
@port
|
||||
end
|
||||
|
||||
def service(value = nil)
|
||||
@service = value unless value.nil?
|
||||
@service
|
||||
end
|
||||
|
||||
def generate
|
||||
template = File.read("proxy.erb")
|
||||
template = ERB.new(template)
|
||||
template.result(binding)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class ExampleProxy < NGINXProxy
|
||||
domain "gurgul.org"
|
||||
service "forgejo"
|
||||
port 3000
|
||||
end
|
||||
|
||||
puts ExampleProxy.generate
|
29
recipes/nginx/proxy.erb
Normal file
29
recipes/nginx/proxy.erb
Normal file
|
@ -0,0 +1,29 @@
|
|||
server {
|
||||
root /home/<%= service %>/;
|
||||
|
||||
index index.html index.htm;
|
||||
server_name <%= domain %>;
|
||||
listen [::]:443 ssl ipv6only=on;
|
||||
listen 443 ssl;
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:<%= port %>;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_send_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
}
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/<%= domain %>/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/<%= domain %>/privkey.pem;
|
||||
include /etc/letsencrypt/options-ssl-nginx.conf;
|
||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
||||
}
|
31
recipes/nginx/static.erb
Normal file
31
recipes/nginx/static.erb
Normal file
|
@ -0,0 +1,31 @@
|
|||
server {
|
||||
listen 443 ssl;
|
||||
server_name ~^(?<username>[^.]+)\.gurgul\.pro$;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/gurgul.pro/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/gurgul.pro/privkey.pem;
|
||||
|
||||
root /home/$username/website;
|
||||
index index.html index.htm index.php;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
## Optional: handle PHP (if using PHP)
|
||||
#location ~ \.php$ {
|
||||
# include snippets/fastcgi-php.conf;
|
||||
# fastcgi_pass unix:/run/php/php8.1-fpm.sock; # adjust PHP version as needed
|
||||
#}
|
||||
|
||||
location ~* \.(jpg|jpeg|png|gif|ico|css|js|pdf)$ {
|
||||
expires 7d;
|
||||
access_log off;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name ~^(?<username>[^.]+)\.gurgul\.pro$;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
22
recipes/ruby/macos.yml
Normal file
22
recipes/ruby/macos.yml
Normal file
|
@ -0,0 +1,22 @@
|
|||
packages:
|
||||
- openssl
|
||||
- readline
|
||||
- libyaml
|
||||
- libffi
|
||||
- autoconf
|
||||
- automake
|
||||
- libtool
|
||||
- pkg-config
|
||||
|
||||
repository:
|
||||
url: https://github.com/ruby/ruby.git
|
||||
branch: v3_0_0
|
||||
|
||||
steps:
|
||||
- autoconf
|
||||
- ./configure --prefix=$PREFIX
|
||||
# --with-openssl-dir=$(brew --prefix openssl)
|
||||
# --with-readline-dir=$(brew --prefix readline)
|
||||
# --with-yaml-dir=$(brew --prefix libyaml)
|
||||
- make -j$(sysctl -n hw.ncpu)
|
||||
- make install
|
19
recipes/webdav/nginx.erb
Normal file
19
recipes/webdav/nginx.erb
Normal file
|
@ -0,0 +1,19 @@
|
|||
server {
|
||||
listen 443 ssl;
|
||||
server_name drive.gurgul.pro;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/gurgul.pro/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/gurgul.pro/privkey.pem;
|
||||
|
||||
|
||||
location / {
|
||||
proxy_pass http://unix:/run/webdav.sock:/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_pass_request_headers on;
|
||||
client_max_body_size 2G;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue