Skip to content

Commit

Permalink
Merge remote-tracking branch 'hoatle/tasks/DEV-221-postgresql-remote'…
Browse files Browse the repository at this point in the history
… into develop
  • Loading branch information
hoatle committed Sep 7, 2015
2 parents 165affd + 769e609 commit 871d36b
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 4 deletions.
Binary file added docs/_static/databases-guide/pgadmin.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 41 additions & 4 deletions docs/databases_guide.rst
Expand Up @@ -56,7 +56,7 @@ as password by default.
- username: ``root``
- password: ``teracy``

We need a ``MySQL`` client, such as `MySQL Command-Line Tool`_, `MySQL Workbench`_, etc.
You need a ``MySQL`` client, such as `MySQL Command-Line Tool`_, `MySQL Workbench`_, etc.

- With *MySQL Command-Line Tool* to remote access from the guest machine:

Expand Down Expand Up @@ -194,8 +194,45 @@ PostgreSQL

#. Remote access

.. todo::
We need to support this by https://issues.teracy.org/browse/DEV-221
By default, the default port *5432* is forwarded to the guest machine, to remote access it, you
only need to specify the host ip address when required:

- host: the guest machine's IP address or *127.0.0.1* or *localhost* to access from the
guest machine

For example, from a guest machine:

.. code-block:: bash
$ psql -U postgres -h localhost
Type *teracy* as password when being prompted.

After that, you should see:

.. code-block:: bash
psql (9.3.9, server 9.1.18)
SSL connection (cipher: DHE-RSA-AES256-GCM-SHA384, bits: 256)
Type "help" for help.
postgres=#
You could replace *localhost* with *127.0.0.1*.

or from a different machine to the machine running the teracy-dev VM having ip: *192.168.1.111*

.. code-block:: bash
$ psql -U postgres -h 192.168.1.111
You could use terminal or any GUI clients to access the databases,
for example: http://www.pgadmin.org/ with the following screenshot:

.. image:: _static/databases-guide/pgadmin.png
:align: center


From now on you can start digging ``PostgreSQL`` database at: http://www.postgresql.org/docs/

Expand Down Expand Up @@ -283,7 +320,7 @@ MongoDB
We could replace *localhost* with *127.0.0.1*.

or from a different machine to the machine running the teracy-dev VM with ip: *192.168.1.111*
or from a different machine to the machine running the teracy-dev VM having ip: *192.168.1.111*

.. code-block:: bash
Expand Down
9 changes: 9 additions & 0 deletions main-cookbooks/teracy-dev/recipes/postgresql.rb
Expand Up @@ -11,6 +11,15 @@
node.override['postgresql']['version'] = node['teracy-dev']['postgresql']['version']
end

node.override['postgresql']['config']['listen_addresses'] = '*'

node.override['postgresql']['pg_hba'] = [
{:type => 'local', :db => 'all', :user => 'postgres', :addr => nil, :method => 'ident'},
{:type => 'local', :db => 'all', :user => 'all', :addr => nil, :method => 'ident'},
{:type => 'host', :db => 'all', :user => 'all', :addr => '0.0.0.0/0', :method => 'md5'},
{:type => 'host', :db => 'all', :user => 'all', :addr => '::1/128', :method => 'md5'}
]

node.override['postgresql']['password'] = node['teracy-dev']['postgresql']['password']

include_recipe 'postgresql::default'
Expand Down
4 changes: 4 additions & 0 deletions vagrant_config.json
Expand Up @@ -28,6 +28,10 @@
"guest":5000, //flask
"host":5000
},
{
"guest":5432, //postgreSQL
"host":5432
},
{
"guest":8000, //django
"host":8000
Expand Down

0 comments on commit 871d36b

Please sign in to comment.