Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Okstad <pokstad@gitlab.com>2019-07-06 02:44:44 +0300
committerPaul Okstad <pokstad@gitlab.com>2019-07-06 02:44:44 +0300
commitbf1d9c3b9e5bbdfa3076ae500b45a20343e961eb (patch)
treeaaf5937a17a5d14328503de25e79f6e2fa545145
parent2375f7a95e0b0affc7e3439083b084af348505b4 (diff)
parent6924e8073ceaa210dee24bbbdd1cf13847502e7d (diff)
Merge branch 'jc-praefect-docker-compose' into 'master'
Adding docker-compose for praefect testing cluster See merge request gitlab-org/gitaly!1350
-rw-r--r--Dockerfile.praefect24
-rw-r--r--_support/praefect-cluster/.gitignore3
-rw-r--r--_support/praefect-cluster/README.md8
-rw-r--r--_support/praefect-cluster/config.praefect.toml36
-rw-r--r--_support/praefect-cluster/config.toml27
-rw-r--r--_support/praefect-cluster/docker-compose.yml37
6 files changed, 135 insertions, 0 deletions
diff --git a/Dockerfile.praefect b/Dockerfile.praefect
new file mode 100644
index 000000000..e3bb71779
--- /dev/null
+++ b/Dockerfile.praefect
@@ -0,0 +1,24 @@
+# This will create a docker image for Prafect that is suitable for testing, but
+# is not expected to be used in a production environment, yet.
+#
+# See the _support/load-cluster/docker-compose.yml for an example of how to use
+# this image
+#
+FROM registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.12-git-2.18
+
+WORKDIR /tmp/build
+
+COPY internal internal
+COPY auth auth
+COPY cmd cmd
+COPY client client
+COPY streamio streamio
+COPY go.mod go.sum ./
+
+WORKDIR /tmp/build/cmd/praefect
+
+RUN ["go", "build"]
+RUN ["mkdir", "-p", "/etc/gitaly"]
+RUN ["cp", "praefect", "/etc/gitaly/praefect"]
+CMD ["/etc/gitaly/praefect", "/etc/gitaly/config.praefect.toml"]
+
diff --git a/_support/praefect-cluster/.gitignore b/_support/praefect-cluster/.gitignore
new file mode 100644
index 000000000..06b873206
--- /dev/null
+++ b/_support/praefect-cluster/.gitignore
@@ -0,0 +1,3 @@
+/gitaly-backup-1
+/gitaly-backup-2
+/gitaly-primary
diff --git a/_support/praefect-cluster/README.md b/_support/praefect-cluster/README.md
new file mode 100644
index 000000000..cab4614b6
--- /dev/null
+++ b/_support/praefect-cluster/README.md
@@ -0,0 +1,8 @@
+# Test cluster with Praefect and multiple Gitaly servers
+
+This directory contains a
+[docker-compose.yml](https://docs.docker.com/compose/) that has Praefect and 3 Gitaly servers
+behind it. This setup is meant for testing purposes only and SHOULD NOT be used
+in production environments.
+
+Boot the cluster with `docker-compose up`. After some time you can connect to praefect on port 2305
diff --git a/_support/praefect-cluster/config.praefect.toml b/_support/praefect-cluster/config.praefect.toml
new file mode 100644
index 000000000..f0b3e8f0a
--- /dev/null
+++ b/_support/praefect-cluster/config.praefect.toml
@@ -0,0 +1,36 @@
+# Example Praefect configuration file
+
+# # TCP address to listen on
+listen_addr = ":2305"
+
+# # Praefect can listen on a socket when placed on the same machine as all clients
+ #socket_path = "/etc/gitaly/praefect/socket"
+# # Praefect will only replicate whitelisted repositories
+# whitelist = ["@hashed/2c/62/2c624232cdd221771294dfbb310aca000a0df6ac8b66b696d90ef06fdefb64a3.git"]
+# # Optional: export metrics via Prometheus
+# prometheus_listen_addr = "127.0.01:10101"
+
+# # You can optionally configure Praefect to output JSON-formatted log messages to stdout
+# [logging]
+# format = "json"
+# # Optional: Set log level to only log entries with that severity or above
+# # One of, in order: debug, info, warn, errror, fatal, panic
+# # Defaults to "info"
+# level = "warn"
+
+# # One or more Gitaly servers need to be configured to be managed. The names
+# of each server are used to link multiple nodes, or `gitaly_server`s together
+# as shard. listen_addr should be unique for all nodes.
+# Requires the protocol to be defined, e.g. tcp://host.tld:1234
+
+[primary_server]
+ name = "default"
+ listen_addr = "tcp://gitaly-primary:9999"
+
+[[secondary_server]]
+ name = "backup1"
+ listen_addr = "tcp://gitaly-backup-1:9999"
+
+[[secondary_server]]
+ name = "backup2"
+ listen_addr = "tcp://gitaly-backup-2:9999" \ No newline at end of file
diff --git a/_support/praefect-cluster/config.toml b/_support/praefect-cluster/config.toml
new file mode 100644
index 000000000..3c1ff277f
--- /dev/null
+++ b/_support/praefect-cluster/config.toml
@@ -0,0 +1,27 @@
+listen_addr = ":9999"
+prometheus_listen_addr = ":9236"
+bin_dir = "/app/_build/bin"
+
+# # Git executable settings
+[git]
+bin_path = "/usr/local/bin/git"
+
+[[storage]]
+name = "default"
+path = "/var/opt/gitlab/git-data"
+
+# # You can optionally configure Gitaly to record histogram latencies on GRPC method calls
+[prometheus]
+grpc_latency_buckets = [0.001, 0.005, 0.025, 0.1, 0.5, 1.0, 10.0, 30.0, 60.0, 300.0, 1500.0]
+
+[gitaly-ruby]
+# The directory where gitaly-ruby is installed
+dir = "/app/ruby"
+
+[gitlab-shell]
+# The directory where gitlab-shell is installed
+dir = "/app/gitlab-shell"
+
+[[concurrency]]
+rpc = "/gitaly.RepositoryService/GarbageCollect"
+max_per_repo = 1
diff --git a/_support/praefect-cluster/docker-compose.yml b/_support/praefect-cluster/docker-compose.yml
new file mode 100644
index 000000000..e115ebd55
--- /dev/null
+++ b/_support/praefect-cluster/docker-compose.yml
@@ -0,0 +1,37 @@
+version: "3.5"
+services:
+ praefect:
+ build:
+ context: ../../
+ dockerfile: Dockerfile.praefect
+ image: praefect:latest
+ depends_on:
+ - gitaly-primary
+ - gitaly-backup-1
+ - gitaly-backup-2
+ command: ["/etc/gitaly/praefect", "-config", "/etc/gitaly/config.praefect.toml"]
+ ports:
+ - "2305:2305"
+ volumes:
+ - ./config.praefect.toml:/etc/gitaly/config.praefect.toml
+ gitaly-primary:
+ image: registry.gitlab.com/gitlab-org/build/cng/gitaly:latest
+ expose:
+ - "9999"
+ volumes:
+ - ./gitaly-primary/data:/var/opt/gitlab/git-data
+ - ./config.toml:/etc/config/config.toml
+ gitaly-backup-1:
+ image: registry.gitlab.com/gitlab-org/build/cng/gitaly:latest
+ expose:
+ - "9999"
+ volumes:
+ - ./gitaly-backup-1/data:/var/opt/gitlab/git-data
+ - ./config.toml:/etc/config/config.toml
+ gitaly-backup-2:
+ image: registry.gitlab.com/gitlab-org/build/cng/gitaly:latest
+ expose:
+ - "9999"
+ volumes:
+ - ./gitaly-backup-2/data:/var/opt/gitlab/git-data
+ - ./config.toml:/etc/config/config.toml \ No newline at end of file