Grandlyon-ibasho-planner - A PHP+Silex+MongoDB+Leaflet/OpenStreetMap website

A variation on the https://github.com/openshift-quickstart/silex-mongodb-parks example.

Download .zip Download .tar.gz View on GitHub

Project Rationale

This project is a fork from openshift-quickstart/silex-mongodb-parks. It intends to try implementing several features on top of the existing AJAX-based OpenStreetMap slippy map.

Namely:

☑ Only populates MongoDB on first deployment

☑ Nice, customizable markers with lvoogdt/Leaflet.awesome-markers and the awesome fortawesome/Font-Awesome

☐ Marker insertion using aratcliffe/Leaflet.contextmenu

☐ Better tweaked for more Heroku deployment friendliness


Deploying to Openshift using the rhc gem in CLI

$ rhc app create tclmap php-5.4 mongodb-2 --from-code=https://github.com/mchubby/grandlyon-ibasho-planner

Deploying to RedHat Openshift through the web interface

Visit https://openshift.redhat.com/app/console/application_type/custom?cartridges%5B%5D=php-5.4&cartridges%5B%5D=mongodb-2&name=tclmap&initial_git_url=https%3A%2F%2Fgithub.com%2Fmchubby%2Fgrandlyon-ibasho-planner.git


Deploying to Heroku (work in progress)

Add ext-mongo to composer.json

{
    "require": {
        "ext-mongo": "*",
        "silex/silex": "~1.1"
    }
}

Create Procfile at project root

 web: vendor/bin/heroku-php-nginx -C nginx_heroku.conf

Create nginx_heroku.conf at project root


location ~ ^(/(?:css|js|vendor).*)$ {
    try_files /static$1 @parksrewrite;
}

location @parksrewrite {
    # rewrite all to app.php
    rewrite ^(.*)$ /app.php/$1 last;
}

location / {
    # rewrite all to app.php
    rewrite ^(.*)$ /app.php/$1 last;
}

location ~ ^/(app|app_dev|config)\.php(/|$) {
    fastcgi_pass heroku-fcgi;
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param HTTPS off;
}

Create app in Heroku with php-5 and any Mongo addon

You may do this either with the web frontend or the heroku toolbelt.

Import tcl_metro_line_a.json to your MongDB provider using CLI:

$ mongoimport --db mongolab_dbname_here --collection tcl_metro_a --host mongolab_dbhost_here --port mongolab_dbport_here --username mongolab_username_here --password mongolab_password_here --type json --file tcl_metro_line_a.json
  • tweak all .php's for MongoDB connection strings / database / collections
Deploy to Heroku in toolbelt:
$ git clone git@heroku.com:heroku_app_name.git -o heroku && cd heroku_app_name
$ git remote add upstream -m master https://github.com/mchubby/grandlyon-ibasho-planner.git
$ git pull -s recursive -X theirs upstream master

(overwrite with your own changed files)
$ git add .
$ git commit -m "Initial commit before deploying"

$ git push heroku master

Profit!

Finally you can visit heroku_app_name.herokuapp.com/ in your browser and (hopefully) enjoy!

Many thanks to @ryanj for his great example!

Note: Original README follows


Map of US National Parks

powered by Silex, PHP, MongoDB, and Leaflet maps

To deploy a clone of this application using the rhc command line tool:

rhc app create parks php-5.4 mongodb-2 --from-code=https://github.com/openshift-quickstart/silex-mongodb-parks.git

Or link to a web-based clone+deploy on OpenShift Online or on your own OpenShift cloud:

https://openshift.redhat.com/app/console/application_type/custom?cartridges%5B%5D=php-5.4&cartridges%5B%5D=mongodb-2&initial_git_url=https%3A%2F%2Fgithub.com%2Fopenshift-quickstart%2Fsilex-mongodb-parks.git

A demo is available at: http://phparks-shifter.rhcloud.com/

License

This code is dedicated to the public domain to the maximum extent permitted by applicable law, pursuant to CC0 (http://creativecommons.org/publicdomain/zero/1.0/)