Need some help for django-deployment

Hi folks,

I do have a little problem with the deployment of our django-app. Maybe
you guys (and girls) can help?

Its nothing fancy yet, just a postgresql (on a different machine) and
django served via wsgi on apache2.

The snipped below from our recipe does everything alright in
updating the source from the repo and deploying it. But the one thing
it doesn’t do is restarting the apache2. I tried adding notifies at
several places, I even did put an execute-block in after_restart but I
can’t get apache2 to restart when the deployment switched to a new
revision.

Do you have an idea?

Thanks in advance,

Arnold

Recipe snip:

application “ohf2” do
path root_dir
owner "www-data"
group “www-data”

scm_provider Chef::Provider::Subversion
svn_username ""
svn_password "“
repository
"https://development.bcs.bcs/svn/bcspackages/branches/ohf2alpha

migrate true

django do
packages [“pytz”, “django”, “django_extensions”, “django-mptt”,
“south”, “psycopg2”]
debug false
settings_template 'settings_local.py.erb’
local_settings_file “settings_local.py”

migration_command root_dir+"/shared/env/bin/python manage.py syncdb

–noinput && “+root_dir+”/shared/env/bin/python manage.py migrate
–delete-ghost-migrations --noinput &&
"+root_dir+"/shared/env/bin/python manage.py runscript
load_initial_data"
collectstatic true

database do
  database "ohf2alpha"¬ adapter "postgresql_psycopg2"
  username dbuser
  password dbpass
  host dbservername
end

end

after_restart do
notifies :restart, “service[apache2]”, :immediately
end
end

You'll want to spell that "run_context.resource_collection.find('service[apache2]').run_action(:reload)" I think.

--Noah

On Feb 15, 2013, at 12:54 PM, Arnold Krille wrote:

Hi folks,

I do have a little problem with the deployment of our django-app. Maybe
you guys (and girls) can help?

Its nothing fancy yet, just a postgresql (on a different machine) and
django served via wsgi on apache2.

The snipped below from our recipe does everything alright in
updating the source from the repo and deploying it. But the one thing
it doesn't do is restarting the apache2. I tried adding notifies at
several places, I even did put an execute-block in after_restart but I
can't get apache2 to restart when the deployment switched to a new
revision.

Do you have an idea?

Thanks in advance,

Arnold

Recipe snip:

application "ohf2" do
path root_dir
owner "www-data"
group "www-data"

scm_provider Chef::Provider::Subversion
svn_username ""
svn_password ""
repository
"https://development.bcs.bcs/svn/bcspackages/branches/ohf2alpha"

migrate true

django do
packages ["pytz", "django", "django_extensions", "django-mptt",
"south", "psycopg2"]
debug false
settings_template 'settings_local.py.erb'
local_settings_file "settings_local.py"

migration_command root_dir+"/shared/env/bin/python manage.py syncdb
--noinput && "+root_dir+"/shared/env/bin/python manage.py migrate
--delete-ghost-migrations --noinput &&
"+root_dir+"/shared/env/bin/python manage.py runscript
load_initial_data"
collectstatic true

database do
database "ohf2alpha"¬ adapter "postgresql_psycopg2"
username dbuser
password dbpass
host dbservername
end

end

after_restart do
notifies :restart, "service[apache2]", :immediately
end
end

On Fri, 15 Feb 2013 12:58:54 -0800 Noah Kantrowitz
noah@coderanger.net wrote:

You'll want to spell that
"run_context.resource_collection.find('service[apache2]').run_action(:reload)"
I think.

Thanks, I will try that on monday when the next revision-bump happens
for that alpha-release.

Somehow I have the feeling that my problem is related to the fact that
foodcritic complains about application_python not notifying of changes.
If it would, I could just connect that change-signal to the restart of
service[apache2], correct?

Have fun,

Arnold

On Feb 15, 2013, at 12:54 PM, Arnold Krille wrote:

Hi folks,

I do have a little problem with the deployment of our django-app.
Maybe you guys (and girls) can help?

Its nothing fancy yet, just a postgresql (on a different machine)
and django served via wsgi on apache2.

The snipped below from our recipe does everything alright in
updating the source from the repo and deploying it. But the one
thing it doesn't do is restarting the apache2. I tried adding
notifies at several places, I even did put an execute-block in
after_restart but I can't get apache2 to restart when the
deployment switched to a new revision.

Do you have an idea?

On Friday 15 February 2013 12:58:54 Noah Kantrowitz wrote:

You'll want to spell that
"run_context.resource_collection.find('service[apache2]').run_action(:reloa
d)" I think.

Hm, I put that into the after_restart block. But no success. apache2 refuses
to restart on re-deployment.

Any more ideas?

Arnold

Show logs
On 19/02/2013 6:21 AM, "Arnold Krille" arnold@arnoldarts.de wrote:

On Friday 15 February 2013 12:58:54 Noah Kantrowitz wrote:

You'll want to spell that

"run_context.resource_collection.find('service[apache2]').run_action(:reloa

d)" I think.

Hm, I put that into the after_restart block. But no success. apache2
refuses
to restart on re-deployment.

Any more ideas?

Arnold

Hi all,

I had to do some small config-changes in our web-app and took logs from the
chef-run applying these changes. Of course the apache didn't restart despite
changes in the deployment:-/

Attached are the logs and the recipe, hope it makes it to the list.

Any ideas?

Thanks in advance,

Arnold

On Tuesday 19 February 2013 08:24:59 AJ Christensen wrote:

Show logs

On 19/02/2013 6:21 AM, "Arnold Krille" arnold@arnoldarts.de wrote:

On Friday 15 February 2013 12:58:54 Noah Kantrowitz wrote:

You'll want to spell that

"run_context.resource_collection.find('service[apache2]').run_action(:relo
a

d)" I think.

Hm, I put that into the after_restart block. But no success. apache2
refuses
to restart on re-deployment.

Any more ideas?

Arnold