GIS and Media fusion

"The explosive growth of the GeoWeb and geographic information has made GIS powerful media for the general public to communicate, but perhaps more importantly, GIS have also become media for constructive dialogs and interactions about social issues." - Sui & Goodchild

User Tools

Site Tools


geoinf18:pgheroku

This is an old revision of the document!


PostGIS avec le service PaaS Heroku

Objectif : déployer une app Heroku avec PHP et PostgreSQL avec l'extension PostGIS

Démarche en 4 étapes :

  1. Suivre les étapes Introduction, Set up, Prepare the app, Deploy the app de Getting Started on Heroku with PHP https://devcenter.heroku.com/articles/getting-started-with-php#introduction
    1. suivre aussi l'étape Push local changes, mais à la place de l'utilisation de Cowsay, on propose simplement d'ajouter un script PHP qui exécute la fonction phpinfo() — l'appel de ce script dans un navigateur permettra de voir la configuration PHP avec Heroku
    2. l'étape Provision a database est remplacée par l'exécution de la commande (attache et initialise une base de données Postgresql à l'application PHP)
      heroku addons:create heroku-postgresql
  2. Accéder au tableau de bord Heroku Data - https://data.heroku.com
    1. sélectionner la BD que vous venez de créer qui se rattache à votre application PHP
    2. l'onglet Settings montre les informations d'identification pour les connexions manuelles à cette base de données (host URL, dbname, user, password)
  3. Choisir un outil console SQL pour se connecter à PostgreSQL
    1. avec l'application pgAdmin3 - https://www.pgadmin.org/ (suivre alors au point n°4)
    2. OU avec psql dans un shell interactif (bash) :
      1. dans le dossier local de votre app heroku, lancer
        heroku run bash
      2. après connexion, à l'invite de commande bash, lancer
        psql -U #heroku_dbuser# -h #heroku_dbhost.amazonaws.com# -d #dbname#
      3. à l'invite de commande psql, saisir une commande
        select postgis_version();   # for informations about installed PostGIS 
        \h # for help with SQL commands
        \? # for help with psql commands
    1. exécuter la commande SQL ci-dessous qui doit ajouter l'extension PostGIS à cette instance de base de données
      create extension postgis
    2. voyez l'apparition de nouvelles tables et vues (commande psql \d en shell interactif ou faire un refresh dans pgAdmin)

geoinf18/pgheroku.1540918865.txt.gz · Last modified: 2018/10/30 18:01 by oertz