Do not install `gitea`.
This commit is contained in:
parent
d42b428427
commit
ba41bd9fe1
|
@ -2,9 +2,7 @@
|
|||
include_recipe './attributes.rb'
|
||||
|
||||
# Install:
|
||||
include_recipe './install.rb'
|
||||
include_recipe './install-go-mmproxy.rb'
|
||||
|
||||
# Setup:
|
||||
include_recipe './setup.rb'
|
||||
include_recipe './setup-go-mmproxy.rb'
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
gitea_url = ''
|
||||
gitea_bin = ''
|
||||
|
||||
vtag = ''
|
||||
tag = ''
|
||||
|
||||
# Calculate the Download URL:
|
||||
begin
|
||||
require 'net/http'
|
||||
|
||||
uri = URI.parse('https://github.com/go-gitea/gitea/releases/latest')
|
||||
|
||||
Timeout.timeout(3) do
|
||||
response = Net::HTTP.get_response(uri)
|
||||
|
||||
vtag = $1 if response['location'] =~ %r{tag\/(v\d+\.\d+\.\d+)}
|
||||
tag = vtag.sub(/^v/, '')
|
||||
|
||||
gitea_bin = "#{node['gitea']['prefix']}#{tag}#{node['gitea']['postfix']}"
|
||||
gitea_url = "#{node['gitea']['url']}/#{vtag}/#{gitea_bin}"
|
||||
end
|
||||
rescue
|
||||
# Abort the chef client process:
|
||||
raise 'Cannot connect to http://github.com.'
|
||||
end
|
||||
|
||||
# バージョン確認して、アップデート必要かどうか確認
|
||||
result = run_command("gitea --version 2>&1 | grep #{tag}", error: false)
|
||||
if result.exit_status != 0
|
||||
# Download:
|
||||
TMP = "/tmp/#{gitea_bin}"
|
||||
|
||||
execute "wget #{gitea_url} -O #{TMP}"
|
||||
|
||||
# Install:
|
||||
directory node['gitea']['storage'] do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '755'
|
||||
end
|
||||
|
||||
execute "mv #{TMP} #{node['gitea']['storage']}/gitea"
|
||||
|
||||
# Change Owner and Permissions:
|
||||
file "#{node['gitea']['storage']}/gitea" do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '755'
|
||||
end
|
||||
|
||||
# Create Link
|
||||
link "#{node['gitea']['location']}/gitea" do
|
||||
to "#{node['gitea']['storage']}/gitea"
|
||||
end
|
||||
end
|
|
@ -1,135 +0,0 @@
|
|||
# Create `git` user:
|
||||
user 'git' do
|
||||
create_home true
|
||||
home '/home/git/'
|
||||
|
||||
system_user true
|
||||
|
||||
shell '/bin/bash'
|
||||
end
|
||||
|
||||
directory '/home/git/.ssh/' do
|
||||
owner 'git'
|
||||
group 'git'
|
||||
mode '0700'
|
||||
end
|
||||
|
||||
remote_file '/home/git/.ssh/authorized_keys' do
|
||||
owner 'git'
|
||||
group 'git'
|
||||
mode '0600'
|
||||
end
|
||||
|
||||
# Create `/etc/gitea/`:
|
||||
%w(/etc/gitea).each do |d|
|
||||
directory d do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0755'
|
||||
end
|
||||
end
|
||||
|
||||
%w(/var/lib/git /var/lib/gitea).each do |d|
|
||||
directory d do
|
||||
owner 'git'
|
||||
group 'git'
|
||||
mode '0755'
|
||||
end
|
||||
end
|
||||
|
||||
execute 'rsync -vrz --delete admin@192.168.10.200:/volume1/Shared/AppData/gitea/gitea-data/ /var/lib/gitea/' do
|
||||
not_if 'test -e /var/lib/gitea/log'
|
||||
end
|
||||
|
||||
execute 'rsync -vrz --delete admin@192.168.10.200:/volume1/Shared/AppData/gitea/git/ /var/lib/git/' do
|
||||
not_if 'test -e /var/lib/git/kazu634/'
|
||||
end
|
||||
|
||||
execute 'chown -R git:git /var/lib/gitea/'
|
||||
execute 'chown -R git:git /var/lib/git/'
|
||||
|
||||
# Deploy `app.ini`:
|
||||
remote_file '/etc/gitea/app.ini' do
|
||||
owner 'git'
|
||||
group 'git'
|
||||
mode '644'
|
||||
end
|
||||
|
||||
# Deploy `supervisord` config`:
|
||||
remote_file '/etc/supervisor/conf.d/gitea.conf' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '644'
|
||||
|
||||
notifies :restart, 'service[supervisor]'
|
||||
end
|
||||
|
||||
service 'supervisor' do
|
||||
action :nothing
|
||||
end
|
||||
|
||||
# Depoy `consul` service configuration for `gitea`:
|
||||
remote_file '/etc/consul.d/service-gitea.json' do
|
||||
owner 'consul'
|
||||
group 'consul'
|
||||
mode '644'
|
||||
|
||||
notifies :reload, 'service[consul]'
|
||||
end
|
||||
|
||||
service 'consul' do
|
||||
action :nothing
|
||||
end
|
||||
|
||||
# Depoy `promtail` configuration for `gitea`:
|
||||
template '/etc/promtail/gitea.yaml' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '644'
|
||||
|
||||
variables(HOSTNAME: node[:hostname], LOKIENDPOINT: node['promtail']['lokiendpoint'])
|
||||
|
||||
notifies :restart, 'service[promtail-gitea]'
|
||||
end
|
||||
|
||||
# Deploy `systemd` configuration for `promtail-gitea`:
|
||||
remote_file '/etc/systemd/system/promtail-gitea.service' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '644'
|
||||
end
|
||||
|
||||
# Service setting:
|
||||
service 'promtail-gitea' do
|
||||
action [ :enable, :restart ]
|
||||
end
|
||||
|
||||
# Deploy `systemd` configuration for `promtail-gitea`:
|
||||
remote_file '/etc/lsyncd/lsyncd.conf.lua' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '644'
|
||||
end
|
||||
|
||||
# Service setting:
|
||||
service 'lsyncd' do
|
||||
action [ :enable, :restart ]
|
||||
end
|
||||
|
||||
# Firewall settings here:
|
||||
%w( 3000/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
|
Loading…
Reference in New Issue