diff --git a/Vagrantfile b/Vagrantfile index 77cd737..ca6c9c9 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -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 diff --git a/pillar/junction.sls b/pillar/junction.sls index 4f8b101..3d78bfd 100644 --- a/pillar/junction.sls +++ b/pillar/junction.sls @@ -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 diff --git a/salt/roots/junction/celery.sls b/salt/roots/junction/celery.sls new file mode 100644 index 0000000..5c21437 --- /dev/null +++ b/salt/roots/junction/celery.sls @@ -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 diff --git a/salt/roots/junction/files/celery.conf.j2 b/salt/roots/junction/files/celery.conf.j2 new file mode 100644 index 0000000..b9fbae4 --- /dev/null +++ b/salt/roots/junction/files/celery.conf.j2 @@ -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 diff --git a/salt/roots/junction/init.sls b/salt/roots/junction/init.sls index 84c3cdc..d2d2fa8 100644 --- a/salt/roots/junction/init.sls +++ b/salt/roots/junction/init.sls @@ -34,3 +34,4 @@ include: - junction/service + - junction/celery diff --git a/salt/roots/junction/service.sls b/salt/roots/junction/service.sls index ac4f601..be4f159 100644 --- a/salt/roots/junction/service.sls +++ b/salt/roots/junction/service.sls @@ -5,6 +5,7 @@ junction: service.running: + - enable: True - require: - file: /etc/systemd/system/junction.service - file: /etc/uwsgi/junction.ini