Compare commits
1 Commits
0b2e3150aa
...
jammy_jell
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
401b03cc1e
|
6
.gitmodules
vendored
6
.gitmodules
vendored
@@ -4,9 +4,3 @@
|
||||
[submodule "site-cookbooks/openresty"]
|
||||
path = site-cookbooks/openresty
|
||||
url = https://github.com/67P/chef-openresty.git
|
||||
[submodule "site-cookbooks/strfry"]
|
||||
path = site-cookbooks/strfry
|
||||
url = git@gitea.kosmos.org:kosmos/strfry-cookbook.git
|
||||
[submodule "site-cookbooks/deno"]
|
||||
path = site-cookbooks/deno
|
||||
url = git@gitea.kosmos.org:kosmos/deno-cookbook.git
|
||||
|
||||
@@ -101,16 +101,6 @@
|
||||
},
|
||||
"sentry": {
|
||||
"allowed_ips": "10.1.1.0/24"
|
||||
},
|
||||
"strfry": {
|
||||
"domain": "nostr.kosmos.org",
|
||||
"real_ip_header": "x-real-ip",
|
||||
"info": {
|
||||
"name": "Kosmos Relay",
|
||||
"description": "Members-only nostr relay for kosmos.org users",
|
||||
"pubkey": "1f79058c77a224e5be226c8f024cacdad4d741855d75ed9f11473ba8eb86e1cb",
|
||||
"contact": "ops@kosmos.org"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
"kosmos_liquor-cabinet::nginx",
|
||||
"kosmos_rsk::nginx_testnet",
|
||||
"kosmos_rsk::nginx_mainnet",
|
||||
"kosmos_strfry::nginx",
|
||||
"kosmos_website",
|
||||
"kosmos_website::default",
|
||||
"kosmos-akkounts::nginx",
|
||||
|
||||
@@ -28,7 +28,6 @@ production_run_list = %w(
|
||||
kosmos_liquor-cabinet::nginx
|
||||
kosmos_rsk::nginx_testnet
|
||||
kosmos_rsk::nginx_mainnet
|
||||
kosmos_strfry::nginx
|
||||
kosmos_website::default
|
||||
kosmos-akkounts::nginx
|
||||
kosmos-akkounts::nginx_api
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
name "strfry"
|
||||
|
||||
run_list %w(
|
||||
strfry::default
|
||||
kosmos_strfry::firewall
|
||||
)
|
||||
Submodule site-cookbooks/deno deleted from 617f7959ab
@@ -1,9 +1,9 @@
|
||||
ubuntu_server_cloud_image_release = "20230506"
|
||||
release = "20240514"
|
||||
|
||||
node.default["kosmos_kvm"]["host"]["qemu_base_image"] = {
|
||||
"url" => "https://cloud-images.ubuntu.com/releases/focal/release-#{ubuntu_server_cloud_image_release}/ubuntu-20.04-server-cloudimg-amd64-disk-kvm.img",
|
||||
"checksum" => "27d2b91fd2b715729d739e2a3155dce70d1aaae4f05c177f338b9d4b60be638c",
|
||||
"path" => "/var/lib/libvirt/images/base/ubuntu-20.04-server-cloudimg-amd64-disk-kvm-#{ubuntu_server_cloud_image_release}.qcow2"
|
||||
"url" => "https://cloud-images.ubuntu.com/releases/jammy/release-#{release}/ubuntu-22.04-server-cloudimg-amd64-disk-kvm.img",
|
||||
"checksum" => "2e7698b3ebd7caead06b08bd3ece241e6ce294a6db01f92ea12bcb56d6972c3f",
|
||||
"path" => "/var/lib/libvirt/images/base/ubuntu-22.04-server-cloudimg-amd64-disk-kvm-#{release}.qcow2"
|
||||
}
|
||||
|
||||
# A systemd.timer OnCalendar config value
|
||||
|
||||
@@ -17,7 +17,7 @@ DISKSIZE=${4:-10} # 10GB default
|
||||
# Directory where image files will be stored
|
||||
IMAGE_DIR=/var/lib/libvirt/images
|
||||
IMAGE_PATH=$IMAGE_DIR/${VMNAME}.qcow2
|
||||
CIDATA_PATH=${IMAGE_DIR}/cidata-${VMNAME}.iso
|
||||
CIDATA_PATH=${IMAGE_DIR}/${VMNAME}-cloudinit
|
||||
BASE_FILE=<%= @base_image_path %>
|
||||
|
||||
# Create the VM image if it does not already exist
|
||||
@@ -38,9 +38,8 @@ qemu-img info "$IMAGE_PATH"
|
||||
# Check if the cloud-init metadata file exists
|
||||
# if not, generate it
|
||||
if [ ! -r $CIDATA_PATH ]; then
|
||||
pushd $(dirname $CIDATA_PATH)
|
||||
mkdir -p $VMNAME
|
||||
cd $VMNAME
|
||||
mkdir -p $CIDATA_PATH
|
||||
pushd $CIDATA_PATH
|
||||
|
||||
cat > user-data <<-EOS
|
||||
#cloud-config
|
||||
@@ -62,25 +61,19 @@ instance-id: $VMNAME
|
||||
local-hostname: $VMNAME
|
||||
EOS
|
||||
|
||||
genisoimage -output "$CIDATA_PATH" -volid cidata -joliet -rock user-data meta-data
|
||||
chown libvirt-qemu:kvm "$CIDATA_PATH"
|
||||
chmod 600 "$CIDATA_PATH"
|
||||
popd
|
||||
fi
|
||||
|
||||
# setting --os-variant to ubuntu20.04 and ubuntu18.04 breaks SSH and networking
|
||||
virt-install \
|
||||
--name "$VMNAME" \
|
||||
--ram "$RAM" \
|
||||
--vcpus "$CPUS" \
|
||||
--cpu host \
|
||||
--arch x86_64 \
|
||||
--os-type linux \
|
||||
--os-variant ubuntu16.04 \
|
||||
--osinfo detect=on,name=ubuntujammy \
|
||||
--hvm \
|
||||
--virt-type kvm \
|
||||
--disk "$IMAGE_PATH" \
|
||||
--cdrom "$CIDATA_PATH" \
|
||||
--boot hd \
|
||||
--network=bridge=virbr0,model=virtio \
|
||||
--graphics none \
|
||||
@@ -88,4 +81,5 @@ virt-install \
|
||||
--console pty \
|
||||
--channel unix,mode=bind,path=/var/lib/libvirt/qemu/$VMNAME.guest_agent.0,target_type=virtio,name=org.qemu.guest_agent.0 \
|
||||
--autostart \
|
||||
--import
|
||||
--import \
|
||||
--cloud-init root-password-generate=off,disable=on,meta-data=$CIDATA_PATH/meta-data,user-data=$CIDATA_PATH/user-data
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
Copyright (c) 2024 Kosmos Developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -1,4 +0,0 @@
|
||||
kosmos_strfry
|
||||
=============
|
||||
|
||||
Installs/configures a strfry relay and its reverse proxy config
|
||||
@@ -1,9 +0,0 @@
|
||||
name 'kosmos_strfry'
|
||||
maintainer 'Kosmos'
|
||||
maintainer_email 'mail@kosmos.org'
|
||||
license 'MIT'
|
||||
description 'strfry wrapper cookbook'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version '0.1.0'
|
||||
|
||||
depends 'kosmos_openresty'
|
||||
@@ -1,13 +0,0 @@
|
||||
#
|
||||
# Cookbook Name:: kosmos_strfry
|
||||
# Recipe:: firewall
|
||||
#
|
||||
|
||||
include_recipe "kosmos-base::firewall"
|
||||
|
||||
firewall_rule "strfry" do
|
||||
port node["strfry"]["port"]
|
||||
source "10.1.1.0/24"
|
||||
protocol :tcp
|
||||
command :allow
|
||||
end
|
||||
@@ -1,29 +0,0 @@
|
||||
#
|
||||
# Cookbook Name:: kosmos_strfry
|
||||
# Recipe:: nginx
|
||||
#
|
||||
|
||||
domain = node["strfry"]["domain"]
|
||||
|
||||
upstream_hosts = []
|
||||
search(:node, 'role:strfry').each do |node|
|
||||
upstream_hosts << node['knife_zero']['host']
|
||||
end
|
||||
if upstream_hosts.empty?
|
||||
Chef::Log.warn("No node found with 'strfry' role. Not configuring nginx site.")
|
||||
return
|
||||
end
|
||||
|
||||
tls_cert_for domain do
|
||||
auth "gandi_dns"
|
||||
action :create
|
||||
end
|
||||
|
||||
openresty_site domain do
|
||||
template "nginx_conf_strfry.erb"
|
||||
variables domain: domain,
|
||||
upstream_port: node['strfry']['port'],
|
||||
upstream_hosts: upstream_hosts,
|
||||
ssl_cert: "/etc/letsencrypt/live/#{domain}/fullchain.pem",
|
||||
ssl_key: "/etc/letsencrypt/live/#{domain}/privkey.pem"
|
||||
end
|
||||
@@ -1,28 +0,0 @@
|
||||
upstream _strfry {
|
||||
<% @upstream_hosts.each do |host| %>
|
||||
server <%= host %>:<%= @upstream_port || "7777" %>;
|
||||
<% end %>
|
||||
}
|
||||
|
||||
server {
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
server_name <%= @domain %>;
|
||||
|
||||
access_log "/var/log/nginx/<%= @domain %>.access.log";
|
||||
error_log "/var/log/nginx/<%= @domain %>.error.log";
|
||||
|
||||
ssl_certificate <%= @ssl_cert %>;
|
||||
ssl_certificate_key <%= @ssl_key %>;
|
||||
|
||||
location / {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_pass http://_strfry;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
}
|
||||
Submodule site-cookbooks/strfry deleted from 65b6d65527
Reference in New Issue
Block a user