software.cfg 11.7 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/zlib/buildout.cfg
18
    ../../component/icu/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 185
    ${:bundle} config --local build.pg --with-pg-config=${postgresql10:location}/bin/pg_config &&
    ${:bundle} config --local build.re2 --with-re2-dir=${re2:location}
186 187 188

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

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

201

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

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

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

#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
222
              && sed -i 's/.*--build.*/cmake --build . --target install/' script/build-libgit2-static.sh
223 224
              && make install
environment =
225 226
  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
227
  GOPATH=${gowork:directory}
228

229 230
[gowork.goinstall]
git2go = ${go_github.com_libgit2_git2go_prepare:path}/vendor/libgit2/install
231
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' ' ')"
232

233
[gowork]
234
golang  = ${golang1.12:location}
235 236 237
# 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
238
install =
239
  lab.nexedi.com/kirr/git-backup
240
cpkgpath =
241
    ${openssl-1.0:location}/lib/pkgconfig
242
    ${zlib:location}/lib/pkgconfig
243 244
    ${go_github.com_libgit2_git2go_prepare:path}/vendor/libgit2/install/lib/pkgconfig
buildflags = --tags "static"
245

246 247 248 249 250 251 252 253 254
[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}

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

261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
[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


276 277 278 279 280 281 282
[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
283 284 285 286 287 288 289 290 291 292 293 294 295 296

# 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

297

298 299 300 301 302 303 304 305 306
###############################
#   Trampoline for instance   #
###############################

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


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

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

325
[watcher]
326 327 328 329 330 331
<= binsh

[gitlab-export]
<= binsh


332

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

342
[database.yml.in]
343
<= download-file
344

345
[gitconfig.in]
346
<= download-file
347

348 349 350
[gitlab-parameters.cfg]
<= download-file

351
[gitlab-shell-config.yml.in]
352
<= download-file
353

354 355 356
[gitlab-unicorn-startup.in]
<= download-file

357
[gitlab.yml.in]
358
<= download-file
359

360 361 362
[gitaly-config.toml.in]
<= download-file

363 364
[instance-gitlab.cfg.in]
<= download-file
365

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

369 370 371
[instance-gitlab-test.cfg.in]
<= download-file

372 373 374
[macrolib.cfg.in]
<= download-file

375
[nginx-gitlab-http.conf.in]
376
<= download-file
377 378

[nginx.conf.in]
379
<= download-file
380

381
[rack_attack.rb.in]
382
<= download-file
383 384

[resque.yml.in]
385
<= download-file
386 387

[smtp_settings.rb.in]
388
<= download-file
389

390
[template-gitlab-resiliency-restore.sh.in]
391
<= download-file
392

393
[unicorn.rb.in]
394
<= download-file
395

396 397 398 399 400
[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
401 402

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