Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker-compose example #31

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ Once Memgraph cluster is up and running, you can access it using the provided se

To upgrade or uninstall a deployed Memgraph release, you can use the `helm upgrade` or `helm uninstall` commands, respectively. Refer to the [Helm documentation](https://helm.sh/docs/) for more details on these commands.

## Docker Compose

Creates HA Memgraph cluster with one command. The only thing you need to do is add your license details. Used bridged docker network for
communication.


## Contributing
Contributions are welcome! If you have any improvements, bug fixes, or new charts to add, please follow the contribution guidelines outlined in the [`CONTRIBUTING.md`](https://github.com/memgraph/helm-charts/blob/main/CONTRIBUTING.md) file. If you have questions and are unsure of how to contribute, please join our Discord server to get in touch with us.
Expand Down
7 changes: 7 additions & 0 deletions docker-compose/HA_register.cypher
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ADD COORDINATOR 2 WITH CONFIG {"bolt_server": "coord2:7691", "coordinator_server": "coord2:10112"};
ADD COORDINATOR 3 WITH CONFIG {"bolt_server": "coord3:7692", "coordinator_server": "coord3:10113"};

REGISTER INSTANCE instance_1 WITH CONFIG {"bolt_server": "instance1:7687", "management_server": "instance1:10011", "replication_server": "instance1:10001"};
REGISTER INSTANCE instance_2 WITH CONFIG {"bolt_server": "instance2:7688", "management_server": "instance2:10012", "replication_server": "instance2:10002"};
REGISTER INSTANCE instance_3 WITH CONFIG {"bolt_server": "instance3:7689", "management_server": "instance3:10013", "replication_server": "instance3:10003"};
SET INSTANCE instance_3 TO MAIN;
4 changes: 4 additions & 0 deletions docker-compose/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## Instructions
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you just elaborate on why this exists in this repository? "To test locally HA..."

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not? I think users should now that they must change license info

Copy link
Collaborator

@antejavor antejavor Jun 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, we have a misunderstanding 😄; I was referring to elaborate in README.md why the docker-compose exists and what is the idea behind it, not why the README.md exists.


This directory contains all necessary code needed to run your own highly-available Memgraph cluster with one command, `docker compose up`.
The only thing you need to do is add your `ORGANIZATION NAME` and `ENTERPRISE LICENSE` in license.cypher file.
73 changes: 73 additions & 0 deletions docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
networks:
antejavor marked this conversation as resolved.
Show resolved Hide resolved
memgraph_ha:
name: memgraph_ha
driver: bridge
ipam:
driver: default
config:
- subnet: "172.21.0.0/16"

services:
coord1:
image: "memgraph/memgraph"
container_name: coord1
volumes:
- ./license.cypher:/tmp/init/license.cypher:ro
- ./HA_register.cypher:/tmp/init/HA_register.cypher:ro
environment:
- MEMGRAPH_HA_CLUSTER_INIT_QUERIES=/tmp/init/HA_register.cypher
command: [ "--init-file=/tmp/init/license.cypher", "--log-level=TRACE", "--data-directory=/tmp/mg_data_coord1", "--log-file=/tmp/coord1.log", "--also-log-to-stderr", "--coordinator-id=1", "--coordinator-port=10111", "--coordinator-hostname=coord1", "--experimental-enabled=high-availability"]
networks:
memgraph_ha:
ipv4_address: 172.21.0.4

coord2:
image: "memgraph/memgraph"
container_name: coord2
volumes:
- ./license.cypher:/tmp/init/license.cypher:ro
command: [ "--init-file=/tmp/init/license.cypher", "--log-level=TRACE", "--data-directory=/tmp/mg_data_coord2", "--log-file=/tmp/coord2.log", "--also-log-to-stderr", "--coordinator-id=2", "--coordinator-port=10112", "--coordinator-hostname=coord2", "--experimental-enabled=high-availability"]
networks:
memgraph_ha:
ipv4_address: 172.21.0.2

coord3:
image: "memgraph/memgraph"
container_name: coord3
volumes:
- ./license.cypher:/tmp/init/license.cypher:ro
command: [ "--init-file=/tmp/init/license.cypher", "--log-level=TRACE", "--data-directory=/tmp/mg_data_coord3", "--log-file=/tmp/coord3.log", "--also-log-to-stderr", "--coordinator-id=3", "--coordinator-port=10113", "--coordinator-hostname=coord3", "--experimental-enabled=high-availability"]

networks:
memgraph_ha:
ipv4_address: 172.21.0.3

instance1:
image: "memgraph/memgraph"
container_name: instance1
volumes:
- ./license.cypher:/tmp/init/license.cypher:ro
command: ["--init-file=/tmp/init/license.cypher","--data-recovery-on-startup=true", "--log-level=TRACE", "--data-directory=/tmp/mg_data_instance1", "--log-file=/tmp/instance1.log", "--also-log-to-stderr", "--management-port=10011", "--experimental-enabled=high-availability"]
networks:
memgraph_ha:
ipv4_address: 172.21.0.6

instance2:
image: "memgraph/memgraph"
container_name: instance2
volumes:
- ./license.cypher:/tmp/init/license.cypher:ro
command: ["--init-file=/tmp/init/license.cypher","--data-recovery-on-startup=true", "--log-level=TRACE", "--data-directory=/tmp/mg_data_instance2", "--log-file=/tmp/instance2.log", "--also-log-to-stderr", "--management-port=10012", "--experimental-enabled=high-availability"]
networks:
memgraph_ha:
ipv4_address: 172.21.0.7

instance3:
image: "memgraph/memgraph"
container_name: instance3
volumes:
- ./license.cypher:/tmp/init/license.cypher:ro
command: ["--init-file=/tmp/init/license.cypher","--data-recovery-on-startup=true", "--log-level=TRACE", "--data-directory=/tmp/mg_data_instance3", "--log-file=/tmp/instance3.log", "--also-log-to-stderr", "--management-port=10013", "--experimental-enabled=high-availability"]
networks:
memgraph_ha:
ipv4_address: 172.21.0.8
2 changes: 2 additions & 0 deletions docker-compose/license.cypher
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SET DATABASE SETTING 'organization.name' TO '<YOUR_ORGANIZATION_NAME>';
SET DATABASE SETTING 'enterprise.license' TO '<YOUR_ENTERPRISE_LICENSE>';
Loading