Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save unkcpz/3846735193f9ddacadc598000aab9da1 to your computer and use it in GitHub Desktop.
Save unkcpz/3846735193f9ddacadc598000aab9da1 to your computer and use it in GitHub Desktop.

Revisions

  1. @ltalirz ltalirz revised this gist May 4, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion aiida-with-pg-rmq-containers.md
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ I could use `conda` as well, but docker provides the neat `docker-compose.yaml`
    Switch from previous setup with rabbitmq and postgresql installed via `macports` (could also be `brew`, manual compilation, ...) to a setup with containerized services.


    1. Copy your postgresql database directory to a new directory
    1. Copy your postgresql database directory to a new directory `db`
    2. Add the following lines to the `pg_hba.conf` file:
    ```
    # Note: the order is relevant! The first line that matches applies
  2. @ltalirz ltalirz created this gist May 4, 2021.
    60 changes: 60 additions & 0 deletions aiida-with-pg-rmq-containers.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,60 @@
    # Why?

    As of May 4th, 2021, `erlang` is not available from macports for the ARM (Apple Silicon) platform.
    Docker containers make it super easy to install postgresql and rabbitmq.

    The M1 chips have great parallelism, so I'd hope to be able to run docker without noticing the overhead too much.
    I could use `conda` as well, but docker provides the neat `docker-compose.yaml` that makes it possible to start up and shut down all the services required with a single command.

    # Task

    Switch from previous setup with rabbitmq and postgresql installed via `macports` (could also be `brew`, manual compilation, ...) to a setup with containerized services.


    1. Copy your postgresql database directory to a new directory
    2. Add the following lines to the `pg_hba.conf` file:
    ```
    # Note: the order is relevant! The first line that matches applies
    # TYPE DATABASE USER ADDRESS METHOD
    host all postgres host.docker.internal trust # give passwordless access to postgres user to your host
    host all all host.docker.internal md5 # password-protected access to all other users
    ```
    Note: If not on MacOS, `host.docker.internal` may not work (you can just try `all`)
    3. `docker-compose.yaml`
    ```yaml
    version: '3.4'
    services:
    rabbit:
    image: rabbitmq:3.8.3-management
    container_name: aiida-rmq
    environment:
    RABBITMQ_DEFAULT_USER: guest
    RABBITMQ_DEFAULT_PASS: guest
    ports:
    - '5672:5672'
    - '15672:15672'
    healthcheck:
    test: rabbitmq-diagnostics -q ping
    interval: 30s
    timeout: 30s
    retries: 5
    networks:
    - aiida-rmq
    postgresql:
    image: postgres:9
    container_name: aiida-postgres
    ports:
    - '5432:5432'
    networks:
    - aiida-rmq
    volumes:
    - ./db:/var/lib/postgresql/data
    networks:
    aiida-rmq:
    ```
    4. `docker-compose up -d`
    5. Install psql binaries (if not yet present). Try `psql -h localhost -U postgres` (should work without password)