Run sockethub as its own user

This commit is contained in:
Greg Karékinian 2017-04-28 12:01:07 +02:00
parent 8ba12e1ba2
commit c9879a60e2

View File

@ -2,26 +2,41 @@
# Cookbook Name:: sockethub # Cookbook Name:: sockethub
# Recipe:: default # Recipe:: default
# #
# Copyright 2015, Kosmos # Copyright 2015-2017, Kosmos
# #
# All rights reserved - Do Not Redistribute # All rights reserved - Do Not Redistribute
# #
include_recipe 'kosmos-nodejs' include_recipe 'kosmos-nodejs'
include_recipe 'kosmos-redis' include_recipe 'kosmos-redis'
package "git"
group "sockethub" do
gid 7625
end
user "sockethub" do
comment "sockethub user"
uid 7625
gid 7625
manage_home true
shell "/bin/bash"
end
path_to_deploy = "/opt/sockethub" path_to_deploy = "/opt/sockethub"
application path_to_deploy do application path_to_deploy do
owner "www-data" owner "sockethub"
group "www-data" group "sockethub"
git do git do
user "sockethub"
group "sockethub"
repository 'https://github.com/sockethub/sockethub.git' repository 'https://github.com/sockethub/sockethub.git'
revision 'v1.0.5' revision 'v1.0.5'
end end
npm_install npm_install do
user "sockethub"
end
execute "systemctl daemon-reload" do execute "systemctl daemon-reload" do
command "systemctl daemon-reload" command "systemctl daemon-reload"
@ -34,8 +49,8 @@ application path_to_deploy do
group 'root' group 'root'
mode '0644' mode '0644'
variables( variables(
:user => owner, :user => "sockethub",
:group => group, :group => "sockethub",
:app_dir => path_to_deploy, :app_dir => path_to_deploy,
:entry => "/usr/local/bin/node /usr/local/bin/npm start", :entry => "/usr/local/bin/node /usr/local/bin/npm start",
:environment => { 'DEBUG' => '*', :environment => { 'DEBUG' => '*',