Delete `wekan` cookbook.
This commit refs/fixes #delete-wekan.
This commit is contained in:
parent
32485e57bd
commit
86ec4f850a
|
@ -1,17 +0,0 @@
|
|||
# -------------------------------------------
|
||||
# Specifying the default settings:
|
||||
# -------------------------------------------
|
||||
cmd = 'LANG=C /sbin/ifconfig | grep "inet addr" | grep -v 127.0.0.1 | awk "{print $2;}" | cut -d: -f2 | cut -f 1 -d " " | tail -1'
|
||||
ipaddr = run_command(cmd).stdout.chomp
|
||||
|
||||
node.reverse_merge!({
|
||||
'nvm' => {
|
||||
'url_prefix' => 'https://raw.githubusercontent.com/creationix/nvm',
|
||||
'url_postfix' => 'install.sh',
|
||||
'node_version' => 'v8.11.2'
|
||||
},
|
||||
'wekan' => {
|
||||
'url' => 'https://releases.wekan.team',
|
||||
'ipaddr' => ipaddr
|
||||
}
|
||||
})
|
|
@ -1,10 +0,0 @@
|
|||
include_recipe './attributes.rb'
|
||||
|
||||
include_recipe './setup.rb'
|
||||
|
||||
include_recipe './nvm.rb'
|
||||
|
||||
include_recipe './mongodb'
|
||||
|
||||
include_recipe './wekan'
|
||||
|
|
@ -1 +0,0 @@
|
|||
deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"service": {
|
||||
"name": "wekan",
|
||||
"port": 3000
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
[program:wekan]
|
||||
command=/home/wekan/app/wekan.sh
|
||||
stdout_logfile=/var/log/supervisor/wekan.log
|
||||
redirect_stderr=true
|
||||
stdout_logfile_maxbytes=1MB
|
||||
stdout_logfile_backups=5
|
||||
autorestart=true
|
||||
user=wekan
|
|
@ -1,41 +0,0 @@
|
|||
execute 'apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927' do
|
||||
not_if 'apt-key list | grep EA312927'
|
||||
end
|
||||
|
||||
remote_file '/etc/apt/sources.list.d/mongodb-org.list' do
|
||||
user 'root'
|
||||
group 'root'
|
||||
end
|
||||
|
||||
execute 'apt update' do
|
||||
not_if "apt show mongodb-org | grep Installed"
|
||||
end
|
||||
|
||||
file '/etc/mongod.conf' do
|
||||
action :edit
|
||||
block do |content|
|
||||
content.gsub!(/127\.0\.0\.1/, node['wekan']['ipaddr'])
|
||||
end
|
||||
|
||||
notifies :restart, 'service[mongod]'
|
||||
|
||||
only_if 'grep 127.0.0.1 /etc/mongod.conf'
|
||||
end
|
||||
|
||||
package 'mongodb-org' do
|
||||
action :install
|
||||
end
|
||||
|
||||
service 'mongod' do
|
||||
action [ :enable, :start ]
|
||||
end
|
||||
|
||||
[
|
||||
'echo "mongodb-org hold" | dpkg --set-selections',
|
||||
'echo "mongodb-org-server hold" | dpkg --set-selections',
|
||||
'echo "mongodb-org-shell hold" | dpkg --set-selections',
|
||||
'echo "mongodb-org-mongos hold" | dpkg --set-selections',
|
||||
'echo "mongodb-org-tools hold" | dpkg --set-selections'
|
||||
].each do |cmd|
|
||||
execute cmd
|
||||
end
|
|
@ -1,38 +0,0 @@
|
|||
# Calculate the latest peco version:
|
||||
nvm_url = ''
|
||||
|
||||
begin
|
||||
require 'net/http'
|
||||
|
||||
uri = URI.parse('https://github.com/creationix/nvm/releases/latest')
|
||||
|
||||
Timeout.timeout(3) do
|
||||
response = Net::HTTP.get_response(uri)
|
||||
|
||||
vtag = $1 if response.body =~ %r{tag\/(v\d+\.\d+\.\d+)}
|
||||
|
||||
nvm_url = "#{node['nvm']['url_prefix']}/#{vtag}/#{node['nvm']['url_postfix']}"
|
||||
end
|
||||
rescue
|
||||
# Abort the chef client process:
|
||||
raise 'Cannot connect to http://github.com.'
|
||||
end
|
||||
|
||||
execute "wget -qO- #{nvm_url} | bash" do
|
||||
user 'wekan'
|
||||
cwd '/home/wekan'
|
||||
|
||||
not_if 'test -e /home/wekan/.nvm'
|
||||
end
|
||||
|
||||
ver = node['nvm']['node_version']
|
||||
|
||||
execute "su - wekan -c '. /home/wekan/.nvm/nvm.sh; nvm install #{ver}'" do
|
||||
cwd '/home/wekan'
|
||||
|
||||
not_if "test -e /home/wekan/.nvm/versions/node/#{ver}"
|
||||
end
|
||||
|
||||
execute "su - wekan -c '. /home/wekan/.nvm/nvm.sh; nvm use #{ver}'" do
|
||||
cwd '/home/wekan'
|
||||
end
|
|
@ -1,23 +0,0 @@
|
|||
# Create a user for managing `wekan`:
|
||||
user 'wekan' do
|
||||
home '/home/wekan'
|
||||
shell '/bin/bash'
|
||||
password '$6$saltsalt$OpVze2cUKNOKlStVplX0Rwi.W98E3y5kQ7Z22r6WHDEa3UIRovzVBUdv.ivlJAB1g9GRcdCAookz9f3PzZFDz0'
|
||||
create_home true
|
||||
end
|
||||
|
||||
# SSH
|
||||
directory '/home/wekan/.ssh' do
|
||||
owner 'wekan'
|
||||
group 'wekan'
|
||||
mode '700'
|
||||
end
|
||||
|
||||
# Deploy `~/.ssh/.ssh/authorized_keys`:
|
||||
encrypted_remote_file '/home/wekan/.ssh/authorized_keys' do
|
||||
owner 'wekan'
|
||||
group 'wekan'
|
||||
mode '600'
|
||||
source 'files/home/wekan/.ssh/authorized_keys'
|
||||
password ENV['ITAMAE_PASSWORD']
|
||||
end
|
|
@ -1,14 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
DIR=$(mktemp -d)
|
||||
DATE=$(date "+%Y%m%d")
|
||||
|
||||
mongodump -v --out "${DIR}" -h <%= @ipaddr %>
|
||||
|
||||
tar cvzf "/tmp/wekan-mongodb-bk-${DATE}.tgz" "${DIR}"
|
||||
|
||||
rm -rf "${DIR}"
|
||||
|
||||
exit 0
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
|
||||
export PORT=3000
|
||||
export ROOT_URL="https://wekan.kazu634.com"
|
||||
export MONGO_URL="mongodb://<%= @ipaddr %>:27017/wekan"
|
||||
|
||||
/home/wekan/.nvm/versions/node/<%= @node_ver %>/bin/node /home/wekan/app/wekan/bundle/main.js
|
|
@ -1,112 +0,0 @@
|
|||
# Calculate the latest peco version:
|
||||
wekan_url = ''
|
||||
vtag = ''
|
||||
|
||||
begin
|
||||
require 'net/http'
|
||||
|
||||
uri = URI.parse('https://github.com/wekan/wekan/releases/latest')
|
||||
|
||||
Timeout.timeout(3) do
|
||||
response = Net::HTTP.get_response(uri)
|
||||
|
||||
vtag = $1 if response.body =~ %r{tag\/v(\d+\.\d+)}
|
||||
|
||||
wekan_url = "#{node['wekan']['url']}/wekan-#{vtag}.tar.gz"
|
||||
end
|
||||
rescue
|
||||
# Abort the chef client process:
|
||||
raise 'Cannot connect to http://github.com.'
|
||||
end
|
||||
|
||||
directory '/home/wekan/app' do
|
||||
owner 'wekan'
|
||||
group 'wekan'
|
||||
|
||||
mode '755'
|
||||
end
|
||||
|
||||
app_dir = "/home/wekan/app/#{vtag}"
|
||||
directory app_dir do
|
||||
owner 'wekan'
|
||||
group 'wekan'
|
||||
|
||||
mode '755'
|
||||
end
|
||||
|
||||
tmp = "/tmp/wekan-#{vtag}.tar.gz"
|
||||
execute "wget #{wekan_url} -O #{tmp}" do
|
||||
not_if "test -e #{app_dir}/bundle"
|
||||
end
|
||||
|
||||
execute "tar xvzf #{tmp} -C /home/wekan/app/#{vtag}" do
|
||||
user 'wekan'
|
||||
|
||||
not_if "test -e #{app_dir}/bundle"
|
||||
end
|
||||
|
||||
template '/home/wekan/app/wekan.sh' do
|
||||
action :create
|
||||
owner 'wekan'
|
||||
group 'wekan'
|
||||
mode '744'
|
||||
|
||||
variables(ipaddr: node['wekan']['ipaddr'], node_ver: node['nvm']['node_version'])
|
||||
|
||||
notifies :restart, 'service[supervisor]'
|
||||
end
|
||||
|
||||
template '/home/wekan/app/mongodb-backup.sh' do
|
||||
action :create
|
||||
owner 'wekan'
|
||||
group 'wekan'
|
||||
mode '744'
|
||||
|
||||
variables(ipaddr: node['wekan']['ipaddr'])
|
||||
end
|
||||
|
||||
link '/home/wekan/app/wekan' do
|
||||
to app_dir
|
||||
user 'wekan'
|
||||
force true
|
||||
end
|
||||
|
||||
# Deploy the `supervisord` configuration:
|
||||
remote_file '/etc/supervisor/conf.d/wekan.conf' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '644'
|
||||
|
||||
notifies :restart, 'service[supervisor]'
|
||||
end
|
||||
|
||||
# Deploy the `conusl` service file:
|
||||
remote_file '/etc/consul.d/service-wekan.json' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '644'
|
||||
|
||||
notifies :restart, 'service[supervisor]'
|
||||
end
|
||||
|
||||
service 'supervisor' do
|
||||
action :nothing
|
||||
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