software.cfg 11.9 KB
Newer Older
1 2 3
# GitLab software-release
[buildout]
extends =
4
    buildout.hash.cfg
5
    ../../stack/slapos.cfg
6
    ../../stack/monitor/buildout.cfg
7 8 9 10 11 12 13 14 15 16
    ../../component/ruby/buildout.cfg
    ../../component/golang/buildout.cfg
    ../../component/postgresql/buildout.cfg
    ../../component/redis/buildout.cfg
    ../../component/cmake/buildout.cfg
    ../../component/icu/buildout.cfg
    ../../component/pkgconfig/buildout.cfg
    ../../component/nodejs/buildout.cfg
    ../../component/openssl/buildout.cfg
    ../../component/nginx/buildout.cfg
17
    ../../component/xz-utils/buildout.cfg
18
    ../../component/zlib/buildout.cfg
19
    gowork.cfg
20

21
#   for instance
22
    ../../component/coreutils/buildout.cfg
23
    ../../component/bash/buildout.cfg
24
    ../../component/grep/buildout.cfg
25
    ../../component/bzip2/buildout.cfg
26
    ../../component/curl/buildout.cfg
27
    ../../component/tar/buildout.cfg
28 29 30 31
    ../../component/gzip/buildout.cfg
    ../../component/dcron/buildout.cfg
    ../../component/logrotate/buildout.cfg

32
parts =
33
    ruby2.3
34
    golang1.12
35
    git
36
    postgresql10
37 38 39 40 41 42
    redis28
    cmake
    icu
    pkgconfig
    nginx-output

43
    gowork
44 45
    gitlab-workhorse
    gitaly-build
46
    python-4gitlab
47 48
    gitlab-shell/vendor
    gitlab/vendor/bundle
49
    gitlab_npm
50
    github-markup-patch
51
    gitlab-backup
52

53 54 55 56 57 58
#   for instance
    instance.cfg

    slapos-cookbook
    eggs

59 60
    bash
    curl
61
    watcher
62
    gitlab-export
63 64 65 66
    gzip
    dcron-output
    logrotate

67 68 69
[slapos.cookbook-repository]
revision = 571d6514f7290e8faa9439c4b86aa2f6c87df261

70 71 72 73 74 75 76

[yarn]
# need this version of Yarn
recipe = slapos.recipe.build:download-unpacked
url = https://github.com/yarnpkg/yarn/releases/download/v1.3.2/yarn-v1.3.2.tar.gz
md5sum = db82fa09c996e9318f2f1d2ab99228f9

77 78 79 80
############################
#   Software compilation   #
############################

81 82
# python with eggs, that will be used in gitlab
[python-4gitlab]
83
recipe  = zc.recipe.egg
84 85 86 87
interpreter = python2
eggs    =
    docutils

88 89 90
# rubygemsrecipe with fixed url and this way pinned rubygems version
[rubygemsrecipe]
recipe  = rubygemsrecipe
91
url     = https://rubygems.org/rubygems/rubygems-3.1.2.zip
92 93 94 95 96 97

# bundler, that we'll use to
# - install gems for gitlab
# - run gitlab services / jobs  (via `bundle exec ...`)
[bundler-4gitlab]
<= rubygemsrecipe
98
ruby-location = ${ruby2.3:location}
99
ruby-executable = ${:ruby-location}/bin/ruby
100 101
gems    =
  bundler==1.17.3
102 103 104

# bin installed here
bundle  = ${buildout:bin-directory}/bundle
105 106
# Gitaly need bundler 1.17.3 which is not the default version at the end
bundle1.17.3 = ${buildout:parts-directory}/${:_buildout_section_name_}/lib/ruby/gems/1.8/gems/bundler-1.17.3/exe/
107 108 109 110 111 112 113 114 115 116 117

# install together with dependencies of gitlab, which we cannot specify using
#   --with-... gem option
# ( reason: rubygemsrecipe hardcodes PATH inside generated bin/* and it is
#   impossible to adjust it later )
#
# bundle exec <smth>                ; <smth> starts with `#!/usr/bin/env ruby` as rubygems
# Rugged needs: cmake, pkgconfig
# execjs needs: nodejs
# rails needs db client program on path: psql
# gitlab wants to check redis version via running: redis-cli
118 119 120
# gitlab wants git to be really on path ( it uses git from abspath defined in
#   gitlab.yml, but there are not all cases like this, e.g. in
#   https://gitlab.com/gitlab-org/gitlab_git/blob/2f0d3c1a/lib/gitlab_git/repository.rb#L259 )
121 122
# gitlab (via github-markup) wants to convert rst -> html via running: python2 (with docutils egg)
# (python-4gitlab puts interpreter into ${buildout:bin-directory})
123
environment =
124 125

  PATH    = ${yarn:location}/bin:${:ruby-location}/bin:${cmake:location}/bin:${pkgconfig:location}/bin:${nodejs-8.12.0:location}/bin:${postgresql10:location}/bin:${redis28:location}/bin:${git:location}/bin:${buildout:bin-directory}:%(PATH)s
126 127 128 129 130 131 132 133 134 135


# gitlab, gitlab-shell & gitlab-workhorse checked out as git repositories
# pinned to exact commit
[git-repository]
recipe  = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git

[gitlab-repository]
<= git-repository
136
repository = https://lab.nexedi.com/nexedi/gitlab-ce.git
137 138
# 9.5.10 + NXD patches:
revision = v9.5.10-8-gc290e22a08cb
139 140 141 142
location = ${buildout:parts-directory}/gitlab

[gitlab-shell-repository]
<= git-repository
143 144 145 146
#repository = https://lab.nexedi.com/nexedi/gitlab-shell.git
repository = https://gitlab.com/gitlab-org/gitlab-shell.git
# gitlab 9.5.10 wants gitlab-shell 5.6.1
revision = v5.6.1-10-g1e587d3b7f
147 148
location = ${buildout:parts-directory}/gitlab-shell

149 150 151 152 153 154 155 156 157 158 159 160
[gitaly-repository]
<= git-repository
repository = https://gitlab.com/gitlab-org/gitaly.git
# for version v0.35.0 (gitlab 9.5.10)
revision = v0.35.0-0-gf99a57b19a
location = ${buildout:parts-directory}/gitaly

[gitlab-workhorse-repository]
<= git-repository
repository = https://lab.nexedi.com/nexedi/gitlab-workhorse.git
revision = v3.0.0-8-g74793ad3cc

161 162 163 164 165
# Patch github markup to not call "python2 -S /path/to/rest2html" but only "python2 /path/to/rest2html"
# NOTE github-markup invokes it as `python2`, that's why we are naming it this way
# https://github.com/github/markup/blob/5393ae93/lib/github/markups.rb#L36
[github-markup-patch]
recipe = plone.recipe.command
166 167 168
command =
  files=$(ls ${gitlab-repository:location}/vendor/bundle/ruby/*/gems/git*-markup-*/lib/github/markups.rb) || true
  if [ ! -z "$files" ]; then
169 170 171 172 173 174
    for file in $files; do
      sed -i 's#python2 -S#python2#' $file
    done
  fi
update-command = ${:command}
stop-on-error = True
175 176 177 178 179 180 181 182 183

# build needed-by-gitlab gems via bundler
[gitlab/vendor/bundle]
recipe  = slapos.recipe.cmmi
path    = ${gitlab-repository:location}
bundle  = ${bundler-4gitlab:bundle}

configure-command = cd ${:path} &&
    ${:bundle} config --local build.charlock_holmes --with-icu-dir=${icu:location}  &&
184
    ${:bundle} config --local build.pg --with-pg-config=${postgresql10:location}/bin/pg_config &&
185 186
    ${:bundle} config --local build.re2 --with-re2-dir=${re2:location} &&
    ${:bundle} config --local build.nokogiri --with-zlib-dir=${zlib:location} --with-cflags=-I${xz-utils:location}/include --with-ldflags="-L${xz-utils:location}/lib -Wl,-rpath=${xz-utils:location}/lib"
187 188 189

make-binary =
make-targets= cd ${:path} &&
190 191
    ${:bundle} install --deployment  --without development test mysql aws kerberos
environment =
192
  PKG_CONFIG_PATH=${openssl-1.0:location}/lib/pkgconfig:${re2:location}/lib/pkgconfig:${xz-utils:location}/lib/pkgconfig
193
  PATH=${pkgconfig:location}/bin:%(PATH)s
194
  CFLAGS=-I${xz-utils:location}/include
195 196 197 198 199 200 201 202

################## Google re2
[re2]
recipe = slapos.recipe.cmmi
url = https://github.com/google/re2/archive/2019-12-01.tar.gz
md5sum = 527eab0c75d6a1a0044c6eefd816b2fb
configure-command = :

203

204 205 206 207 208 209 210 211 212
[gitlab_npm]
recipe  = slapos.recipe.cmmi
path    = ${gitlab-repository:location}

configure-command = :
make-binary =
make-targets= cd ${:path} && npm install

environment =
213
  PATH=${nodejs-8.12.0:location}/bin/:%(PATH)s
214 215 216 217 218 219 220 221 222 223

#our go infrastructure not currently supporting submodules, IIRC
# https://lab.nexedi.com/nexedi/slapos/merge_requests/337
[go_github.com_libgit2_git2go_prepare]
recipe  = slapos.recipe.cmmi
path = ${go_github.com_libgit2_git2go:location}
configure-command = :
make-binary =
make-targets= cd ${go_github.com_libgit2_git2go:location}
              && git submodule update --init
224
              && sed -i 's/.*--build.*/cmake --build . --target install/' script/build-libgit2-static.sh
225 226
              && make install
environment =
227 228
  PKG_CONFIG_PATH=${openssl-1.0:location}/lib/pkgconfig:${zlib:location}/lib/pkgconfig
  PATH=${cmake:location}/bin:${pkgconfig:location}/bin:${git:location}/bin:${golang1.12:location}/bin:${buildout:bin-directory}:%(PATH)s
229
  GOPATH=${gowork:directory}
230

231 232
[gowork.goinstall]
git2go = ${go_github.com_libgit2_git2go_prepare:path}/vendor/libgit2/install
233
command = bash -c ". ${gowork:env.sh} && CGO_CFLAGS=-I${:git2go}/include CGO_LDFLAGS='-L${:git2go}/lib -lgit2' go install ${gowork:buildflags} -v $(echo -n '${gowork:install}' |tr '\n' ' ')"
234

235
[gowork]
236
golang  = ${golang1.12:location}
237 238 239
# gitlab.com/gitlab-org/gitlab-workhorse
# gitlab.com/gitlab-org/gitlab-workhorse/cmd/gitlab-zip-cat
# gitlab.com/gitlab-org/gitlab-workhorse/cmd/gitlab-zip-metadata
240
install =
241
  lab.nexedi.com/kirr/git-backup
242
cpkgpath =
243
    ${openssl-1.0:location}/lib/pkgconfig
244
    ${zlib:location}/lib/pkgconfig
245 246
    ${go_github.com_libgit2_git2go_prepare:path}/vendor/libgit2/install/lib/pkgconfig
buildflags = --tags "static"
247

248 249 250 251 252 253 254 255 256
[gitlab-workhorse]
recipe = slapos.recipe.cmmi
path = ${gitlab-workhorse-repository:location}
md5sum = 2988c944d58c4a08880498c4981cc7b7
configure-command = :
make-binary =
make-targets = 
  . ${gowork:env.sh} && make install PREFIX=${gowork:directory}

257
[gitlab-backup]
258 259
recipe = plone.recipe.command
command =
260
  cp -a ${go_lab.nexedi.com_kirr_git-backup:location}/contrib/gitlab-backup ${gowork:bin}
261
update-command = ${:command}
262

263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
[gitaly-build]
recipe = slapos.recipe.cmmi
path = ${gitaly-repository:location}
bundle  = ${bundler-4gitlab:bundle}

configure-command = cd ${:path}/ruby &&
    ${:bundle} config --local build.charlock_holmes --with-icu-dir=${icu:location}
make-binary =
make-targets =
  . ${gowork:env.sh} && make
environment =
  PKG_CONFIG_PATH=${openssl-1.0:location}/lib/pkgconfig:${icu:location}/lib/pkgconfig
  PATH=${pkgconfig:location}/bin:${ruby2.3:location}/bin:%(PATH)s


278 279 280 281 282 283 284
[xnice-repository]
# to get kirr's misc repo containing xnice script for executing processes
# with lower priority (used for backup script inside the cron)
<= git-repository
repository = https://lab.nexedi.com/kirr/misc.git
revision =  4073572ea700bf1b115f3a135aebebe5b3b824e4
location = ${buildout:parts-directory}/misc
285 286 287 288 289 290 291 292 293 294 295 296 297 298

# build needed-by-gitlab-shell gems via bundler
# ( there is not vendor/ dir in gitlab-shell, so to avoid having buildout error
#   on mkdir vendor/bundle, this part name is just /vendor )
[gitlab-shell/vendor]
recipe  = slapos.recipe.cmmi
path    = ${gitlab-shell-repository:location}
bundle  = ${bundler-4gitlab:bundle}

configure-command = true
make-binary =
make-targets= cd ${:path} &&
    ${:bundle} install --deployment  --without development test

299

300 301 302 303 304 305 306 307 308
###############################
#   Trampoline for instance   #
###############################

# eggs for instance.cfg
[eggs]
recipe  = zc.recipe.egg
eggs    =
    plone.recipe.command
309
    cns.recipe.symlink
310
    collective.recipe.template
311 312 313 314


[instance.cfg]
recipe  = slapos.recipe.template
315
url     = ${:_profile_base_location_}/${:filename}
316 317
output  = ${buildout:directory}/instance.cfg

318 319
# macro: download a shell script and put it rendered into <software>/bin/
[binsh]
320
recipe  = slapos.recipe.template:jinja2
321
template= ${:_profile_base_location_}/${:_update_hash_filename_}
322 323 324 325 326
rendered= ${buildout:bin-directory}/${:_buildout_section_name_}
mode    = 0755
context =
    section bash    bash

327
[watcher]
328 329 330 331 332 333
<= binsh

[gitlab-export]
<= binsh


334

335
# macro: download a file named in buildout.hash.cfg via _update_hash_filename_
336 337 338 339 340
#
#   [filename]
#   <= download-file
[download-file]
recipe  = slapos.recipe.build:download
341
url     = ${:_profile_base_location_}/${:_update_hash_filename_}
342 343
destination = ${buildout:directory}/${:_buildout_section_name_}

344
[database.yml.in]
345
<= download-file
346

347
[gitconfig.in]
348
<= download-file
349

350 351 352
[gitlab-parameters.cfg]
<= download-file

353
[gitlab-shell-config.yml.in]
354
<= download-file
355

356 357 358
[gitlab-unicorn-startup.in]
<= download-file

359
[gitlab.yml.in]
360
<= download-file
361

362 363 364
[gitaly-config.toml.in]
<= download-file

365 366
[instance-gitlab.cfg.in]
<= download-file
367

368 369 370
[instance-gitlab-export.cfg.in]
<= download-file

371 372 373
[instance-gitlab-test.cfg.in]
<= download-file

374 375 376
[macrolib.cfg.in]
<= download-file

377
[nginx-gitlab-http.conf.in]
378
<= download-file
379 380

[nginx.conf.in]
381
<= download-file
382

383
[rack_attack.rb.in]
384
<= download-file
385 386

[resque.yml.in]
387
<= download-file
388 389

[smtp_settings.rb.in]
390
<= download-file
391

392
[template-gitlab-resiliency-restore.sh.in]
393
<= download-file
394

395
[unicorn.rb.in]
396
<= download-file
397

398 399 400 401 402
[gitlab-demo-backup.git]
recipe = hexagonit.recipe.download
url = https://lab.nexedi.com/alain.takoudjou/labdemo.backup/repository/archive.tar.gz?ref=master
md5sum = d40e5e211dc9a4e5ada9c0250377c639
strip-top-level-dir = true
403 404

[versions]
405
cns.recipe.symlink = 0.2.3
406
docutils = 0.12
407
plone.recipe.command = 1.1
408 409
rubygemsrecipe = 0.2.2+slapos002
slapos.recipe.template = 4.3
410
z3c.recipe.scripts = 1.0.1