master
Nick Sergeant 2014-10-30 22:45:33 -04:00
parent 4f6b0088b5
commit aaac6e2eb0
8 changed files with 26 additions and 20 deletions

View File

@ -81,6 +81,7 @@ deploy-heroku:
@git push heroku
salt-server:
@scp -q -P 55555 settings_local_server.py deploy@69.164.221.98:/var/www/snipt/settings_local.py
@scp -q -P 55555 -r ./salt/ deploy@69.164.221.98:salt
@scp -q -P 55555 -r ./pillar/ deploy@69.164.221.98:pillar
@$(ssh-server-deploy) 'sudo rm -rf /srv'
@ -112,12 +113,13 @@ server:
@$(ssh-server-root) 'sudo mv ~/salt /srv/salt'
@$(ssh-server-root) 'sudo mv ~/pillar /srv/pillar'
@$(ssh-server-root) 'sudo salt-call --local state.highstate'
@scp -q -P 55555 settings_local_server.py deploy@69.164.221.98:/var/www/snipt/settings_local.py
server-init:
@$(ssh-server-deploy) 'cd /var/www/snipt; make db;'
@$(ssh-server-deploy) '$(pm) syncdb;'
@$(ssh-server-deploy) '$(pm) syncdb --noinput;'
@$(ssh-server-deploy) '$(pm) migrate;'
@$(ssh-server-deploy) '$(pm) backfill_api_keys'
@$(ssh-server-deploy) '$(pm) rebuild_index --noinput'
@$(ssh-server-deploy) '$(pm) backfill_api_keys;'
@$(ssh-server-deploy) '$(pm) rebuild_index --noinput;'
vagrant:
@vagrant up --provider=vmware_fusion
@ -137,8 +139,8 @@ vagrant:
@vagrant ssh -c 'cd /var/www/snipt; make db;'
@vagrant ssh -c '$(pm) syncdb;'
@$(ssh-vagrant) '$(pm) migrate;'
@$(ssh-vagrant) '$(pm) backfill_api_keys'
@$(ssh-vagrant) '$(pm) rebuild_index --noinput'
@$(ssh-vagrant) '$(pm) backfill_api_keys;'
@$(ssh-vagrant) '$(pm) rebuild_index --noinput;'
.PHONY: assets, \
db, \
@ -148,6 +150,6 @@ vagrant:
provision-vagrant, \
salt-server, \
salt-vagrant, \
server-settings, \
server-init, \
server, \
vagrant

View File

@ -2,7 +2,7 @@
This is the codebase for the website, [Snipt.net](https://snipt.net/).
# Running the Django app
# Running the Django app locally with Vagrant
Install [Vagrant](https://www.vagrantup.com/) and either [VirtualBox](https://www.virtualbox.org/) or
[VMWare Fusion](http://www.vmware.com/products/fusion).
@ -14,11 +14,14 @@ Install [Vagrant](https://www.vagrantup.com/) and either [VirtualBox](https://ww
5. Visit [http://local.snipt.net:8080/](http://local.snipt.net:8080/).
# Deploying to a VM
1. Clone the repo.
2. `cp settings_local.py-template settings_local_server.py`
3. Edit local server settings (choose a database password - you'll be prompted for it).
4. Manually change the VM IP address in the Makefile.
5. `make server`
6. SSH into the server, `sudo su - deploy`, `ssh-keygen`, and add the public key to your repo as a deploy key.
7. `make server-init`
# Deploying to Heroku

View File

@ -9,7 +9,6 @@ django-debug-toolbar==0.11.0
django-extensions==1.2.5
django-markdown-deux==1.0.4
django-pagination==1.0.7
django-sslify>=0.2
django-storages==1.1.5
django-taggit==0.10
django-tastypie==0.10.0

View File

@ -68,7 +68,7 @@ snipt-site:
- group: deploy
- mode: 755
- require:
- pkg: nginx
- pkg: nginx-extras
- group: deploy
enable-snipt-site:
@ -77,8 +77,8 @@ enable-snipt-site:
- target: /etc/nginx/sites-available/snipt
- force: false
- require:
- pkg: nginx
- pkg: nginx-extras
cmd.run:
- name: service nginx restart
- require:
- pkg: nginx
- pkg: nginx-extras

View File

@ -1,9 +1,13 @@
nginx:
nginx-extras:
pkg:
- installed
nginx:
service:
- running
- enable: True
- require:
- pkg: nginx-extras
- watch:
- file: /etc/nginx/nginx.conf
- file: /etc/nginx/sites-enabled/*
@ -12,13 +16,13 @@ nginx:
file.directory:
- mode: 755
- require:
- pkg: nginx
- pkg: nginx-extras
/etc/nginx/sites-enabled:
file.directory:
- mode: 755
- require:
- pkg: nginx
- pkg: nginx-extras
{% if pillar.env_name != 'vagrant' %}
@ -26,7 +30,7 @@ nginx:
file.directory:
- mode: 644
- require:
- pkg: nginx
- pkg: nginx-extras
{% endif %}
@ -36,7 +40,7 @@ nginx:
- mode: 400
- template: jinja
- require:
- pkg: nginx
- pkg: nginx-extras
/etc/nginx/sites-enabled/default:
file.absent

View File

@ -17,7 +17,7 @@ http {
gzip on;
gzip_disable "msie6";
gzip_types text/html text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
include /etc/nginx/sites-enabled/*;

View File

@ -109,7 +109,6 @@ LOGGING = {
'loggers': {}
}
MIDDLEWARE_CLASSES = (
'sslify.middleware.SSLifyMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',

View File

@ -5,7 +5,6 @@ POSTMARK_API_KEY = ''
RAVEN_CONFIG = { 'dsn': '' }
SECRET_KEY = 'changeme'
SESSION_COOKIE_SECURE = False
SSLIFY_DISABLE = True
STRIPE_SECRET_KEY = ''
USE_HTTPS = False