Delete `gitea` recipe.

This commit is contained in:
Kazuhiro MUSASHI 2023-02-05 14:25:05 +09:00
parent bb525658d6
commit bad580a4a0
9 changed files with 9 additions and 200 deletions

View File

@ -1,18 +0,0 @@
# -------------------------------------------
# Specifying the default settings:
# -------------------------------------------
node.reverse_merge!({
'gitea' => {
'url' => 'https://github.com/go-gitea/gitea/releases/download/',
'prefix' => 'gitea-',
'postfix' => '-linux-amd64',
'storage' => '/opt/gitea/',
'location' => '/usr/local/bin/'
},
'go-mmproxy' => {
'url' => 'https://github.com/path-network/go-mmproxy/releases/',
'bin_url' => 'https://github.com/path-network/go-mmproxy/releases/download/2.0/go-mmproxy-2.0-centos8-x86_64',
'storage' => '/opt/go-mmproxy/',
'location' => '/usr/local/bin/'
},
})

View File

@ -1,8 +0,0 @@
# Loading the attributes:
include_recipe './attributes.rb'
# Install:
include_recipe './install-go-mmproxy.rb'
# Setup:
include_recipe './setup-go-mmproxy.rb'

View File

@ -1,12 +0,0 @@
{
"service": {
"name": "go-mmproxy",
"port": 50021,
"check":{
"tcp": "localhost:50021",
"interval": "60s",
"timeout": "1s",
"success_before_passing": 3
}
}
}

View File

@ -1,17 +0,0 @@
[Unit]
Description=go-mmproxy
After=network.target
[Service]
Type=simple
LimitNOFILE=65535
ExecStartPost=/sbin/ip rule add from 127.0.0.1/8 iif lo table 123
ExecStartPost=/sbin/ip route add local 0.0.0.0/0 dev lo table 123
ExecStart=/usr/local/bin/go-mmproxy -l 0.0.0.0:50021 -4 127.0.0.1:10022 -v 2
ExecStopPost=/sbin/ip rule del from 127.0.0.1/8 iif lo table 123
ExecStopPost=/sbin/ip route del local 0.0.0.0/0 dev lo table 123
Restart=on-failure
RestartSec=10s
[Install]
WantedBy=multi-user.target

View File

@ -1,12 +0,0 @@
[Unit]
Description=Grafana Promtail
Documentation=https://github.com/grafana/loki
After=network-online.target
[Service]
User=root
Restart=always
ExecStart=/usr/local/bin/promtail --config.file=/etc/promtail/gitea.yaml
[Install]
WantedBy=multi-user.target

View File

@ -1,29 +0,0 @@
# Download:
TMP = "/tmp/go-mmproxy"
execute "wget #{node['go-mmproxy']['bin_url']} -O #{TMP}" do
not_if "test -e #{node['go-mmproxy']['storage']}/go-mmproxy"
end
# Install:
directory node['go-mmproxy']['storage'] do
owner 'root'
group 'root'
mode '755'
end
execute "mv #{TMP} #{node['go-mmproxy']['storage']}/go-mmproxy" do
not_if "test -e #{node['go-mmproxy']['storage']}/go-mmproxy"
end
# Change Owner and Permissions:
file "#{node['go-mmproxy']['storage']}/go-mmproxy" do
owner 'root'
group 'root'
mode '755'
end
# Create Link
link "#{node['go-mmproxy']['location']}/go-mmproxy" do
to "#{node['go-mmproxy']['storage']}/go-mmproxy"
end

View File

@ -1,43 +0,0 @@
# Deploy `supervisord` config`:
remote_file '/etc/systemd/system/go-mmproxy.service' do
owner 'root'
group 'root'
mode '644'
notifies :restart, 'service[go-mmproxy]'
end
service 'go-mmproxy' do
action [ :enable, :restart ]
end
# Depoy `consul` service configuration for `gitea`:
remote_file '/etc/consul.d/service-go-mmproxy.json' do
owner 'consul'
group 'consul'
mode '644'
notifies :reload, 'service[consul]'
end
service 'consul' do
action :nothing
end
# Firewall settings here:
%w( 50021/tcp ).each do |p|
execute "ufw allow #{p}" do
user 'root'
not_if "LANG=c ufw status | grep #{p}"
notifies :run, 'execute[ufw reload-or-enable]'
end
end
execute 'ufw reload-or-enable' do
user 'root'
command 'LANG=C ufw reload | grep skipping && ufw --force enable || exit 0'
action :nothing
end

View File

@ -1,61 +0,0 @@
server:
disable: true
positions:
filename: /var/opt/promtail/promtail_gitea_position.yaml
clients:
- url: http://<%= @LOKIENDPOINT %>/loki/api/v1/push
scrape_configs:
- job_name: gitea
static_configs:
- targets:
- localhost
labels:
job: gitea
hostname: <%= @HOSTNAME %>
vhost: gitea.kazu634.com
__path__: /var/log/supervisor/gitea.log
pipeline_stages:
- match:
selector: '{job="gitea"}'
stages:
- drop:
expression: "(Static|robots.txt|sitemap.xml)"
- regex:
expression: '^\[Macaron\] (?P<timestamp>[0-9]+\-[0-9]+\-[0-9]+ +[0-9]+:[0-9]+:[0-9]+): (?P<message1>[^\/]+) (?P<uri>\/[^ ]*) (?P<response>[^ ]+) (?P<message2>.+)$'
- timestamp:
source: timestamp
format: 2006-01-02 15:04:05
location: Asia/Tokyo
- template:
source: message
template: '{{ .message1 }} {{ .uri }} ({{ .message2 }})'
- template:
source: level
template: '{{ .response }}'
- template:
source: level
template: '{{ regexReplaceAllLiteral "(2[0-9]+|3[0-9]+|for)" .Value "info" }}'
- template:
source: level
template: '{{ regexReplaceAllLiteral "4[0-9]+" .Value "warning" }}'
- template:
source: level
template: '{{ regexReplaceAllLiteral "5[0-9]+" .Value "error" }}'
- labels:
level:
- output:
source: message

View File

@ -10,3 +10,12 @@ groups:
summary: "Digdag is not running: {{ $labels.instance }}." summary: "Digdag is not running: {{ $labels.instance }}."
description: "Digdag is not running: {{ $labels.instance }}." description: "Digdag is not running: {{ $labels.instance }}."
- alert: go-mmproxy
expr: node_systemd_unit_state{name="go-mmproxy:w.service", state="active"} != 1
for: 5m
labels:
severity: error
annotations:
summary: "Digdag is not running: {{ $labels.instance }}."
description: "Digdag is not running: {{ $labels.instance }}."