| 1 | byCycle Trip Planner - Installation |
|---|
| 2 | +++++++++++++++++++++++++++++++++++ |
|---|
| 3 | |
|---|
| 4 | Created 2006-01-23 |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | Packages |
|---|
| 8 | ======== |
|---|
| 9 | |
|---|
| 10 | byCycle is developed on Ubuntu 9.04 and deployed to Fedora Core 9. This |
|---|
| 11 | section includes the packages needed for both. |
|---|
| 12 | |
|---|
| 13 | Dev Tools |
|---|
| 14 | --------- |
|---|
| 15 | All: subversion |
|---|
| 16 | |
|---|
| 17 | PostgreSQL 8.x |
|---|
| 18 | -------------- |
|---|
| 19 | All: postgresql |
|---|
| 20 | Ubuntu: libpq-dev postgresql-server-dev-8.3 |
|---|
| 21 | FC9: postgresql-server postgresql-devel |
|---|
| 22 | |
|---|
| 23 | GEOS 3 |
|---|
| 24 | ------ |
|---|
| 25 | Ubuntu: libgeos-3.0.0 libgeos-dev |
|---|
| 26 | FC9: geos geos-devel |
|---|
| 27 | |
|---|
| 28 | Proj 4.5.0 |
|---|
| 29 | ---------- |
|---|
| 30 | All: proj |
|---|
| 31 | FC9: proj-devel proj-epsg |
|---|
| 32 | |
|---|
| 33 | PostGIS |
|---|
| 34 | ------- |
|---|
| 35 | All: postgis |
|---|
| 36 | Ubuntu: postgresql-8.3-postgis |
|---|
| 37 | |
|---|
| 38 | Python 2.6 <http://www.python.org/> |
|---|
| 39 | ------------------------------------- |
|---|
| 40 | Python development package is needed by psycopg2 |
|---|
| 41 | Ubuntu: python2.6-dev |
|---|
| 42 | FC9: python-devel |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | Python Packages |
|---|
| 46 | =============== |
|---|
| 47 | |
|---|
| 48 | # The current preferred way to install byCycle for development is to use |
|---|
| 49 | # virtualenv <http://pypi.python.org/pypi/virtualenv>. |
|---|
| 50 | sudo easy_install virtualenv |
|---|
| 51 | cd <some project directory> |
|---|
| 52 | virtualenv byCycle |
|---|
| 53 | cd byCycle |
|---|
| 54 | mkdir src |
|---|
| 55 | source bin/activate |
|---|
| 56 | |
|---|
| 57 | # Most of the python packages required by byCycle are automatically installed |
|---|
| 58 | # when byCycle is easy_installed, but PCL must be installed "manually" because |
|---|
| 59 | # it isn't eggified or uploaded to PyPI. |
|---|
| 60 | |
|---|
| 61 | # Python Cartographic Library (PCL) - Core 0.11.0 |
|---|
| 62 | # Depends on Proj and GEOS for some operations |
|---|
| 63 | # Depends on libgeos-dev |
|---|
| 64 | # Depends on zope.interface |
|---|
| 65 | # On FC9, depends on proj-epsg (will segfault without it) |
|---|
| 66 | cd src |
|---|
| 67 | wget http://gispython.org/downloads/gispy/PCL-0.11.0.tar.gz |
|---|
| 68 | tar xvzf PCL-0.11.0.tar.gz |
|---|
| 69 | cd PCL-0.11.0/PCL-Core |
|---|
| 70 | python setup.py install |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | Installation of byCycle Core |
|---|
| 74 | ============================ |
|---|
| 75 | |
|---|
| 76 | # Check out the code in virtualenv code directory. Use guest:guest credentials |
|---|
| 77 | # unless you've got an SVN login. |
|---|
| 78 | svn co http://guest:guest@code.bycycle.org/byCycle/Core/trunk src/byCycle/Core |
|---|
| 79 | |
|---|
| 80 | Installation |
|---|
| 81 | ------------ |
|---|
| 82 | You'll need to create the file src/byCycle/Core/trunk/bycycle/core/model/.pw |
|---|
| 83 | containing a single line with your PostgreSQL password. See Configuration |
|---|
| 84 | section below for more info on setting up Postgres. |
|---|
| 85 | |
|---|
| 86 | Development |
|---|
| 87 | ~~~~~~~~~~~ |
|---|
| 88 | In src/byCycle/Core/trunk, run `python setup.py develop` |
|---|
| 89 | |
|---|
| 90 | Production |
|---|
| 91 | ~~~~~~~~~~ |
|---|
| 92 | See Development |
|---|
| 93 | |
|---|
| 94 | Testing |
|---|
| 95 | ------- |
|---|
| 96 | In trunk, run `nosetests` |
|---|
| 97 | |
|---|
| 98 | |
|---|
| 99 | Installation of Trip Planner Web App |
|---|
| 100 | ==================================== |
|---|
| 101 | |
|---|
| 102 | TODO: This probably belongs in a different document--i.e., with the Pylons |
|---|
| 103 | app. That doc should start out by saying, "First, install the byCycle core and |
|---|
| 104 | its dependencies using the instructions at..." |
|---|
| 105 | |
|---|
| 106 | # Check out the trip planner Web app (in virtualenv repo directory). |
|---|
| 107 | # Use guest:guest credentials unless you've got an SVN login. |
|---|
| 108 | svn co http://code.bycycle.org/byCycle/TripPlanner/trunk src/byCycle/TripPlanner |
|---|
| 109 | |
|---|
| 110 | Installation |
|---|
| 111 | ------------ |
|---|
| 112 | |
|---|
| 113 | Development |
|---|
| 114 | ~~~~~~~~~~ |
|---|
| 115 | In src/byCycle/TripPlanner/trunk, run `python setup.py develop` |
|---|
| 116 | |
|---|
| 117 | Production |
|---|
| 118 | ~~~~~~~~~ |
|---|
| 119 | See Development |
|---|
| 120 | |
|---|
| 121 | Testing |
|---|
| 122 | ------- |
|---|
| 123 | # More unit tests needed |
|---|
| 124 | cd src/byCycle/TripPlanner/trunk |
|---|
| 125 | paster serve --reload development.ini |
|---|
| 126 | firefox http://localhost:5000/ |
|---|
| 127 | |
|---|
| 128 | Google Map |
|---|
| 129 | ---------- |
|---|
| 130 | If you want to view the Google Map, you will need a Google Maps API key. |
|---|
| 131 | <http://www.google.com/apis/maps/>. |
|---|
| 132 | |
|---|
| 133 | |
|---|
| 134 | Configuration |
|---|
| 135 | ============= |
|---|
| 136 | |
|---|
| 137 | PostgreSQL |
|---|
| 138 | ---------- |
|---|
| 139 | |
|---|
| 140 | * Edit pg_hba.conf. On Ubuntu, this is at /etc/postgresql/8.3/main/pg_hba.conf. |
|---|
| 141 | On FC9, this in the Postgres data directory. |
|---|
| 142 | |
|---|
| 143 | * Set local auth to trust (not the Database administrative login by UNIX |
|---|
| 144 | sockets; the one below that) |
|---|
| 145 | |
|---|
| 146 | * Make sure IPv4 host auth is set to md5 |
|---|
| 147 | |
|---|
| 148 | * Switch to postgres user ($USER refers to the OS username of the user you |
|---|
| 149 | will be running byCycle under) |
|---|
| 150 | * `createdb $USER` |
|---|
| 151 | |
|---|
| 152 | * `createuser $USER` (n, n, n in response to prompts) |
|---|
| 153 | |
|---|
| 154 | * `createlang plpgsql $USER` |
|---|
| 155 | |
|---|
| 156 | * `psql -d $USER` then `ALTER ROLE $USER password 'sekret';` |
|---|
| 157 | |
|---|
| 158 | * Insert lwpostgis.sql and spatial_ref_sys.sql into bycycle DB. These files |
|---|
| 159 | are in /usr/share/postgresql-8.3-postgis on Ubuntu. |
|---|
| 160 | * `psql -d $USER < lwpostgis.sql` |
|---|
| 161 | * `psql -d $USER < spatial_ref_sys.sql` |
|---|
| 162 | |
|---|
| 163 | * Change owner of public schema and all tables to $USER |
|---|
| 164 | * `psql -d $USER` |
|---|
| 165 | * `ALTER DATABASE $USER OWNER TO $USER;` |
|---|
| 166 | * `ALTER SCHEMA public OWNER TO $USER;` |
|---|
| 167 | * `ALTER TABLE geometry_columns OWNER TO $USER;` |
|---|
| 168 | * `ALTER TABLE spatial_ref_sys OWNER TO $USER;` |
|---|
| 169 | |
|---|
| 170 | * Exit from postgres user |
|---|
| 171 | |
|---|
| 172 | * Run Core/trunk/bycycle/core/scripts/integrate.py for each region. The |
|---|
| 173 | following is an example for Portland, OR. |
|---|
| 174 | * `cd src/byCycle/Core/trunk/bycycle/core/scripts` |
|---|
| 175 | * `./integrate.py -r portlandor -d pirate -l str` |
|---|
| 176 | |
|---|
| 177 | Deployment |
|---|
| 178 | ========== |
|---|
| 179 | |
|---|
| 180 | Apache 2 <http://httpd.apache.org/> |
|---|
| 181 | Paste server behind mod_proxy |
|---|
| 182 | |
|---|
| 183 | |
|---|
| 184 | Issues |
|---|
| 185 | ====== |
|---|
| 186 | |
|---|
| 187 | If you have any problems with any of this, please feel free to contact us. |
|---|
| 188 | |
|---|
| 189 | Email: wyatt@bycycle.org |
|---|
| 190 | |
|---|