Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgon committed Dec 7, 2020
1 parent a84d6a4 commit 54fbea6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
48 changes: 24 additions & 24 deletions spec/unit/recipes/configure_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -400,16 +400,16 @@
expect(chef_run_rhel)
.to render_file("/etc/monit.d/unicorn_#{aws_opsworks_app['shortname']}.monitrc")
.with_content(
'start program = "/bin/su - deploy -c \'cd /srv/www/dummy_project/current && ENV_VAR1="test" ' \
'start program = "/bin/sh -c \'cd /srv/www/dummy_project/current && ENV_VAR1="test" ' \
'ENV_VAR2="some data" RAILS_ENV="staging" HOME="/home/deploy" USER="deploy" bundle exec unicorn_rails ' \
'--env staging -c /srv/www/dummy_project/shared/config/unicorn.conf ' \
'| logger -t unicorn-dummy_project\'" with timeout 90 seconds'
'| logger -t unicorn-dummy_project\'" as uid "deploy" and gid "deploy" with timeout 90 seconds'
)
expect(chef_run_rhel)
.to render_file("/etc/monit.d/unicorn_#{aws_opsworks_app['shortname']}.monitrc")
.with_content(
'stop program = "/bin/su - deploy -c \'cat /run/lock/dummy_project/unicorn.pid ' \
'| xargs --no-run-if-empty kill -QUIT; sleep 5\'"'
'stop program = "/bin/sh -c \'cat /run/lock/dummy_project/unicorn.pid ' \
'| xargs --no-run-if-empty kill -QUIT; sleep 5\'" as uid "deploy" and gid "deploy"'
)
expect(chef_run_rhel)
.to render_file("/etc/monit.d/unicorn_#{aws_opsworks_app['shortname']}.monitrc")
Expand Down Expand Up @@ -472,16 +472,16 @@
expect(chef_run)
.to render_file("/etc/monit/conf.d/unicorn_#{aws_opsworks_app['shortname']}.monitrc")
.with_content(
'start program = "/bin/su - deploy -c \'cd /srv/www/dummy_project/current && ENV_VAR1="test" ' \
'start program = "/bin/sh -c \'cd /srv/www/dummy_project/current && ENV_VAR1="test" ' \
'ENV_VAR2="some data" RAILS_ENV="staging" HOME="/home/deploy" USER="deploy" bundle exec unicorn_rails ' \
'--env staging -c /srv/www/dummy_project/shared/config/unicorn.conf ' \
'| logger -t unicorn-dummy_project\'" with timeout 90 seconds'
'| logger -t unicorn-dummy_project\'" as uid "deploy" and gid "deploy" with timeout 90 seconds'
)
expect(chef_run)
.to render_file("/etc/monit/conf.d/unicorn_#{aws_opsworks_app['shortname']}.monitrc")
.with_content(
'stop program = "/bin/su - deploy -c \'cat /run/lock/dummy_project/unicorn.pid ' \
'| xargs --no-run-if-empty kill -QUIT; sleep 5\'"'
'stop program = "/bin/sh -c \'cat /run/lock/dummy_project/unicorn.pid ' \
'| xargs --no-run-if-empty kill -QUIT; sleep 5\'" as uid "deploy" and gid "deploy"'
)
expect(chef_run)
.to render_file("/etc/monit/conf.d/unicorn_#{aws_opsworks_app['shortname']}.monitrc")
Expand Down Expand Up @@ -745,18 +745,18 @@
expect(chef_run)
.to render_file("/etc/monit/conf.d/puma_#{aws_opsworks_app['shortname']}.monitrc")
.with_content(
'start program = "/bin/su - deploy -c \'cd /srv/www/dummy_project/current && ENV_VAR1="test" ' \
'start program = "/bin/sh -c \'cd /srv/www/dummy_project/current && ENV_VAR1="test" ' \
'ENV_VAR2="some data" HANAMI_ENV="staging" DATABASE_URL="mysql2://dbuser:03c1bc98cdd5eb2f9c75@' \
'dummy-project.c298jfowejf.us-west-2.rds.amazon.com:3265/dummydb" ' \
'HOME="/home/deploy" USER="deploy" bundle exec puma ' \
'-C /srv/www/dummy_project/shared/config/puma.rb ' \
'| logger -t puma-dummy_project\'" with timeout 90 seconds'
'| logger -t puma-dummy_project\'" as uid "deploy" and gid "deploy" with timeout 90 seconds'
)
expect(chef_run)
.to render_file("/etc/monit/conf.d/puma_#{aws_opsworks_app['shortname']}.monitrc")
.with_content(
'stop program = "/bin/su - deploy -c \'cat /run/lock/dummy_project/puma.pid ' \
'| xargs --no-run-if-empty kill -QUIT; sleep 5\'"'
'stop program = "/bin/sh -c \'cat /run/lock/dummy_project/puma.pid ' \
'| xargs --no-run-if-empty kill -QUIT; sleep 5\'" as uid "deploy" and gid "deploy"'
)
expect(chef_run)
.to render_file("/etc/monit/conf.d/puma_#{aws_opsworks_app['shortname']}.monitrc")
Expand Down Expand Up @@ -854,18 +854,18 @@
expect(chef_run_rhel)
.to render_file("/etc/monit.d/puma_#{aws_opsworks_app['shortname']}.monitrc")
.with_content(
'start program = "/bin/su - deploy -c \'cd /srv/www/dummy_project/current && ENV_VAR1="test" ' \
'start program = "/bin/sh -c \'cd /srv/www/dummy_project/current && ENV_VAR1="test" ' \
'ENV_VAR2="some data" HANAMI_ENV="staging" DATABASE_URL="mysql2://dbuser:03c1bc98cdd5eb2f9c75@' \
'dummy-project.c298jfowejf.us-west-2.rds.amazon.com:3265/dummydb" ' \
'HOME="/home/deploy" USER="deploy" bundle exec puma ' \
'-C /srv/www/dummy_project/shared/config/puma.rb ' \
'| logger -t puma-dummy_project\'" with timeout 90 seconds'
'| logger -t puma-dummy_project\'" as uid "deploy" and gid "deploy" with timeout 90 seconds'
)
expect(chef_run_rhel)
.to render_file("/etc/monit.d/puma_#{aws_opsworks_app['shortname']}.monitrc")
.with_content(
'stop program = "/bin/su - deploy -c \'cat /run/lock/dummy_project/puma.pid ' \
'| xargs --no-run-if-empty kill -QUIT; sleep 5\'"'
'stop program = "/bin/sh -c \'cat /run/lock/dummy_project/puma.pid ' \
'| xargs --no-run-if-empty kill -QUIT; sleep 5\'" as uid "deploy" and gid "deploy"'
)
expect(chef_run_rhel)
.to render_file("/etc/monit.d/puma_#{aws_opsworks_app['shortname']}.monitrc")
Expand Down Expand Up @@ -1169,18 +1169,18 @@
expect(chef_run)
.to render_file("/etc/monit/conf.d/thin_#{aws_opsworks_app['shortname']}.monitrc")
.with_content(
'start program = "/bin/su - deploy -c \'cd /srv/www/dummy_project/current && ENV_VAR1="test" ' \
'start program = "/bin/sh -c \'cd /srv/www/dummy_project/current && ENV_VAR1="test" ' \
'ENV_VAR2="some data" RACK_ENV="staging" ' \
'DATABASE_URL="sqlite:///srv/www/dummy_project/shared/db/data.sqlite3" ' \
'HOME="/home/deploy" USER="deploy" bundle exec thin ' \
'-C /srv/www/dummy_project/shared/config/thin.yml start ' \
'| logger -t thin-dummy_project\'" with timeout 90 seconds'
'| logger -t thin-dummy_project\'" as uid "deploy" and gid "deploy" with timeout 90 seconds'
)
expect(chef_run)
.to render_file("/etc/monit/conf.d/thin_#{aws_opsworks_app['shortname']}.monitrc")
.with_content(
'stop program = "/bin/su - deploy -c \'cat /run/lock/dummy_project/thin.pid ' \
'| xargs --no-run-if-empty kill -QUIT; sleep 5\'"'
'stop program = "/bin/sh -c \'cat /run/lock/dummy_project/thin.pid ' \
'| xargs --no-run-if-empty kill -QUIT; sleep 5\'" as uid "deploy" and gid "deploy"'
)
expect(chef_run)
.to render_file("/etc/monit/conf.d/thin_#{aws_opsworks_app['shortname']}.monitrc")
Expand Down Expand Up @@ -1252,18 +1252,18 @@
expect(chef_run_rhel)
.to render_file("/etc/monit.d/thin_#{aws_opsworks_app['shortname']}.monitrc")
.with_content(
'start program = "/bin/su - deploy -c \'cd /srv/www/dummy_project/current && ENV_VAR1="test" ' \
'start program = "/bin/sh -c \'cd /srv/www/dummy_project/current && ENV_VAR1="test" ' \
'ENV_VAR2="some data" RACK_ENV="staging" ' \
'DATABASE_URL="sqlite:///srv/www/dummy_project/shared/db/data.sqlite3" ' \
'HOME="/home/deploy" USER="deploy" bundle exec thin ' \
'-C /srv/www/dummy_project/shared/config/thin.yml start ' \
'| logger -t thin-dummy_project\'" with timeout 90 seconds'
'| logger -t thin-dummy_project\'" as uid "deploy" and gid "deploy" with timeout 90 seconds'
)
expect(chef_run_rhel)
.to render_file("/etc/monit.d/thin_#{aws_opsworks_app['shortname']}.monitrc")
.with_content(
'stop program = "/bin/su - deploy -c \'cat /run/lock/dummy_project/thin.pid ' \
'| xargs --no-run-if-empty kill -QUIT; sleep 5\'"'
'stop program = "/bin/sh -c \'cat /run/lock/dummy_project/thin.pid ' \
'| xargs --no-run-if-empty kill -QUIT; sleep 5\'" as uid "deploy" and gid "deploy"'
)
expect(chef_run_rhel)
.to render_file("/etc/monit.d/thin_#{aws_opsworks_app['shortname']}.monitrc")
Expand Down
4 changes: 2 additions & 2 deletions templates/default/appserver.monitrc.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% pid_dir = "/run/lock/#{@app_shortname}/" %>

check process <%= @appserver_name %>_<%= @app_shortname %> with pidfile <%= pid_dir %><%= @appserver_name %>.pid
start program = "/bin/su - <%= node['deployer']['user'] %> -c 'cd <%= File.join(@deploy_to, 'current') %> && <%= @environment.map {|k,v| "#{k}=\"#{v}\""}.join(' ') %> <%= @appserver_command %> | logger -t <%= @appserver_name %>-<%= @app_shortname %>'" with timeout 90 seconds
stop program = "/bin/su - <%= node['deployer']['user'] %> -c 'cat <%= pid_dir %><%= @appserver_name %>.pid | xargs --no-run-if-empty kill -QUIT; sleep 5'"
start program = "/bin/sh -c 'cd <%= File.join(@deploy_to, 'current') %> && <%= @environment.map {|k,v| "#{k}=\"#{v}\""}.join(' ') %> <%= @appserver_command %> | logger -t <%= @appserver_name %>-<%= @app_shortname %>'" as uid "<%= node['deployer']['user'] %>" and gid "<%= node['deployer']['group'] %>" with timeout 90 seconds
stop program = "/bin/sh -c 'cat <%= pid_dir %><%= @appserver_name %>.pid | xargs --no-run-if-empty kill -QUIT; sleep 5'" as uid "<%= node['deployer']['user'] %>" and gid "<%= node['deployer']['group'] %>"
group <%= @appserver_name %>_<%= @app_shortname.to_s %>_group

0 comments on commit 54fbea6

Please sign in to comment.