PgEdge - Docker Compose Quick Start
Update February 26, 2024: A new pgEdge Docker project has been created, you can get started using the README here: https://github.com/pgEdge/pgedge-docker/tree/main
The goal of this guide is to efficiently establish a local pgEdge cluster with two nodes using Docker Compose. Leveraging the docker-compose tool in combination with .yaml
files in nodeCtl, you can create a cluster where each node features the pgEdge platform and a shared, replicated table.
To get started, use the following command to install the nodeCtl CLI:
python3 -c "$(curl -fsSL https://pgedge-download.s3.amazonaws.com/REPO/install.py)"
Then, move into the nodectl/docker
directory:
cd pgedge/docker
In this directory, you'll find a docker-compose.yaml
file that defines the infrastructure of both nodes. The file also contains a Docker.el9
file that will configure the instances, and copy the keys and the bootstrap.sh
file. Once the containers have started, this bootstrap file will install pgEdge, create the single table, and configure multi-master replication.
Use Docker Compose to build and start the containers:
docker-compose build
docker-compose up
Watching the logs, you will see the initialization of the Docker containers and networking. Then the bootstrap.sh
script will install the pgEdge platform (with PostgreSQL), and create a database named demo. It will install the spock extension, create a table named foobar, and configure replication for that table.
You can use the following command at the psql (or other Postgres client) command line to confirm that Docker Compose was successful:
SELECT * FROM spock.node;
In a successful run, the results show a record for each node in the cluster, in this case, two.
For next steps, you can modify bootstrap.sh
to create and replicate different tables, or connect to the container and modify the cluster via the CLI (check the Getting Started Guide or pgEdge documentation for more information about using the CLI). ./opt/pgedge/nodectl
To stop and remove a containers, invoke the following commands:
docker-compose down
docker-compose rm