You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-17Lines changed: 17 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,22 @@
1
1
# Map of National Parks and Historic Sites
2
-
*powered by RESTify, PostGIS, and Leaflet maps*
2
+
*powered by Restify, MongoDB, and Leaflet maps*
3
3
4
-
A basic instant mapping demo using PostGIS, node-restify, LeafLet Maps and map tiles from Stamen, to visualize the locations of major National Parks and Historic Sites.
4
+
A basic instant mapping demo using MongoDB, node-restify, LeafLet Maps and map tiles from Stamen, to visualize the locations of major National Parks and Historic Sites.
Related post on OpenShift.com: [https://www.openshift.com/blogs/instant-mapping-applications-with-postgis-and-nodejs](https://www.openshift.com/blogs/instant-mapping-applications-with-postgis-and-nodejs)
9
9
10
10
## Instant Provisioning on OpenShift
11
11
To deploy a clone of this application using the [`rhc` command line tool](http://rubygems.org/gems/rhc), type:
12
12
13
-
rhc app create parks nodejs-0.10 postgresql-9.2 --from-code=https://github.com/ryanj/restify-postGIS.git
13
+
rhc app create parks nodejs-0.10 mongodb-2.2 --from-code=https://github.com/ryanj/restify-mongodb-parks.git
14
14
15
-
Or, [link to a web-based **clone+deploy**](https://openshift.redhat.com/app/console/application_type/custom?name=parks&cartridges%5B%5D=nodejs-0.10&cartridges%5B%5D=postgresql-9.2&initial_git_url=https%3A%2F%2Fgithub.com%2Fryanj%2Frestify-postGIS.git) on [OpenShift Online](http://OpenShift.com) or [your own open cloud](http://openshift.github.io):
15
+
Or, [link to a web-based **clone+deploy**](https://openshift.redhat.com/app/console/application_type/custom?name=parks&cartridges%5B%5D=nodejs-0.10&cartridges%5B%5D=mongodb-2.2&initial_git_url=https%3A%2F%2Fgithub.com%2Fryanj%2Frestify-mongodb-parks.git) on [OpenShift Online](http://OpenShift.com) or [your own open cloud](http://openshift.github.io):
A live demo is available at: [http://nodegis-shifter.rhcloud.com/](http://nodegis-shifter.rhcloud.com/)
19
+
A live demo is available at: [http://parks-shifter.rhcloud.com/](http://parks-shifter.rhcloud.com/)
20
20
21
21
## Local Development
22
22
Before you spin up a local server, you'll need a copy of the source code, and an installation of [nodejs](http://nodejs.org/).
@@ -30,7 +30,7 @@ OpenShift will automatically resolve `package.json` dependencies for hosted appl
30
30
npm install
31
31
32
32
### port-forwarding for local access to your remote db
33
-
You can set up your own postgreSQL database for local development. But, OpenShift provides a great way to get connected to your fully hosted and configured PostgreSQL database in mere seconds.
33
+
You can set up your own MongoDB database for local development. But, OpenShift provides a great way to get connected to your fully hosted and configured DB in mere seconds
34
34
35
35
The `rhc port-forward` command establishes a local connection to your hosted database, where your DB permissions, table schema, and map data have already been initialized.
36
36
@@ -39,19 +39,19 @@ The command output will provides your local connection details:
39
39
Service Local OpenShift
40
40
---------- -------------- ---- ----------------
41
41
node 127.0.0.1:8080 => 127.5.199.1:8080
42
-
postgresql 127.0.0.1:5433 => 127.5.199.2:5432
42
+
mongodb 127.0.0.1:27017 => 127.5.199.2:27017
43
43
44
44
Press CTRL-C to terminate port forwarding
45
45
46
-
Make a note of the *local*postgresql IP address and port number, and leave the command running (in order to keep the connection open). We will need to use these values in the next step.
46
+
Make a note of the *local*MongoDB IP address and port number, and leave the command running (in order to keep the connection open). We will need to use these values in the next step.
47
47
48
48
### Basic Configuration
49
49
This app uses the `config` npm module, which loads it's configuration details from the `config/defaults.json` file. This configuration takes advantage of several environment variables whenever they are available. On OpenShift, many of these values are automatically provided for your application by their associated cartridge add-on service:
@@ -66,26 +66,26 @@ You can find this information by running `env` while connected to your OpenShift
66
66
### Environment Variables
67
67
Now, set your `OPENSHIFT_POSTGRESQL_DB_URL` environment variable, substituting your own `DB_USERNAME`, `DB_PASSWORD`, `LOCAL_DB_IP`, and `LOCAL_DB_PORT`:
This app also expects to use a Postgres `table_name` that matches your application's name (as defined within OpenShift). When running this application on OpenShift, the `OPENSHIFT_APP_NAME` environment variable will be automatically populated. If you didn't name your application "parks" (the default value for this option), then you will likely need to set an extra environment variable containing your table name in your local dev environment:
75
+
This app also expects to use a MongoDB collection name (`table_name`) that matches your application's name (as defined within OpenShift). When running this application on OpenShift, the `OPENSHIFT_APP_NAME` environment variable will be automatically populated. If you didn't name your application "parks" (the default value for this option), then you will likely need to set an extra environment variable containing your table name in your local dev environment:
76
76
77
77
export OPENSHIFT_APP_NAME=parks
78
78
79
79
#### Testing your connection
80
-
You can verify that your port-forwarding tunnel is active, and that your environment variables are configured correctly by using them to make a DB connection using the `psql` command-line client:
80
+
You can verify that your port-forwarding tunnel is active, and that your environment variables are configured correctly by using them to make a DB connection using the `mongo` command-line client:
This should provide a direct connection to your OpenShift-hosted database instance.
85
85
86
86
Here you can verify that your application's [automatic database import procedures](https://www.openshift.com/blogs/instant-mapping-applications-with-postgis-and-nodejs#bootstrapping) have successfully completed, by checking the number of records in our DB table:
87
87
88
-
select count(*) from parks;
88
+
db.parks.count;
89
89
90
90
The result should be `547`. As usual, if you named your application something other than `parks`, you'll need to modify above the command to match your particular configuration.
0 commit comments