Commit 063e3bb5 authored by Stephane VAROQUI's avatar Stephane VAROQUI

Adding replication manager 2.1

parent 70f33f45
[buildout]
extends =
../../component/golang/buildout.cfg
parts =
repman
[gowork]
golang = ${golang1.12:location}
install =
buildflags = -v --tags server --ldflags "-extldflags 'static' -w -s -X main.GoOS=linux -X main.GoArch=amd64 -X main.Version=2.1 -X main.FullVersion=$FULLVERSION -X main.Build=$(date +%FT%T%z) -X main.WithProvisioning=ON -X main.WithOpenSVC=OFF -X main.WithHaproxy=ON -X main.WithMaxscale=ON -X main.WithMariadbshardproxy=ON -X main.WithProxysql=ON -X main.WithSphinx=ON -X main.WithArbitration=OFF -X main.WithArbitrationClient=ON -X main.WithMonitoring=ON -X main.WithHttp=ON -X main.WithBackup=ON -X main.WithMail=ON -X main.WithEnforce=ON -X main.WithDeprecate=ON"
[gowork.goinstall]
depends_gitfetch =
${git.signal18.io_signal18_repman:recipe}
command = . ${gowork:env.sh} &&
cd ${git.signal18.io_signal18_repman:location} &&
export GO111MODULE=on &&
export FULLVERSION=$(git describe --tags) &&
go build ${gowork:buildflags} -o ${gowork:bin}/replication-manager &&
chmod -R u+w .
# export VERSION=$(git describe --abbrev=0 --tags) &&
[git.signal18.io_signal18_repman]
<= go-git-package
go.importpath = github.com/signal18/replication-manager
repository = https://github.com/signal18/replication-manager
branch = 2.1
[repman]
# revision and repository can be used to control which repman version is used
depend = ${gowork:recipe}
output = ${gowork:bin}/replication-manager
revision = 2.1
recipe = collective.recipe.template
# Do something useless to pass
output = ${buildout:bin-directory}/${:_buildout_section_name_}
mode = 0755
input = inline:
#!/bin/sh
#############################
#
# Deploy replication-manager instance
#
#############################
[buildout]
parts =
directory
publish-connection-parameter
instance-parameter
template-jinja2-base
replication-manager
repman-promise
# Define egg directories to be the one from Software Release
# (/opt/slapgrid/...)
# Always the same.
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[instance-parameter]
# Fetch arbitrary parameters defined by the user in SlapOS Master for his instance.
# We use the slapconfiguration recipe with a few parameters (partition id,
# computer id, certificate, etc).
# It will then authenticate to SlapOS Master and fetch the instance parameters.
# The parameters are accessible from $${instance-parameter:configuration.name-of-parameter}
# Always the same. Just copy/paste.
# See docstring of slapos.cookbook:slapconfiguration for more information.
recipe = slapos.cookbook:slapconfiguration
computer = $${slap_connection:computer_id}
partition = $${slap_connection:partition_id}
url = $${slap_connection:server_url}
key = $${slap_connection:key_file}
cert = $${slap_connection:cert_file}
# Define default parameter(s) that will be used later, in case user didn't
# specify it.
# All possible parameters should have a default.
# In our use case, we are expecting from the user to specify one (optional) parameter: "name". We put the default value here if he doesn't specify it, so that it doesn't crash.
configuration.name = John Doe
# If our use case requires that the user can specify a mail address so that his instance can mail to him (for example), we can do:
# configuration.mail-address =
# If the user doesn't specify it, it won't break and the recipe can handle it (i.e don't send any mail for example).
# Create all needed directories, depending on your needs
[directory]
recipe = slapos.cookbook:mkdirectory
home = $${buildout:directory}
etc = $${:home}/etc
var = $${:home}/var
# Executables put here will be started but not monitored (for startup scripts)
script = $${:etc}/run/
# Executables put here will be started and monitored (for daemons)
service = $${:etc}/service
# Executables put here will be launched after buildout has completed to see
# if instance is running
promise = $${:etc}/promise/
# Path of the log directory used by our service (see [helloweb])
log = $${:var}/log
data = $${:var}/lib
[replication-manager]
# repman service is listening on:
# - global IPv6 address, and
# - fixed port
#
# NOTE because every computer partition is allocated its own global IPv6
# address, it is ok to fix the port - different hello-world instances will have
# different IPv6 addresses and they all will be accessible at the same time.
port = 10005
ipv6 = $${instance-parameter:ipv6-random}
# full URL - for convenience
url = https://[$${:ipv6}]:$${:port}
# the service will log here
logfile = $${directory:log}/repman.log
# Actual script that starts the service:
# This recipe will try to "exec" the command-line after separating parameters.
recipe = slapos.cookbook:wrapper
command-line =
software_release/go.work/bin/replication-manager --monitoring-save-config=true --monitoring-basedir=system --monitoring-sharedir=software_release/src/share --http-root=software_release/src/dashboard --monitoring-datadir=$${directory:var}/lib --config=$${directory:etc}/config.toml --log-file=$${:logfile} monitor
# Put this shell script in the "etc/service" directory. Each executable of this
# repository will be started and monitored by supervisord. If a service
# exits/crashes, it will trigger a "bang" and cause a re-run of the instance.
wrapper-path = $${directory:service}/replication-manager
name = config.toml
[template-jinja2-base]
recipe = slapos.recipe.template:jinja2
template = ${download-config-toml:destination}
rendered =$${directory:etc}/config.toml
extra-context =
context = key service_ipv6 replication-manager:ipv6
# promise, that checks that helloweb service is alive
[repman-promise]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promise}/replication-manager-ipv6
hostname= $${replication-manager:ipv6}
port = 10005
# Publish all the parameters needed for the user to connect to the instance.
# It can be anything: URL(s), password(s), or arbitrary parameters.
# Here we'll just echo back the entered name as instance parameter
[publish-connection-parameter]
recipe = slapos.cookbook:publish
name = Hello $${instance-parameter:configuration.name}!
url = $${replication-manager:url}
[buildout]
extends =
../../stack/slapos.cfg
../../stack/monitor/buildout.cfg
../../component/replication-manager/buildout.cfg
../../component/git/buildout.cfg
parts =
slapos-cookbook
download-config-toml
template
repman
repman-repository
[template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
mode = 0644
output = ${buildout:directory}/template.cfg
filename = instance.cfg.in
[download-config-toml]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/templates/config.toml.in
destination = ${buildout:directory}/config.toml.in
mode = 644
# Pin versions of eggs used that are not already pinned by stack/slapos.cfg
[versions]
slapos.recipe.template = 4.3
rubygemsrecipe = 0.2.2+slapos001
[repman-repository]
recipe = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git
location = ${buildout:directory}/src
branch = 2.1
repository = https://github.com/signal18/replication-manager
[Default]
api-bind = "[{{service_ipv6}}]"
http-bind-address = "[{{service_ipv6}}]"
monitoring-save-config = true
api-https-bind = true
[cluster1]
title = "cluster1"
db-servers-hosts = "[2408:5180:0:43::d2a5]:3306,[2409:5180:0:43::d2a5]:3306"
db-servers-prefered-master = "127.0.0.1:3310"
db-servers-credential = "root:test"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment