Compare commits
10 Commits
e3559119be
...
feature/23
| Author | SHA1 | Date | |
|---|---|---|---|
|
161b78be97
|
|||
|
6e83384da5
|
|||
|
be8278fbdc
|
|||
| ff3f05452f | |||
|
|
1fb66092fc | ||
|
|
81691f7e21 | ||
| e9dff82628 | |||
|
0933e9caa0
|
|||
| 9f862a89cc | |||
|
039dbdf091
|
@@ -12,6 +12,7 @@
|
||||
},
|
||||
"openresty": {
|
||||
"listen_ip": "148.251.237.111",
|
||||
"listen_ipv6": "2a01:4f8:202:804a::2",
|
||||
"log_formats": {
|
||||
"json": "{\"ip\":\"$remote_addr\",\"time\":\"$time_local\",\"host\":\"$host\",\"method\":\"$request_method\",\"uri\":\"$uri\",\"status\":$status,\"size\":$body_bytes_sent,\"referer\":\"$http_referer\",\"upstream_addr\":\"$upstream_addr\",\"upstream_response_time\":\"$upstream_response_time\",\"ua\":\"$http_user_agent\"}"
|
||||
}
|
||||
|
||||
@@ -50,13 +50,6 @@
|
||||
"postfix::sasl_auth",
|
||||
"hostname::default",
|
||||
"firewall::default",
|
||||
"kosmos_gitea::compile_from_source",
|
||||
"git::default",
|
||||
"git::package",
|
||||
"kosmos-nodejs::default",
|
||||
"nodejs::nodejs_from_package",
|
||||
"nodejs::repo",
|
||||
"golang::default",
|
||||
"backup::default",
|
||||
"logrotate::default"
|
||||
],
|
||||
|
||||
@@ -8,8 +8,8 @@ run_list %w(
|
||||
|
||||
override_attributes(
|
||||
"gitea" => {
|
||||
"repo" => "https://github.com/67P/gitea.git",
|
||||
"revision" => "ldap_sync",
|
||||
# "repo" => "https://github.com/67P/gitea.git",
|
||||
# "revision" => "ldap_sync",
|
||||
"log" => { "level" => "Info" }
|
||||
},
|
||||
)
|
||||
|
||||
@@ -8,8 +8,8 @@ upstream _<%= @upstream_name %> {
|
||||
<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%>
|
||||
server {
|
||||
server_name <%= @server_name %>;
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
|
||||
ssl_certificate <%= @ssl_cert %>;
|
||||
ssl_certificate_key <%= @ssl_key %>;
|
||||
|
||||
@@ -11,7 +11,7 @@ proxy_cache_path <%= node[:openresty][:cache_dir] %>/akkounts levels=1:2
|
||||
|
||||
server {
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
server_name <%= @domain %>;
|
||||
|
||||
if ($host != $server_name) {
|
||||
|
||||
@@ -7,7 +7,7 @@ upstream _akkounts_api {
|
||||
|
||||
server {
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
server_name <%= @domain %>;
|
||||
|
||||
ssl_certificate <%= @ssl_cert %>;
|
||||
|
||||
@@ -49,7 +49,7 @@ server {
|
||||
client_max_body_size 100M;
|
||||
server_name <%= @server_name %>;
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
|
||||
access_log <%= node[:nginx][:log_dir] %>/btcpayserver.access.log json;
|
||||
error_log <%= node[:nginx][:log_dir] %>/btcpayserver.error.log warn;
|
||||
|
||||
@@ -7,7 +7,7 @@ upstream _lndhub {
|
||||
|
||||
server {
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
server_name <%= @server_name %>;
|
||||
|
||||
add_header Strict-Transport-Security "max-age=15768000";
|
||||
|
||||
@@ -49,7 +49,7 @@ server {
|
||||
server_name <%= @server_name %>;
|
||||
<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%>
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
<% else -%>
|
||||
listen 80;
|
||||
<% end -%>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
server_name <%= @server_name %>;
|
||||
|
||||
ssl_certificate <%= @ssl_cert %>;
|
||||
|
||||
@@ -7,7 +7,7 @@ upstream _express_<%= @server_name.gsub(".", "_") %> {
|
||||
|
||||
server {
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
server_name <%= @server_name %>;
|
||||
|
||||
add_header Strict-Transport-Security "max-age=15768000";
|
||||
|
||||
@@ -12,7 +12,7 @@ upstream _ipfs_api {
|
||||
server {
|
||||
server_name <%= @server_name %>;
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
|
||||
access_log /var/log/nginx/<%= @server_name %>.access.log;
|
||||
error_log /var/log/nginx/<%= @server_name %>.error.log;
|
||||
|
||||
@@ -21,7 +21,7 @@ proxy_cache_path /var/cache/nginx/mastodon levels=1:2
|
||||
|
||||
server {
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
server_name <%= @server_name %>;
|
||||
include <%= @shared_config_path %>;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
server {
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
server_name <%= @domain %>;
|
||||
|
||||
root /var/www/<%= @domain %>/site;
|
||||
|
||||
@@ -9,7 +9,7 @@ upstream _discourse {
|
||||
server {
|
||||
server_name <%= @server_name %>;
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
|
||||
ssl_certificate <%= @ssl_cert %>;
|
||||
ssl_certificate_key <%= @ssl_key %>;
|
||||
|
||||
@@ -8,7 +8,7 @@ upstream _drone {
|
||||
server {
|
||||
server_name <%= @server_name %>;
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
|
||||
ssl_certificate <%= @ssl_cert %>;
|
||||
ssl_certificate_key <%= @ssl_key %>;
|
||||
|
||||
@@ -4,7 +4,7 @@ upstream garage_s3 {
|
||||
|
||||
server {
|
||||
listen <%= "#{node[:openresty][:listen_ip]}:" if node[:openresty][:listen_ip] %>443 ssl http2;
|
||||
listen [::]:443 http2 ssl;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
|
||||
ssl_certificate <%= @ssl_cert %>;
|
||||
ssl_certificate_key <%= @ssl_key %>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
server {
|
||||
listen <%= "#{node[:openresty][:listen_ip]}:" if node[:openresty][:listen_ip] %>443 ssl http2;
|
||||
listen [::]:443 http2 ssl;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
|
||||
server_name <%= @server_name %>;
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
node.default["gitea"]["version"] = "1.23.8"
|
||||
node.default["gitea"]["checksum"] = "827037e7ca940866918abc62a7488736923396c467fcb4acd0dd9829bb6a6f4c"
|
||||
node.default["gitea"]["version"] = "1.25.4"
|
||||
node.default["gitea"]["checksum"] = "a3031853e67c53714728ef705642c9046a11fb0ea356aff592e23efe6114607d"
|
||||
node.default["gitea"]["repo"] = nil
|
||||
node.default["gitea"]["revision"] = nil
|
||||
node.default["gitea"]["working_directory"] = "/var/lib/gitea"
|
||||
node.default["gitea"]["port"] = 3000
|
||||
node.default["gitea"]["postgresql_host"] = "localhost:5432"
|
||||
node.default["gitea"]["domain"] = "gitea.kosmos.org"
|
||||
node.default["gitea"]["email"] = "gitea@kosmos.org"
|
||||
|
||||
node.default["gitea"]["config"] = {
|
||||
"log": {
|
||||
@@ -22,5 +23,5 @@ node.default["gitea"]["config"] = {
|
||||
}
|
||||
}
|
||||
|
||||
node.default["gitea"]["act_runner"]["version"] = "0.2.6"
|
||||
node.default["gitea"]["act_runner"]["checksum"] = "234c2bdb871e7b0bfb84697f353395bfc7819faf9f0c0443845868b64a041057"
|
||||
node.default["gitea"]["act_runner"]["version"] = "0.2.13"
|
||||
node.default["gitea"]["act_runner"]["checksum"] = "3acac8b506ac8cadc88a55155b5d6378f0fab0b8f62d1e0c0450f4ccd69733e2"
|
||||
|
||||
@@ -19,6 +19,17 @@ jwt_secret = gitea_data_bag_item["jwt_secret"]
|
||||
internal_token = gitea_data_bag_item["internal_token"]
|
||||
secret_key = gitea_data_bag_item["secret_key"]
|
||||
|
||||
apt_repository "git-core-ppa" do
|
||||
uri "http://ppa.launchpad.net/git-core/ppa/ubuntu"
|
||||
components ["main"]
|
||||
key "E1DF1F24"
|
||||
action :add
|
||||
only_if do
|
||||
node['platform'] == 'ubuntu' &&
|
||||
Gem::Version.new(node['platform_version']) < Gem::Version.new('22.04')
|
||||
end
|
||||
end
|
||||
|
||||
package "git"
|
||||
|
||||
user "git" do
|
||||
@@ -26,6 +37,13 @@ user "git" do
|
||||
home "/home/git"
|
||||
end
|
||||
|
||||
directory "/home/git/.ssh" do
|
||||
owner "git"
|
||||
group "git"
|
||||
mode "0700"
|
||||
recursive true
|
||||
end
|
||||
|
||||
directory working_directory do
|
||||
owner "git"
|
||||
group "git"
|
||||
@@ -78,6 +96,8 @@ if node.chef_environment == "production"
|
||||
end
|
||||
|
||||
config_variables = {
|
||||
domain: node["gitea"]["domain"],
|
||||
email: node["gitea"]["email"],
|
||||
working_directory: working_directory,
|
||||
git_home_directory: git_home_directory,
|
||||
repository_root_directory: repository_root_directory,
|
||||
@@ -98,6 +118,16 @@ config_variables = {
|
||||
s3_bucket: gitea_data_bag_item["s3_bucket"]
|
||||
}
|
||||
|
||||
bash "Generate git ed25519 keypair" do
|
||||
user "git"
|
||||
group "git"
|
||||
cwd git_home_directory
|
||||
code <<-EOH
|
||||
ssh-keygen -t ed25519 -f #{git_home_directory}/.ssh/id_ed25519
|
||||
EOH
|
||||
creates "#{git_home_directory}/.ssh/id_ed25519"
|
||||
end
|
||||
|
||||
template "#{config_directory}/app.ini" do
|
||||
source "app.ini.erb"
|
||||
owner "git"
|
||||
@@ -129,7 +159,7 @@ template "/etc/systemd/system/gitea.service" do
|
||||
git_home_directory: git_home_directory,
|
||||
config_directory: config_directory,
|
||||
gitea_binary_path: gitea_binary_path
|
||||
notifies :run, "execute[systemctl daemon-reload]", :delayed
|
||||
notifies :run, "execute[systemctl daemon-reload]", :immediately
|
||||
end
|
||||
|
||||
service "gitea" do
|
||||
|
||||
@@ -2,12 +2,12 @@ APP_NAME = Gitea
|
||||
RUN_MODE = prod
|
||||
|
||||
[server]
|
||||
SSH_DOMAIN = gitea.kosmos.org
|
||||
SSH_DOMAIN = <%= @domain %>
|
||||
HTTP_PORT = 3000
|
||||
DISABLE_SSH = false
|
||||
SSH_PORT = 22
|
||||
PROTOCOL = http
|
||||
DOMAIN = gitea.kosmos.org
|
||||
DOMAIN = <%= @domain %>
|
||||
# Gitea is running behind an nginx reverse load balancer, use an HTTPS root URL
|
||||
ROOT_URL = https://%(DOMAIN)s
|
||||
# REDIRECT_OTHER_PORT = true
|
||||
@@ -30,6 +30,16 @@ MAX_OPEN_CONNS = 20
|
||||
ROOT = <%= @repository_root_directory %>
|
||||
DISABLE_DOWNLOAD_SOURCE_ARCHIVES = true
|
||||
|
||||
[repository.signing]
|
||||
SIGNING_KEY = <%= @git_home_directory %>/.ssh/id_ed25519.pub
|
||||
SIGNING_NAME = Gitea
|
||||
SIGNING_EMAIL = git@<%= @domain %>
|
||||
SIGNING_FORMAT = ssh
|
||||
INITIAL_COMMIT = always
|
||||
CRUD_ACTIONS = always
|
||||
WIKI = always
|
||||
MERGES = always
|
||||
|
||||
# [indexer]
|
||||
# ISSUE_INDEXER_PATH = /data/gitea/indexers/issues.bleve
|
||||
|
||||
@@ -46,7 +56,7 @@ SMTP_ADDR = <%= @smtp_addr %>
|
||||
SMTP_PORT = <%= @smtp_port %>
|
||||
USER = <%= @smtp_user %>
|
||||
PASSWD = <%= @smtp_password %>
|
||||
FROM = gitea@kosmos.org
|
||||
FROM = <%= @email %>
|
||||
|
||||
[security]
|
||||
INTERNAL_TOKEN = <%= @internal_token %>
|
||||
|
||||
@@ -4,5 +4,6 @@ upstream _gitea_ssh {
|
||||
|
||||
server {
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>22;
|
||||
listen [::]:22;
|
||||
proxy_pass _gitea_ssh;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ upstream _gitea_web {
|
||||
server {
|
||||
server_name <%= @server_name %>;
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
|
||||
ssl_certificate <%= @ssl_cert %>;
|
||||
ssl_certificate_key <%= @ssl_key %>;
|
||||
|
||||
@@ -12,7 +12,7 @@ upstream _<%= @app_name %> {
|
||||
|
||||
server {
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
server_name <%= @server_name %>;
|
||||
|
||||
access_log <%= node[:nginx][:log_dir] %>/<%= @app_name %>.access.log; # TODO json_liquor_cabinet;
|
||||
|
||||
1
site-cookbooks/kosmos_openresty/attributes/default.rb
Normal file
1
site-cookbooks/kosmos_openresty/attributes/default.rb
Normal file
@@ -0,0 +1 @@
|
||||
node.default["openresty"]["listen_ipv6"] = "::"
|
||||
@@ -6,7 +6,7 @@ upstream _<%= @upstream_name %> {
|
||||
|
||||
server {
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
|
||||
server_name <%= @domain %>;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ upstream _substr {
|
||||
server {
|
||||
server_name <%= @domain %>;
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
|
||||
access_log "/var/log/nginx/<%= @domain %>.access.log";
|
||||
error_log "/var/log/nginx/<%= @domain %>.error.log";
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
server {
|
||||
server_name <%= @domain %>;
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
|
||||
access_log <%= node[:openresty][:log_dir] %>/<%= @domain %>.access.log;
|
||||
error_log <%= node[:openresty][:log_dir] %>/<%= @domain %>.error.log warn;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
server {
|
||||
server_name <%= @domain %>;
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
|
||||
root /var/www/<%= @domain %>/public;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
server {
|
||||
server_name _;
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>80 default_server;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:80 default_server;
|
||||
|
||||
location / {
|
||||
return 301 https://<%= @domain %>;
|
||||
@@ -12,7 +13,7 @@ server {
|
||||
server {
|
||||
server_name <%= @domain %>;
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2 default_server;
|
||||
listen [::]:443 ssl http2 default_server;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2 default_server;
|
||||
|
||||
if ($host != $server_name) {
|
||||
return 307 $scheme://$server_name;
|
||||
|
||||
@@ -5,8 +5,8 @@ upstream _<%= @app_name %> {
|
||||
|
||||
<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%>
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
server_name <%= @server_name %>;
|
||||
|
||||
access_log <%= node[:nginx][:log_dir] %>/<%= @app_name %>.access.log json;
|
||||
|
||||
Submodule site-cookbooks/openresty updated: bc916b981c...b31d6b0b01
@@ -8,7 +8,7 @@ upstream _rs_discourse {
|
||||
server {
|
||||
server_name <%= @server_name %>;
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
|
||||
ssl_certificate <%= @ssl_cert %>;
|
||||
ssl_certificate_key <%= @ssl_key %>;
|
||||
|
||||
Reference in New Issue
Block a user