2019-01-21 15:21:25 -08:00
|
|
|
# Siftie Snippets
|
2012-09-18 16:35:36 -07:00
|
|
|
|
2019-01-22 16:48:26 -08:00
|
|
|
## Running locally
|
2019-01-21 17:10:10 -08:00
|
|
|
|
|
|
|
- Clone the repo.
|
|
|
|
- `cd snippets`
|
2019-01-23 14:00:37 -08:00
|
|
|
- `python3 -m venv ~/.virtualenvs/snippets`
|
|
|
|
- `source ~/.virtualenvs/snippets/bin/activate`
|
2019-01-21 17:10:10 -08:00
|
|
|
- `pip install -r requirements.txt`
|
|
|
|
- `brew install postgresql`
|
|
|
|
- `brew services start postgresql`
|
|
|
|
- `createuser snippets`
|
|
|
|
- `createdb snippets --owner=snippets`
|
|
|
|
- `cp settings_local.py-template settings_local.py` // modify if necessary
|
|
|
|
- `curl -X PUT "localhost:9200/haystack?pretty"`
|
|
|
|
- `python manage.py update_index` // optional if you have a local DB dump with snippets
|
|
|
|
- `make run`
|
|
|
|
|
2019-01-22 16:48:26 -08:00
|
|
|
## Deploying on Dokku
|
|
|
|
|
2019-01-22 17:35:11 -08:00
|
|
|
- `dokku apps:create snippets`
|
|
|
|
- `dokku postgres:create snippets`
|
|
|
|
- `dokku postgres:link snippets snippets`
|
|
|
|
- `scp snipt.dump nsergeant@server.nicksergeant.com:/home/nsergeant`
|
|
|
|
- `dokku postgres:connect snippets < snipt.dump`
|
|
|
|
- `dokku domains:add snippets snippets.siftie.com`
|
2019-01-23 18:08:28 -08:00
|
|
|
- `dokku storage:mount snippets /var/lib/dokku/data/storage/snippets-whoosh:/app/snippets-whoosh`
|
2019-01-23 18:34:19 -08:00
|
|
|
- `dokku config:set DOKKU_LETSENCRYPT_EMAIL=team@siftie.com SECRET_KEY=<some-secret-key> USE_SSL=true WHOOSH_PATH=/app/snippets-whoosh/whoosh_index`
|
2019-01-22 17:35:11 -08:00
|
|
|
- `git remote add dokku dokku@server.nicksergeant.com:snippets`
|
|
|
|
- `git push dokku`
|
2019-01-22 16:48:26 -08:00
|
|
|
|
2016-11-03 10:03:31 -07:00
|
|
|
## Automatic deploy to Heroku
|
2016-11-03 09:21:22 -07:00
|
|
|
|
2019-01-21 15:21:25 -08:00
|
|
|
You can click the button below to automatically deploy Siftie Snippets to Heroku.
|
2016-11-03 09:34:09 -07:00
|
|
|
|
2019-01-21 15:21:25 -08:00
|
|
|
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/siftie/snippets)
|
2016-11-03 09:21:22 -07:00
|
|
|
|
2016-11-03 10:03:31 -07:00
|
|
|
## Manual deploy to Heroku
|
2016-11-03 09:21:22 -07:00
|
|
|
|
2016-11-01 12:15:56 -07:00
|
|
|
- Clone the repo.
|
|
|
|
- `heroku create`
|
|
|
|
- `heroku addons:add heroku-postgresql:hobby-dev`
|
|
|
|
- `heroku addons:add searchbox`
|
2016-11-04 08:46:50 -07:00
|
|
|
- `heroku config:add SECRET_KEY=<some-secret-key>`
|
2016-11-01 12:15:56 -07:00
|
|
|
- `git push heroku`
|
|
|
|
- `heroku run python manage.py migrate`
|
|
|
|
- `heroku run python manage.py createsuperuser`
|
|
|
|
- Visit yourapp.herokuapp.com and login with the user you just created.
|
2016-11-02 13:14:56 -07:00
|
|
|
|
2016-11-03 10:51:13 -07:00
|
|
|
## Updating your Heroku instance after an automatic deploy
|
|
|
|
|
2019-01-21 15:21:25 -08:00
|
|
|
- `git clone https://github.com/siftie/snippets`
|
|
|
|
- `cd snippets`
|
2016-11-03 10:51:13 -07:00
|
|
|
- `git checkout heroku`
|
|
|
|
- `heroku git:remote -a <your-instance-name>`
|
|
|
|
- `git push heroku heroku:master`
|
|
|
|
|
2016-11-03 10:03:31 -07:00
|
|
|
## Options
|
|
|
|
|
2016-11-04 08:46:50 -07:00
|
|
|
If you want email support (for password resets, server errors, etc):
|
|
|
|
|
|
|
|
- `heroku addons:create postmark:10k`
|
|
|
|
- `heroku run addons:open postmark` -> use an email you control and confirm it
|
|
|
|
- `heroku config:add POSTMARK_EMAIL=<email_from_above>`
|
|
|
|
|
2016-11-02 13:14:56 -07:00
|
|
|
If you want to disable user-facing signup:
|
|
|
|
|
|
|
|
- `heroku config:set DISABLE_SIGNUP=true`
|
2016-11-02 13:22:23 -07:00
|
|
|
|
2016-11-03 06:49:20 -07:00
|
|
|
If you want to enable Django's DEBUG mode:
|
|
|
|
|
2016-11-29 21:10:35 -08:00
|
|
|
- `heroku config:add DEBUG=true`
|
2016-11-03 06:49:20 -07:00
|
|
|
|
2016-11-03 10:03:31 -07:00
|
|
|
If you want to enable SSL on a custom domain after you've configured your
|
|
|
|
Heroku SSL cert:
|
2016-11-03 06:49:20 -07:00
|
|
|
|
2016-11-29 21:10:35 -08:00
|
|
|
- `heroku config:add USE_SSL=true`
|