Permalink
Browse files

Prepping for Heroku.

  • Loading branch information...
nicksergeant committed Nov 1, 2016
1 parent 4565dac commit 909112b4bca68a23f316151ba7d24c7a048dea87
View
@@ -1 +1 @@
-web: gunicorn wsgi:application --log-file -
+web: gunicorn wsgi --log-file -
View
@@ -1,18 +0,0 @@
-env_name: production
-hostname: snipt.net
-deploy_user: deploy
-
-users:
- -
- name: deploy
- groups:
- - deploy
- - wheel
- -
- name: nick
- groups:
- - deploy
- - wheel
-
-ssh:
- port: 55555
View
@@ -1,5 +0,0 @@
-base:
- '*':
- - production
- 'local.snipt.net':
- - vagrant
View
@@ -1,13 +0,0 @@
-env_name: vagrant
-hostname: local.snipt.net
-deploy_user: vagrant
-
-users:
- -
- name: vagrant
- groups:
- - deploy
- - wheel
-
-ssh:
- port: 22
View
@@ -29,3 +29,4 @@ six==1.9.0
smartypants==1.8.6
stripe==1.41.1
urllib3==1.11
+whitenoise==3.2.2
View
@@ -1,85 +0,0 @@
-python-virtualenv:
- pkg.installed
-
-virtualenvwrapper:
- pip.installed
-
-/var/www:
- file.directory:
- - user: {{ pillar.deploy_user }}
- - group: deploy
- - mode: 775
- - require:
- - user: {{ pillar.deploy_user }}
- - group: deploy
-
-/var/www/.virtualenvs:
- file.directory:
- - user: {{ pillar.deploy_user }}
- - group: deploy
- - mode: 775
- - require:
- - group: deploy
-
-{% if pillar.env_name != 'vagrant' %}
-
-/var/www/snipt:
- file.directory:
- - user: {{ pillar.deploy_user }}
- - group: deploy
- - mode: 775
- - require:
- - group: deploy
-
- git.latest:
- - name: https://github.com/nicksergeant/snipt.git
- - rev: master
- - target: /var/www/snipt
- - user: deploy
-
-{% endif %}
-
-/var/www/.virtualenvs/snipt:
- file.directory:
- - user: {{ pillar.deploy_user }}
- - group: deploy
- - mode: 775
- - require:
- - group: deploy
- virtualenv.managed:
- - system_site_packages: False
- - requirements: /var/www/snipt/requirements.txt
-
-/home/{{ pillar.deploy_user }}/tmp:
- file.absent
-
-/etc/supervisor/conf.d/snipt.conf:
- file.managed:
- - source: salt://application/snipt.supervisor.conf
- - template: jinja
- - makedirs: True
- cmd.run:
- - name: supervisorctl restart snipt
-
-snipt-site:
- file.managed:
- - name: /etc/nginx/sites-available/snipt
- - source: salt://application/snipt.nginx.conf
- - template: jinja
- - group: deploy
- - mode: 755
- - require:
- - pkg: nginx-extras
- - group: deploy
-
-enable-snipt-site:
- file.symlink:
- - name: /etc/nginx/sites-enabled/snipt
- - target: /etc/nginx/sites-available/snipt
- - force: false
- - require:
- - pkg: nginx-extras
- cmd.run:
- - name: service nginx restart
- - require:
- - pkg: nginx-extras
@@ -1,131 +0,0 @@
-upstream backend_snipt {
- server 127.0.0.1:8000;
-}
-{% if pillar.env_name != 'vagrant' %}
- server {
- listen 80;
- server_name *.{{ pillar.hostname }};
-
- if ($host ~* "^([^.]+(\.[^.]+)*)\.{{ pillar.hostname }}$"){
- set $subd $1;
- rewrite ^(.*)$ https://$subd.{{ pillar.hostname }}$1 permanent;
- break;
- }
- }
- server {
- listen 80;
- server_name {{ pillar.hostname }} www.{{ pillar.hostname }} beta.{{ pillar.hostname }};
- rewrite ^(.*) https://{{ pillar.hostname }}$1 permanent;
- }
- server {
- listen 443;
- server_name www.{{ pillar.hostname }};
-
- ssl on;
- ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
- ssl_prefer_server_ciphers on;
- ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !RC4";
- ssl_certificate /etc/certs/{{ pillar.hostname }}.crt;
- ssl_certificate_key /etc/certs/{{ pillar.hostname }}.key;
-
- rewrite ^(.*) https://{{ pillar.hostname }}$1 permanent;
- }
- server {
- listen 443;
- server_name {{ pillar.hostname }} *.{{ pillar.hostname }};
-
- ssl on;
- ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
- ssl_prefer_server_ciphers on;
- ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !RC4";
- ssl_certificate /etc/certs/{{ pillar.hostname }}.crt;
- ssl_certificate_key /etc/certs/{{ pillar.hostname }}.key;
-
- location ~* /favicon.ico {
- root /var/www/snipt/static/img/;
- expires max;
- }
-
- location / {
-
- # Open CORS config from https://gist.github.com/michiel/1064640.
- if ($request_method = 'OPTIONS') {
- add_header 'Access-Control-Allow-Origin' '*';
- add_header 'Access-Control-Allow-Credentials' 'true';
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
- add_header 'Access-Control-Max-Age' 1728000;
- add_header 'Content-Type' 'text/plain charset=UTF-8';
- add_header 'Content-Length' 0;
- return 204;
- }
- if ($request_method = 'POST') {
- add_header 'Access-Control-Allow-Origin' '*';
- add_header 'Access-Control-Allow-Credentials' 'true';
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
- }
- if ($request_method = 'GET') {
- add_header 'Access-Control-Allow-Origin' '*';
- add_header 'Access-Control-Allow-Credentials' 'true';
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
- }
-
- rewrite_by_lua '
- if string.find(ngx.var.host, "_") then
- local newHost, n = ngx.re.gsub(ngx.var.host, "_", "-")
- ngx.redirect(ngx.var.scheme .. "://" .. newHost .. ngx.var.uri)
- end
- ';
-
- proxy_pass http://backend_snipt;
- proxy_set_header Host $host;
-
- }
-
- location /static/ {
- alias /var/www/snipt/static/;
- expires max;
- }
-
- location /public/feed/ {
- rewrite ^/public/feed/$ https://{{ pillar.hostname }}/public/?rss permanent;
- }
- }
- server {
- listen 80 default_server;
-
- location / {
- proxy_pass http://backend_snipt;
- proxy_set_header Host $host;
- }
-
- location /static/ {
- alias /var/www/snipt/static/;
- expires max;
- }
- location ~* /favicon.ico {
- root /var/www/snipt/static/img/;
- expires max;
- }
- }
-{% else %}
- server {
- listen 80 default_server;
-
- location / {
- proxy_pass http://backend_snipt;
- proxy_set_header Host $host;
- }
-
- location /static/ {
- alias /var/www/snipt/media/;
- expires max;
- }
- location ~* /favicon.ico {
- root /var/www/snipt/media/img/;
- expires max;
- }
- }
-{% endif %}
@@ -1,7 +0,0 @@
-[program:snipt]
-directory=/var/www/snipt
-user={{ pillar.deploy_user }}
-command={% if pillar.env_name != 'vagrant' %}/var/www/.virtualenvs/snipt/bin/gunicorn wsgi:application{% else %}/var/www/.virtualenvs/snipt/bin/python /var/www/snipt/manage.py runserver{% endif %}
-autostart=true
-autorestart=true
-stopasgroup=true
View
No changes.
@@ -1,24 +0,0 @@
-elasticsearch-file:
- file.managed:
- - name: /tmp/elasticsearch-1.3.4.deb
- - source: https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.4.deb
- - unless: test -d /usr/local/elasticsearch/bin
- - source_hash: sha1=6a4b6a12825f141245bb581c76052464d17de874
-
-elasticsearch-install:
- cmd:
- - cwd: /tmp
- - names:
- - dpkg -i elasticsearch-1.3.4.deb
- - unless: test -d /usr/local/elasticsearch/bin
- - run
- - require:
- - file: elasticsearch-file
-
-elasticsearch:
- service:
- - running
- - enable: True
- - reload: True
- - require:
- - file: elasticsearch-file
Oops, something went wrong.

0 comments on commit 909112b

Please sign in to comment.