Commit graph

168 commits

Author SHA1 Message Date
Kim Lindberger 415b9c3b5a
Merge pull request #157519 from talyz/gitlab-error-handling
nixos/gitlab: Implement better script error handling
2022-02-03 22:19:03 +01:00
talyz b65b9bf73c
nixos/gitlab: Implement better script error handling
Fail scripts on pipeline errors and propagate subshell errors.

If an error occurs in a subshell, including while trying to read a
secret file, we want that error to propagate to the main shell
context. That means we have to set the `inherit_errexit` option, which
allows errors from subshells to propagate to the outer shell. Also,
the subshell cannot run as part of another command, such as `export`,
since that will simply ignore the subshell exit status and only
respect `export`s exit status; first assigning the value to a variable
and then exporting it solves issue.
2022-01-31 13:09:20 +01:00
Lara 04560b9163 nixos/gitlab: Add additional paths to systemd.tmpfiles.rules
This fixes the NixOS gitlab test failure since gitlab 14.7.0.
2022-01-25 19:05:49 +01:00
Graham Christensen 06edb74413
Merge pull request #148785 from pennae/more-option-doc-staticizing
treewide: more defaultText for options
2021-12-17 11:14:08 -05:00
pennae ed673a69db treewide: add defaultText for options with simple cfg.* expression defaults
adds defaultText for options with defaults that use only literals, full config.*
paths, and the cfg shortcut binding.
2021-12-09 01:14:16 +01:00
pennae e24a8775a8 treewide: set defaultText for options using simple path defaults
adds defaultText for all options that set their default to a path expression
using the ubiquitous `cfg` shortcut bindings.
2021-12-09 01:12:13 +01:00
pennae 2512455639 nixos/*: add trivial defaultText for options with simple defaults 2021-12-02 22:35:04 +01:00
Naïm Favier 2ddc335e6f
nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
Lara fe034d33be nixos/gitlab: Enable roation of log files
This commit enables a logrotate service for gitlab using the default
values from omnibus. [1]

[1] https://gitlab.com/gitlab-org/omnibus-gitlab/-/blob/master/files/gitlab-cookbooks/gitlab/attributes/default.rb#L754

Resolves #136723
2021-09-15 09:57:18 +02:00
talyz 3dd17ae22f
gitlab: Enable puma's systemd notify support 2021-08-27 17:38:40 +02:00
talyz 99387372d5
gitlab: 14.1.2 -> 14.2.1 2021-08-26 19:01:22 +02:00
Yureka c5a0551dc4 nixos/gitlab: improve psql assertion message 2021-07-12 14:20:20 +02:00
Maciej Krüger ae54500506
Merge pull request #126253 from mkg20001/fc-gitlab 2021-07-06 20:58:12 +02:00
github-actions[bot] bae6b2055f
Merge master into staging-next 2021-06-25 12:06:04 +00:00
Yureka 2297eb35e5 nixos/gitlab: require at least postgresql 12 2021-06-25 01:21:19 +02:00
Maciej Krüger f4ddc02b0e
nixos/gitlab: add container registry 2021-06-09 23:19:25 +02:00
github-actions[bot] cf8441dd85
Merge staging-next into staging 2021-06-09 18:14:53 +00:00
talyz 8f16b16291
gitlab: Make sure the FOSS version isn't identified as EE 2021-06-09 17:50:45 +02:00
Maciej Krüger 7135ac0e00
nixos/gitlab: add extraEnv option
This allows users to define custom environment variables for gitlab, 
without having to modify the service file directly
2021-06-08 21:29:18 +02:00
Daniel Nagy cc5517da4c
nixos/gitlab: set port type to types.port 2021-05-30 14:38:20 +02:00
talyz 7842e89bfc
nixos/gitlab: Use replace-secret to avoid leaking secrets
Using `replace-literal` to insert secrets leaks the secrets through
the `replace-literal` process' `/proc/<pid>/cmdline`
file. `replace-secret` solves this by reading the secret straight from
the file instead, which also simplifies the code a bit.
2021-05-19 09:32:12 +02:00
Kim Lindberger fdd6ca8fce
Merge pull request #118898 from talyz/gitlab-memory-bloat
nixos/gitlab: Add options to tame GitLab's memory usage somewhat
2021-04-30 16:58:30 +02:00
talyz 7a67a2d1a8
gitlab: Add patch for db_key_base length bug, fix descriptions
The upstream recommended minimum length for db_key_base is 30 bytes,
which our option descriptions repeated. Recently, however, upstream
has, in many places, moved to using aes-256-gcm, which requires a key
of exactly 32 bytes. To allow for shorter keys, the upstream code pads
the key in some places. However, in many others, it just truncates the
key if it's too long, leaving it too short if it was to begin
with. This adds a patch that fixes this and updates the descriptions
to recommend a key of at least 32 characters.

See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/53602
2021-04-27 17:49:43 +02:00
talyz 6389170b39
nixos/gitlab: Set MALLOC_ARENA_MAX to "2"
This should reduce memory fragmentation drastically and is recommended
by both the Puma and the Sidekiq author. It's also the default value
for Ruby deployments on Heroku.
2021-04-10 10:49:31 +02:00
talyz 306fc0648b
nixos/gitlab: Add Sidekiq MemoryKiller support
Restart sidekiq automatically when it consumes too much memory. See
https://docs.gitlab.com/ee/administration/operations/sidekiq_memory_killer.html
for details.
2021-04-10 10:49:24 +02:00
talyz 6230936be2
nixos/gitlab: Add options to control puma worker and threads numbers 2021-04-10 10:49:18 +02:00
Milan Pässler e0d8f6b183
nixos/gitlab: do not set backup.upload by default 2021-04-07 09:21:18 +02:00
talyz 7b5cbde81f
nixos/gitlab: Gitlab -> GitLab 2021-03-30 19:13:43 +02:00
talyz 3fb04ca505
nixos/gitlab: Introduce automatic backup support
Add support for automatically backing up GitLab state, both locally
and to remote locations.
2021-03-30 19:13:31 +02:00
Milan 58804b24bc
nixos/gitlab: add option for tls wrapper-mode smtp (#116801) 2021-03-20 15:05:29 +01:00
talyz ca725e7fcd
nixos/gitlab: Add gitlab.target
To make it easier to start and stop all GitLab services, introduce
`gitlab.target` which wants all services (meaning they will start with
it) and which all services are part of (meaning they will stop with
it).
2021-02-26 19:54:23 +01:00
talyz 9d4e76dd46
nixos/gitlab: Make gitlab.service's PreStart into two new services
Make the config initialization script run in gitlab.service's PreStart
section into two new services, `gitlab-config.service` and
`gitlab-db-config.service`. Other services can then depend on the
config scripts they need instead of unnecessarily depending on
`gitlab.service`. This makes the reason for the configured service
dependencies much clearer and should also reduce the restart time of
the `gitlab` service quite a lot, when triggered manually.

Also, set up stricter service dependencies, using `bindsTo`, to ensure
that if a service fails or is stopped, its dependants are also
stopped. For example, if we're using the `postgresql` service and it's
stopped, `gitlab.service` and `gitlab-sidekiq.service`, which depend on
it to function, should also be stopped.
2021-02-26 19:54:05 +01:00
talyz 53d9ec83ff
nixos/gitlab: postgresql: Make PSQL a function, run as superUser
A function is more appropriate for this use. See
http://mywiki.wooledge.org/BashFAQ/050 for reference.

Also, we don't need to run the service as root: since we essentially
run all commands as `services.postgresql.superUser` anyway, the whole
service can just run as that user instead.
2021-02-24 18:32:31 +01:00
talyz 2b3800b9c7
nixos/gitlab: Change default SMTP port, enable postfix only if used
Change the default SMTP port to `25`, to better match the default
address `localhost`. This gets rid of some error outputs in the test,
where it fails to connect to localhost:465.

Also, don't enable postfix by default unless it's actually useful to
us.
2021-02-24 18:32:24 +01:00
talyz f8ab43ef7b
nixos/gitlab: Switch from unicorn to puma
Puma is the new upstream default server since GitLab 13.
2021-02-24 18:31:30 +01:00
talyz 2ec397ff9f
nixos/gitlab: Clean up the config dir more thoroughly
This removes all the subdirectories in `config` on start.

From one version of GitLab to the next, the files in the `config`
directory changes. Since we're only overwriting the existing files
with ones from the repo, cruft sometimes gets left behind,
occationally causing issues.

Ideally, all configuration put in the `config` directory is declared
by NixOS options and we could just remove the whole directory on
start, but I'm not sure if that's the case. It would also require a
little bit of additional rework and testing. The subdirectories,
however, should seldom contain user configuration and the ones that
frequently does, `initializers`, is already removed on start.
2021-02-24 18:31:24 +01:00
Jean-Paul Calderone 9338023577
Fix typo in the GitLab smtp auth options docs 2021-02-14 09:55:54 -05:00
Alyssa Ross 3893d6c6d7 gitAndTools: move everything to the top level
The comment at the top of git-and-tools/default.nix said:

    /* All git-relates tools live here, in a separate attribute set so that users
     * can get a fast overview over what's available.

but unfortunately that hasn't actually held up in practice.

Git-related packages have continued to be added to the top level, or
into gitAndTools, or sometimes both, basically at random, so having
gitAndTools is just confusing.  In fact, until I looked as part of
working on getting rid of gitAndTools, one program (ydiff) was
packaged twice independently, once in gitAndTools and once at the top
level (I fixed this in 98c3490196).

So I think it's for the best if we move away from gitAndTools, and
just put all the packages it previously contained at the top level.
I've implemented this here by just making gitAndTools an alias for the
top level -- this saves having loads of lines in aliases.nix.  This
means that people can keep referring to gitAndTools in their
configuration, but it won't be allowed to be used within Nixpkgs, and
it won't be presented to new users by e.g. nix search.

The only other change here that I'm aware of is that
appendToName "minimal" is not longer called on the default git
package, because doing that would have necessitated having a private
gitBase variable like before.  I think it makes more sense not to do
that anyway, and reserve the "minimal" suffix only for gitMinimal.
2021-01-14 21:27:48 +00:00
Jeff Slight 4bc2573a15
nixos/gitlab: move custom_hooks_dir into gitaly config (#107174) 2020-12-26 22:44:36 +01:00
Milan Pässler 81aff9f411 nixos/gitlab: use bindsTo instead of requires for gitaly 2020-11-26 14:12:14 +01:00
Graham Christensen bc49a0815a
utillinux: rename to util-linux 2020-11-24 12:42:06 -05:00
Milan Pässler 0f82bd767b nixos/gitlab: start gitaly after gitlab 2020-11-21 01:38:11 +01:00
Jeff Slight f98a6322e6 nixos/gitlab: add changes for gitlab 13.4.x 2020-11-20 19:26:30 +01:00
Florian Klink a6fec75d04
Merge pull request #93426 from helsinki-systems/feat/gitlab-pages
nixos/gitlab: Support pages
2020-10-11 23:50:19 +02:00
Janne Heß d85f50b71f
nixos/gitlab: Support pages
Fixes #84525
2020-09-01 12:08:36 +02:00
Jörg Thalheim b6e2e4c777
Merge pull request #93425 from helsinki-systems/feat/gitlab-shell-config 2020-08-21 19:20:42 +01:00
Florian Klink b7be00ad5e
Merge pull request #93358 from helsinki-systems/fix/gitlab-customrb
nixos/gitlab: Fix extra-gitlab.rb
2020-08-15 20:13:28 +02:00
Aaron Andersen 69eb22e4cd nixos/gitlab: fix module after #94454 2020-08-06 22:37:48 -04:00
Florian Klink 80c2d2e2af
Merge pull request #93423 from helsinki-systems/feat/gitlab-redis-url
nixos/gitlab: Make redis URL configurable
2020-07-22 19:05:28 +02:00
Janne Heß f459122ea3
nixos/gitlab: Support extra config for shell 2020-07-18 16:46:33 +02:00