Skip to content

Commit 955b722

Browse files
committed
Document how to setup a local Postgres DB
1 parent 12cf19e commit 955b722

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

doc/install-adv.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,37 @@ If you want to use :meth:`.visualize` or run the test suite, the Graphviz progra
137137
If you install MESSAGEix :ref:`using conda <using-conda>`, Graphviz is installed automatically via `its conda-forge package`_.
138138
For other methods of installation (such as :program:`pip`) see the `Graphviz download page`_ for downloads and instructions for your system.
139139

140+
.. _install-postgres:
141+
142+
PostgreSQL (optional)
143+
---------------------
144+
145+
The new ixmp4 package is `only feature-complete <https://github.com/iiasa/ixmp4/pull/190>`__ when using `PostgreSQL <https://www.postgresql.org/>`__.
146+
If you want to work on such a database locally, you need to get an instance running locally.
147+
This is explained `in ixmp4 <https://github.com/iiasa/ixmp4/blob/main/DEVELOPING.md#running-tests-with-postgresql>`__, but here are the most important points:
148+
149+
- The easiest way to do that is by using `docker <https://www.docker.com/>`__, so make sure it is installed on your system or follow `their instructions <https://docs.docker.com/engine/install/>`__.
150+
- Get the latest version of the official PostgreSQL image by running in your terminal::
151+
152+
docker pull postgres
153+
154+
- Finally, run the container using::
155+
156+
docker run -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=ixmp-test -p 5432:5432 -d postgres
157+
158+
.. note::
159+
The values for `POSTGRES_PASSWORD` and `POSTGRES_DB` are chosen to set up a database instance that is found by :mod:`ixmp`'s default configuration.
160+
You are free to choose different values here, but will have to adapt the configuration, too, in that case.
161+
162+
.. tip::
163+
ixmp4 provides `a docker compose file <https://github.com/iiasa/ixmp4/blob/main/tests/docker-compose.yml>`__ that lets you achieve the above in a single command (once everything is installed).
164+
If you install ixmp4 from source, you have the file on your system and can use it straight away.
165+
Alternatively, you can copy the contents of this file to a location of your choosing.
166+
To use it, run this in your terminal (with the appropriate path to the file)::
167+
168+
docker-compose -f docker-compose.yml up
169+
170+
140171
Install |MESSAGEix|
141172
===================
142173

0 commit comments

Comments
 (0)