Skip to content

Commit

Permalink
add celery to junction node
Browse files Browse the repository at this point in the history
for issue #15
  • Loading branch information
vigneshsarma committed May 24, 2017
1 parent 3b7d3df commit e6edade
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 3 deletions.
14 changes: 12 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,32 @@ Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.synced_folder "salt/roots/", "/srv/salt/"
config.vm.synced_folder "pillar/", "/srv/pillar/"
config.vm.network "forwarded_port", guest: 80, host: 8080

config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024", "--cpus", "2"]
end

config.vm.define "pycon" do |machine|
machine.vm.network "forwarded_port", guest: 80, host: 8081
machine.vm.hostname = "in.pycon.org"
end

config.vm.define "pycon-new" do |machine|
config.vm.box = "ubuntu/xenial64"
machine.vm.network "forwarded_port", guest: 80, host: 8083
machine.vm.hostname = "in.pycon.org"
end

config.vm.define "wye" do |machine|
machine.vm.network "forwarded_port", guest: 80, host: 8082
machine.vm.hostname = "pythonexpress.in"
end

config.vm.provision "shell",
inline: "curl -L https://bootstrap.saltstack.com | sudo sh -s -- stable"
inline: "curl -L https://bootstrap.saltstack.com | sudo sh -s -- -X stable"
config.vm.provision "shell",
inline: "salt-call --local state.highstate -l debug --no-color"

config.vm.provider "virtualbox"
config.vm.provider "vmware_fusion"
end
5 changes: 4 additions & 1 deletion pillar/junction.sls
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ junction:
revs:
junction: master
pycon2015: master
host: pycon.local.org:8000
host: pycon.local.org:8080
google_analytics_id: UA-XXXXXXX-1
qr_codes_dir: /opt/junction/qr_codes/
explara_api_token: abcd

service:
name: junction
26 changes: 26 additions & 0 deletions salt/roots/junction/celery.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{% set name = pillar['service']['name'] %}

broker:
pkg.installed:
- names:
- redis-server

/etc/init/{{name}}_celery.conf:
file.managed:
- source: salt://junction/files/celery.conf.j2
- template: jinja
- defaults:
name: "{{name}}"
- user: app

{{name}}_celery:
service.running:
- enable: True
- require:
- pkg: broker
- file: /etc/init/{{name}}_celery.conf
- cmd: migrate_{{name}}
- watch:
- file: /etc/init/{{name}}_celery.conf
- file: /opt/{{name}}/settings/prod.py
- git: {{name}}_code
19 changes: 19 additions & 0 deletions salt/roots/junction/files/celery.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# /usr/lib/systemd/system/{{name}}_celery.service
[Unit]
Description=Celery for {{name}} application service
After=syslog.target
After=network.target

[Service]
User=app
Type=forking
EnvironmentFile='DJANGO_SETTINGS_MODULE="settings"' 'SITE_NAME="{{name}} Celery"' 'LANG="en_US.UTF-8"'
ExecStart=/opt/envs/{{name}}/bin/python --ini /opt/{{name}}//manage.py celery worker -B
Restart=on-failure
Type=notify
StandardError=syslog
TimeoutSec=3000
NotifyAccess=all

[Install]
WantedBy=multi-user.target
1 change: 1 addition & 0 deletions salt/roots/junction/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@
include:
- junction/service
- junction/celery
1 change: 1 addition & 0 deletions salt/roots/junction/service.sls
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

junction:
service.running:
- enable: True
- require:
- file: /etc/systemd/system/junction.service
- file: /etc/uwsgi/junction.ini
Expand Down

0 comments on commit e6edade

Please sign in to comment.