attempt to run celery without sudo

pull/1/head
Raymond Yee 2016-06-21 19:49:50 -07:00
parent 723c8e3ec8
commit f1ace96371
3 changed files with 28 additions and 15 deletions

View File

@ -21,4 +21,4 @@
#
# m h dom mon dow command
* * * * * cd /opt/regluit; . /opt/regluit/ENV/bin/activate; /opt/regluit/ENV/bin/django-admin.py emit_notices --settings=regluit.settings.please > /opt/regluit/deploy/emit_notices.log 2>&1 ; touch /opt/regluit/deploy/last-cron
@reboot sudo mkdir /var/run/celery; sudo chown celery:celery /var/log/celery /var/run/celery; sudo /etc/init.d/celeryd restart; sudo /etc/init.d/celerybeat restart;
@reboot sudo mkdir /var/run/celery; sudo chown celery:celery /var/log/celery /var/run/celery; /opt/regluit/ENV/bin/celery multi restart w1 --logfile="/var/log/celery/%n.log" --pidfile="/var/log/celery/%n.pid"; /etc/init.d/celerybeat restart;

2
vagrant/Vagrantfile vendored
View File

@ -30,7 +30,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
"-e class=please",
"-e hostname=please.unglue.it",
"-e setdns=true",
"-e branch=sysadmin"
"-e branch=nosudo_celery"
]
end

View File

@ -341,17 +341,21 @@
group=celery
generate_ssh_key=no
# sudo ("cp deploy/celeryd /etc/init.d/celeryd")
# sudo ("chmod 755 /etc/init.d/celeryd")
#sudo ("cp deploy/celeryd /etc/init.d/celeryd")
#sudo ("chmod 755 /etc/init.d/celeryd")
# put {{user}} into celery group
- name: add {{user}} to celery group
user: name={{user}} groups=celery append=yes
# still need?
- name: copy deploy/celeryd
command: cp /opt/regluit/deploy/celeryd /etc/init.d/celeryd
# still need?
- name: set mode on /etc/init.d/celeryd
file: path=/etc/init.d/celeryd mode=0755
# sudo ("cp deploy/celeryd.conf /etc/default/celeryd")
- name: copy deploy/celeryd.conf
command: cp "/opt/regluit/deploy/celeryd_{{class}}.conf" /etc/default/celeryd
@ -360,18 +364,22 @@
# sudo ("mkdir /var/log/celery")
- name: make /var/log/celery
file: path=/var/log/celery state=directory owner=celery group=celery mode=0755
file: path=/var/log/celery state=directory owner=celery group=celery mode=0775
# sudo ("mkdir /var/run/celery")
# sudo ("chown celery:celery /var/log/celery /var/run/celery")
- name: make /var/run/celery
file: path=/var/run/celery state=directory owner=celery group=celery mode=0755
file: path=/var/run/celery state=directory owner=celery group=celery mode=0775
# sudo ("/etc/init.d/celeryd start")
- name: start celeryd
command: /etc/init.d/celeryd start
# old way with root
# - name: start celeryd
# command: /etc/init.d/celeryd start
# celery multi
- name: celery multi
command: /opt/regluit/ENV/bin/celery multi restart w1 --logfile=\"/var/log/celery/%n.log\" --pidfile=\"/var/log/celery/%n.pid\"
# sudo ("cp deploy/celerybeat /etc/init.d/celerybeat")
# sudo ("chmod 755 /etc/init.d/celerybeat")
@ -379,27 +387,32 @@
- name: copy deploy/celerybeat
command: cp /opt/regluit/deploy/celerybeat /etc/init.d/celerybeat
sudo: no
- name: set mode on /etc/init.d/celerybeat
file: path=/etc/init.d/celerybeat mode=0755
file: path=/etc/init.d/celerybeat mode=0775
sudo: no
# sudo ("cp deploy/celerybeat.conf /etc/default/celerybeat")
- name: copy deploy/celerybeat,conf
command: cp "/opt/regluit/deploy/celerybeat_{{class}}.conf" /etc/default/celerybeat
sudo: no
- name: set mode on /etc/default/celerybeat
file: path=/etc/default/celerybeat mode=0755
file: path=/etc/default/celerybeat mode=0775
sudo: no
# sudo ("mkdir /var/log/celerybeat")
# sudo ("chown celery:celery /var/log/celerybeat")
- name: make /var/log/celerybeat
file: path=/var/log/celerybeat state=directory owner=celery group=celery mode=0755
file: path=/var/log/celerybeat state=directory owner=celery group=celery mode=0775
# sudo ("/etc/init.d/celerybeat start")
- name: start celerybeat
command: /etc/init.d/celerybeat start
sudo: no
# run data loading script
- name: run data loading script