シェフのレシピで次のシェルコマンドを変換するにはどうすればよいですか?

StackOverflow https://stackoverflow.com/questions/8389972

  •  28-10-2019
  •  | 
  •  

質問

シェフのレシピで次のシェルコマンドを変換するにはどうすればよいですか?

インストール

sudo easy_install pygments
sudo echo 'export RAILS_ENV=production' >> ~/.bash_profile
sudo adduser --system --shell /bin/sh --gecos 'git version control' --group --disabled-password --home /home/git git
ssh-keygen -t rsa
sudo -H -u git gitosis-init < ~/.ssh/id_rsa.pub
sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update

echo "gem: --no-rdoc --no-ri" > ~/.gemrc
rvmsudo gem install passenger
rvmsudo passenger-install-nginx-module

nginxの新興ファイルを作成します

sudo vim /etc/init/nginx.conf

description "Nginx HTTP Server"

start on filesystem
stop on runlevel [!2345]

respawn

exec /opt/nginx/sbin/nginx -g "daemon off;"

VMを再起動します

sudo shutdown -r now

nginxの実行を確認します

sudo initctl list | grep nginx
役に立ちましたか?

解決

これは必ずしもこれを行うのに最適な方法ではありませんが、機能するはずです(テストしていないことに注意してください)。

料理本のメタデータで、まずこれを確認してください。

depends "python"

その後、あなたのレシピは次のようになります:

pip_package "pygments"

execute "echo 'export RAILS_ENV=production' >> ~/.bash_profile" do
  not_if "grep RAILS_ENV ~/.bash_profile"
end

user "git" do
  system True
end

execute "ssh-keygen -N '' -f ~/.ssh/id_rsa"
  user "git"
  not_if "test -f /home/git/.ssh/id_rsa"
end

execute "gitosis-init < ~/.ssh/id_rsa.pub && chmod 755 ~/repositories/gitosis-admin.git/hooks/postupdate"
  #not sure how do check if this has been run, maybe this is right:
  not_if "test -f /home/git/repositories/gitosis-admin.git/hooks/post-update"
end

gem_package "passenger" do
  action :install
end

#Instead of creating your own upstart service, why not use the stock nginx config.
include_recipe "nginx"

execute "passenger-install-nginx-module" do
  #I'm not familiar with this, so I don't know how to check if it's already been run.
  notifies :restart, "service[nginx]"
end

この情報のほとんどは、シェフのドキュメントからかなりアクセスできるはずです。ところで。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top