Skip to content

Commit

Permalink
Update setup instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
cblanc committed Mar 5, 2019
1 parent f71d7c1 commit 9ff2315
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions app/views/includes/contents/documentation_content.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@
<p>We currently provide 4 methods to import the necessary datasets and run the postcodes.io API application:</p>
<ol>
<li>Use our docker application and database images</li>
<li>Use our install script. This will require postgres superuser privileges to create and provision your database. It will then download the database and import the data from a <code>pg_dump</code> (hosted and created by us).</li>
<li>Use our install script. This will require postgres superuser privileges to create and provision your database. It will then download the database and import the data from a <code>pg_dump</code>.</li>
<li>You can download the <code>pg_dump</code> and attempt to import the database yourself with <code>psql</code> or pg_restore.</li>
<li>Lastly, you can retrieve the raw CSV data from the ONS and import it with our import script.</li>
</ol>
Expand Down Expand Up @@ -490,32 +490,37 @@
<li><a href="https://postgis.net/install/">Postgresql and Postgis</a></li>
</ul>
<h3 id="install-script">2. Install Script</h3>
<p>Currently the install process targets *nix systems. We've provisioned and tested on OS X Mavericks &amp; Ubuntu 14.04. Please<a href="/about"> let us know</a> if you have issues on other operating systems.</p>
<p>Postcodes.io is packaged with a<a href="https://github.com/ideal-postcodes/postcodes.io/blob/master/bin/setup.sh"> script</a> to provision postgres and download a dump of the ONS Postcode Directory (hosted by us). The script will
do the following,</p>
<p>Currently the install process targets Linux and macOS systems. Please <a href="/about">let us know</a> if you have issues on those or any other operating systems.</p>
<p>Postcodes.io is packaged with a<a href="https://github.com/ideal-postcodes/postcodes.io/blob/master/bin/setup.sh"> script</a> to provision postgres and download a dump of the dataset. The script will,</p>
<ul>
<li>Prompt you for your postgres superuser credentials (most of the setup steps require this level of privilege)</li>
<li>Create a new user "postcodesio"</li>
<li>Create a new database "postcodesiodb" owned by "postcodesio"</li>
<li>Create the necessary extensions on "postcodesiodb"</li>
<li>Download, unzip and stream the Postcode directory into Postgres</li>
<li>Create a new database</li>
<li>Create a new readonly user for the new database</li>
<li>Download, unzip and stream the <code>pg_dump</code> into the new database</li>
</ul>
<p>To run,</p>
<pre>$ npm run setup</pre>
<h3 id="import-from-pgdump">3. Manual Installation from our <code>pg_dump</code></h3>
<p>You can download a <code>pg_dump</code> of the postcode database which is hosted by us. This is the same dump which is used by the install script. The link to the latest dump can be found in our<a href="https://github.com/ideal-postcodes/postcodes.io/blob/master/latest"> repository.</a></p>
<p>To setup the database from our <code>pg_dump</code> simply download, <code>gunzip</code> and use either <code>psql</code> or <code>pg_restore</code> to import the data into Postgresql.</p>
<p>For example,</p><pre>$ cat postcodeiodb.sql | psql postcodesiodb</pre>

<h3 id="import-from-ons">4. Manual Installation</h3>
<p>The install scripts can be linked to your shell (or can be found in the <code>bin/</code> directory). To link, navigate to <code>postcodes.io/</code> and run <code>$ npm link</code></p>
<h4>ONS Postcode Directory</h4>
<p>Download the latest Office for National Statistic's "Postcode Lookup Dataset". Unzip the data locally. Run the import script <code>$ postcodesio:import_onspd</code> passing the path to the CSV data.</p><pre>$ postcodesio:import_onspd /path/to/data/ONSPD/Data/data.csv</pre>
<h4>OS Open Names</h4>
<p>Download the latest Ordnance Survey Open Names dataset. Unzip the data locally. Run the import script <code>$ postcodesio:import_oson</code> passing the path that contains the CSV data files.</p><pre>$ postcodesio:import_oson /path/to/data/opname_csv_gb/Data/</pre>
<h3 id="import-from-pgdump">3. Manual Installation <code>pg_dump</code></h3>

<p>You can download a <code>pg_dump</code> of the database. This is the same dump used by the install script. The link to the latest dump can be found in our<a href="https://github.com/ideal-postcodes/postcodes.io/blob/master/latest"> repository.</a></p>
<p>To setup the database from our <code>pg_dump</code> download, <code>gunzip</code> and use either <code>psql</code> or <code>pg_restore</code> to import the data into Postgresql.</p>
<p>For example,</p><pre>$ cat postcodeiodb.sql | psql postcodesiodb</pre>

<h3 id="import-from-ons">4. Manual Installation</h3>
<p>The install scripts can be linked to your shell (or can be found in the <code>bin/</code> directory). To link, navigate to <code>postcodes.io/</code> and run <code>$ npm link</code></p>
<br />

<h4>ONS Postcode Directory</h4>
<p>Download the latest Office for National Statistic's "Postcode Lookup Dataset". Unzip the data locally. Run the import script <code>$ postcodesio-onspd</code> passing the path to the CSV data.</p><pre>$ postcodesio-onspd /path/to/data/ONSPD/Data/data.csv</pre>
<br />

<h4>OS Open Names</h4>
<p>Download the latest Ordnance Survey Open Names dataset. Unzip the data locally. Run the import script <code>$ postcodesio-oson</code> passing the path that contains the CSV data files.</p><pre>$ postcodesio-oson /path/to/data/opname_csv_gb/Data/</pre>

<h3 id="configuration">Configuration</h3>
<p>Application configuration is documented in <a href="https://github.com/ideal-postcodes/postcodes.io/blob/master/config/README.md">the configuration README</a> at <code>/config/README.md</code>.<p>

<h3 id="configuration">Configuration</h3>
<p>Application configuration is documented in <a href="https://github.com/ideal-postcodes/postcodes.io/blob/master/config/README.md">the configuration README</a> at <code>/config/README.md</code>.<p>
</div>
</div>
</div>

0 comments on commit 9ff2315

Please sign in to comment.