Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 154 lines (86 sloc) 7.091 kb
6880021 @slinkp Add a separate doc for deployment (doesn't belong in CONFIG.md); remove...
slinkp authored
1 These instructions apply only to the "Shareabouts Web" application.
2 If you are also building and installing the Shareabouts API yourself,
1d0cf89 @fkh cleaned up the intro.
fkh authored
3 it has its own documentation. If you'd rather use OpenPlans' hosted API, [contact us](api.shareabouts.org).
6880021 @slinkp Add a separate doc for deployment (doesn't belong in CONFIG.md); remove...
slinkp authored
4
4f72891 @fkh greater focus on Heroku button for deploys
fkh authored
5 You can deploy to any server that supports Django, but using a PaaS providers and our instructions below may be easier. The easist approach is to deploy via our "Deploy to Heroku" button.
6880021 @slinkp Add a separate doc for deployment (doesn't belong in CONFIG.md); remove...
slinkp authored
6
4f72891 @fkh greater focus on Heroku button for deploys
fkh authored
7 Deploying to Heroku with the button
8552f21 @mjumbewu Update the DEPLOY instruction with Heroku
mjumbewu authored
8 ----------------------------
6880021 @slinkp Add a separate doc for deployment (doesn't belong in CONFIG.md); remove...
slinkp authored
9
bc65966 @fkh typo
fkh authored
10 The fastest way to deploy Shareabouts is to click the "Deploy to Heroku" button in the [README](https://github.com/openplans/shareabouts#shareabouts-). This will deploy the Shareabouts code for you on [Heroku](https://heroku.com), a popular cloud platform for running software.
4f72891 @fkh greater focus on Heroku button for deploys
fkh authored
11
12 After clicking the button, you will see the configuration settings. Click "Deploy" confirm the setup, and in a few moments you'll have a Shareabouts map.
13
14 if you don't have a Heroku account, you'll be prompted to create one. Your account will be free, and setting up Shareabouts will also be free (later you may pay some monthly hosting costs if you scale up, but this is explained and easy to control via the Heroku Dashboard).
8552f21 @mjumbewu Update the DEPLOY instruction with Heroku
mjumbewu authored
15
4f72891 @fkh greater focus on Heroku button for deploys
fkh authored
16
17 Deploying to Heroku manually
18 --------------------------
0cae968 @mjumbewu Refer to the configuration and deployment instructions from the Heroku d...
mjumbewu authored
19
b32249f @atogle Update DotCloud docs for CLI 0.9
atogle authored
20 From the root Shareabouts directory...
21
8552f21 @mjumbewu Update the DEPLOY instruction with Heroku
mjumbewu authored
22 * Create a new application:
23
4f72891 @fkh greater focus on Heroku button for deploys
fkh authored
24 heroku apps:create <instance name>
6880021 @slinkp Add a separate doc for deployment (doesn't belong in CONFIG.md); remove...
slinkp authored
25
3811b47 @mjumbewu Add instructions for Heroku addons
mjumbewu authored
26 * Add the necessary addons:
27
28 heroku addons:add heroku-postgresql:standard-0
29 heroku addons:add rediscloud
b32249f @atogle Update DotCloud docs for CLI 0.9
atogle authored
30
4f72891 @fkh greater focus on Heroku button for deploys
fkh authored
31 * Push to the application
32
33 git push heroku master:master
6880021 @slinkp Add a separate doc for deployment (doesn't belong in CONFIG.md); remove...
slinkp authored
34
6cdd81e @mjumbewu Update DEPLOY.md
mjumbewu authored
35 * Set your environment variables:
6880021 @slinkp Add a separate doc for deployment (doesn't belong in CONFIG.md); remove...
slinkp authored
36
4f72891 @fkh greater focus on Heroku button for deploys
fkh authored
37 You will need your dataset root API URL for this step. Suppose you are using an API server named *api.shareabouts.org* with a username *mjumbewu* and a dataset called *niceplaces*. In this case, your dataset root will be `http://api.shareabouts.org/api/v2/mjumbewu/datasets/niceplaces/`. In general, it will always be `http://<api server>/api/v2/<username>/datasets/<dataset slug>/`.
38
6cdd81e @mjumbewu Update DEPLOY.md
mjumbewu authored
39 heroku config:set BUILDPACK_URL="https://github.com/ddollar/heroku-buildpack-multi.git" \
40 SHAREABOUTS_FLAVOR=<flavor name> \
4f72891 @fkh greater focus on Heroku button for deploys
fkh authored
41 SHAREABOUTS_DATASET_ROOT=<dataset root url> \
42 SHAREABOUTS_DATASET_KEY=<dataset api key>
43
44 Should be all done!
45
46 Deploying to Dotcloud manually
47 --------------------------
48
49 At OpenPlans, we deployed to Heroku and DotCloud internally, so all
50 of the files necessary are already in the repository. Other PaaS providers should be simple
51 variations on these.
52
53
54 From the root Shareabouts directory...
55
56 * Create a new application:
57
58 dotcloud create <instance name> -f live
59
60 This will create the application on DotCloud using the live flavor, and prompt you connect it to your current directory: `Connect the current directory to "<instance name>"?` If you choose yes, this application will become your default and you can ignore the `-A <instance name>` flags below.
6880021 @slinkp Add a separate doc for deployment (doesn't belong in CONFIG.md); remove...
slinkp authored
61
8552f21 @mjumbewu Update the DEPLOY instruction with Heroku
mjumbewu authored
62 * Push to the application
63
64
20e3022 @fkh dotcloud deprecated the A flag
fkh authored
65 dotcloud push --application <instance name> -b master --git
6880021 @slinkp Add a separate doc for deployment (doesn't belong in CONFIG.md); remove...
slinkp authored
66
b32249f @atogle Update DotCloud docs for CLI 0.9
atogle authored
67 Note you should either push all your changes to your master repository (eg. github or whatever you're using for version control); otherwise you must omit the `--git` option and _everything_ in your current directory will be pushed up.
6880021 @slinkp Add a separate doc for deployment (doesn't belong in CONFIG.md); remove...
slinkp authored
68
0c84666 @slinkp doc tweaks
slinkp authored
69 For more options, see `dotcloud push --help`
6880021 @slinkp Add a separate doc for deployment (doesn't belong in CONFIG.md); remove...
slinkp authored
70
71
8552f21 @mjumbewu Update the DEPLOY instruction with Heroku
mjumbewu authored
72 * Set your flavor, and dataset API key and root URL:
b32249f @atogle Update DotCloud docs for CLI 0.9
atogle authored
73
9ec80d0 @LukeSwart Update DEPLOY.md
LukeSwart authored
74 You will need your dataset root API URL for this step. Suppose you are using an API server named *api.shareabouts.org* with a username *mjumbewu* and a dataset called *niceplaces*. In this case, your dataset root will be `http://api.shareabouts.org/api/v2/mjumbewu/datasets/niceplaces/`. In general, it will always be `http://<api server>/api/v2/<username>/datasets/<dataset slug>/`.
6880021 @slinkp Add a separate doc for deployment (doesn't belong in CONFIG.md); remove...
slinkp authored
75
8552f21 @mjumbewu Update the DEPLOY instruction with Heroku
mjumbewu authored
76 *DotCloud*
6880021 @slinkp Add a separate doc for deployment (doesn't belong in CONFIG.md); remove...
slinkp authored
77
20e3022 @fkh dotcloud deprecated the A flag
fkh authored
78 dotcloud env --application <instance name> set SHAREABOUTS_FLAVOR=<flavor name> \
b32249f @atogle Update DotCloud docs for CLI 0.9
atogle authored
79 SHAREABOUTS_DATASET_ROOT=<dataset root url> \
80 SHAREABOUTS_DATASET_KEY=<dataset api key>
81
6880021 @slinkp Add a separate doc for deployment (doesn't belong in CONFIG.md); remove...
slinkp authored
82
83 Should be all done!
08ade62 @mjumbewu Consolidate the deployment docs
mjumbewu authored
84
85
86 Deploying to WebFaction
87 -----------------------
88
4c8a8dc @ndkv change webfaction django version to 1.5
ndkv authored
89 0. Create a Django application using Django 1.5 and Python 2.7 in the control panel (Applications -> Add New Application). In this case an application called 'shareabouts_front' was created.
08ade62 @mjumbewu Consolidate the deployment docs
mjumbewu authored
90
91 1. SSH into your server and check out the project alongside wherever WebFaction created your `myproject` app:
92
93 cd webapps/shareabouts_front
94 git clone git://github.com/openplans/shareabouts.git
95
96 2. Install pip and (optionally) virtualenv:
97
98 easy_install-2.7 pip
99 easy_install-2.7 virtualenv
100
101 3. Create a virtual environment. This is not technically necessary, but is recommended if you have any other non-Shareabouts Python applications running on your server, or if you plan to in the future. For a brief introduction to virtual environments in Python see http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ or the virtualenv docs at http://www.virtualenv.org/:
102
103 virtualenv venv --no-site-packages
104 source venv/bin/activate
105
106 4. Install the project dependencies:
107
108 pip install -r shareabouts/requirements.txt
109
110 5. Edit the apache2/conf/http.conf file. This is so that Apache knows where to find the project's dependencies, and how to run the WSGI app:
111
112 ...
113 SetEnvIf X-Forwarded-SSL on HTTPS=1
114 ThreadsPerChild 5
115
116 #####
117 # THIS LINE WAS CHANGED to refer to your Shareabouts project path
118 WSGIDaemonProcess shareabouts_front processes=2 threads=12 python-path=/home/<HOME_DIR>/webapps/shareabouts_front:/home/<HOME_DIR>/webapps/shareabouts_front/shareabouts/src:/home/<HOME_DIR>/webapps/shareabouts_front/lib/python2.7
119
120 WSGIProcessGroup shareabouts_front
121 WSGIRestrictEmbedded On
122 WSGILazyInitialization On
123
124 #####
125 # AND THIS LINE WAS CHANGED to refer to your Shareabouts WSGI module
126 WSGIScriptAlias / /home/<HOME_DIR>/webapps/shareabouts_front/shareabouts/src/project/wsgi.py
127
128
129 6. Edit the WSGI module (shareabouts/src/project/wsgi.py). This is so that the project runs in the same environment where all of its dependencies have been installed *If you did not set up a virtual environment, you can skip this step*:
130
131 After...
132
133 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
134
135 Add...
136
137 activate_this = os.path.expanduser("~/webapps/shareabouts_front/venv/bin/activate_this.py")
138 execfile(activate_this, dict(__file__=activate_this))
139
140
141 7. Update the shareabouts/src/project/urls.py file to be able to find the site's static assets. **NOTE: it would be better if this pointed to an actual static file server. See http://docs.webfaction.com/software/django/config.html#serving-django-static-media for more information**:
142
143 At the top, add...
144
145 from django.contrib.staticfiles.urls import staticfiles_urlpatterns
146
147 And change
148
149 urlpatterns = patterns('',
150
151 to
152
153 urlpatterns = staticfiles_urlpatterns() + patterns('',
Something went wrong with that request. Please try again.