diff options
Diffstat (limited to 'doc/administration/operations')
11 files changed, 205 insertions, 2 deletions
diff --git a/doc/administration/operations/cleaning_up_redis_sessions.md b/doc/administration/operations/cleaning_up_redis_sessions.md index d2aec2f7c47..a94f88439f2 100644 --- a/doc/administration/operations/cleaning_up_redis_sessions.md +++ b/doc/administration/operations/cleaning_up_redis_sessions.md @@ -1,3 +1,9 @@ +--- +stage: none +group: unassigned +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +--- + # Cleaning up stale Redis sessions Since version 6.2, GitLab stores web user sessions as key-value pairs in Redis. diff --git a/doc/administration/operations/extra_sidekiq_processes.md b/doc/administration/operations/extra_sidekiq_processes.md index e589ecc4216..76dc9bf5510 100644 --- a/doc/administration/operations/extra_sidekiq_processes.md +++ b/doc/administration/operations/extra_sidekiq_processes.md @@ -1,3 +1,9 @@ +--- +stage: none +group: unassigned +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +--- + # Run multiple Sidekiq processes **(CORE ONLY)** GitLab allows you to start multiple Sidekiq processes. diff --git a/doc/administration/operations/fast_ssh_key_lookup.md b/doc/administration/operations/fast_ssh_key_lookup.md index 6cd393be330..88ef69b29f2 100644 --- a/doc/administration/operations/fast_ssh_key_lookup.md +++ b/doc/administration/operations/fast_ssh_key_lookup.md @@ -1,3 +1,9 @@ +--- +stage: none +group: unassigned +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +--- + # Fast lookup of authorized SSH keys in the database > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/1631) in [GitLab Starter](https://about.gitlab.com/pricing/) 9.3. @@ -114,7 +120,6 @@ This is a brief overview. Please refer to the above instructions for more contex 1. Enable writes to the `authorized_keys` file in Application Settings 1. Remove the `AuthorizedKeysCommand` lines from `/etc/ssh/sshd_config` or from `/assets/sshd_config` if you are using Omnibus Docker. 1. Reload `sshd`: `sudo service sshd reload` -1. Remove the `/opt/gitlab-shell/authorized_keys` file ## Compiling a custom version of OpenSSH for CentOS 6 diff --git a/doc/administration/operations/filesystem_benchmarking.md b/doc/administration/operations/filesystem_benchmarking.md index 64afd1b44f3..c55f253b772 100644 --- a/doc/administration/operations/filesystem_benchmarking.md +++ b/doc/administration/operations/filesystem_benchmarking.md @@ -1,3 +1,9 @@ +--- +stage: none +group: unassigned +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +--- + # Filesystem Performance Benchmarking Filesystem performance has a big impact on overall GitLab performance, diff --git a/doc/administration/operations/index.md b/doc/administration/operations/index.md index 45b8e5ad448..aaeb8c723d0 100644 --- a/doc/administration/operations/index.md +++ b/doc/administration/operations/index.md @@ -1,3 +1,9 @@ +--- +stage: none +group: unassigned +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +--- + # Performing Operations in GitLab Keep your GitLab instance up and running smoothly. diff --git a/doc/administration/operations/moving_repositories.md b/doc/administration/operations/moving_repositories.md index 4763c012538..94eea1e25b8 100644 --- a/doc/administration/operations/moving_repositories.md +++ b/doc/administration/operations/moving_repositories.md @@ -1,3 +1,9 @@ +--- +stage: none +group: unassigned +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +--- + # Moving repositories managed by GitLab Sometimes you need to move all repositories managed by GitLab to diff --git a/doc/administration/operations/puma.md b/doc/administration/operations/puma.md index f5b09d7a978..2d53a790428 100644 --- a/doc/administration/operations/puma.md +++ b/doc/administration/operations/puma.md @@ -1,3 +1,9 @@ +--- +stage: none +group: unassigned +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +--- + # Switching to Puma As of GitLab 12.9, [Puma](https://github.com/puma/puma) has replaced [Unicorn](https://yhbt.net/unicorn/) diff --git a/doc/administration/operations/rails_console.md b/doc/administration/operations/rails_console.md new file mode 100644 index 00000000000..9db9a885baf --- /dev/null +++ b/doc/administration/operations/rails_console.md @@ -0,0 +1,144 @@ +# The Rails Console + +The [Rails console](https://guides.rubyonrails.org/command_line.html#rails-console). +provides a way to interact with your GitLab instance from the command line. + +CAUTION: **Caution:** +The Rails console interacts directly with GitLab. In many cases, +there are no handrails to prevent you from permanently modifying, corrupting +or destroying production data. If you would like to explore the Rails console +with no consequences, you are strongly advised to do so in a test environment. + +The Rails console is for GitLab system administrators who are troubleshooting +a problem or need to retrieve some data that can only be done through direct +access of the GitLab application. + +## Starting a Rails console session + +**For Omnibus installations** + +```shell +sudo gitlab-rails console +``` + +**For installations from source** + +```shell +sudo -u git -H bundle exec rails console -e production +``` + +**For Kubernetes deployments** + +The console is in the task-runner pod. Refer to our [Kubernetes cheat sheet](../troubleshooting/kubernetes_cheat_sheet.md#gitlab-specific-kubernetes-information) for details. + +To exit the console, type: `quit`. + +## Output Rails console session history + +Enter the following command on the rails console to display +your command history. + +```ruby +puts Readline::HISTORY.to_a +``` + +You can then copy it to your clipboard and save for future reference. + +## Using the Rails Runner + +If you need to run some Ruby code in the context of your GitLab production +environment, you can do so using the [Rails Runner](https://guides.rubyonrails.org/command_line.html#rails-runner). +When executing a script file, the script must be accessible by the `git` user. + +When the command or script completes, the Rails Runner process finishes. +It is useful for running within other scripts or cron jobs for example. + +**For Omnibus installations** + +```shell +sudo gitlab-rails runner "RAILS_COMMAND" + +# Example with a two-line Ruby script +sudo gitlab-rails runner "user = User.first; puts user.username" + +# Example with a ruby script file (make sure to use the full path) +sudo gitlab-rails runner /path/to/script.rb +``` + +**For installations from source** + +```shell +sudo -u git -H bundle exec rails runner -e production "RAILS_COMMAND" + +# Example with a two-line Ruby script +sudo -u git -H bundle exec rails runner -e production "user = User.first; puts user.username" + +# Example with a ruby script file (make sure to use the full path) +sudo -u git -H bundle exec rails runner -e production /path/to/script.rb +``` + +Rails Runner does not produce the same output as the console. + +If you set a variable on the console, the console will generate useful debug output +such as the variable contents or properties of referenced entity: + +```ruby +irb(main):001:0> user = User.first +=> #<User id:1 @root> +``` + +Rails Runner does not do this: you have to be explicit about generating +output: + +```shell +$ sudo gitlab-rails runner "user = User.first" +$ sudo gitlab-rails runner "user = User.first; puts user.username ; puts user.id" +root +1 +``` + +Some basic knowledge of Ruby will be very useful. Try [this +30-minute tutorial](https://try.ruby-lang.org/) for a quick introduction. +Rails experience is helpful but not essential. + +### Troubleshooting Rails Runner + +The `gitlab-rails` command executes Rails Runner using a non-root account and group, by default: `git:git`. + +If the non-root account cannot find the Ruby script filename passed to `gitlab-rails runner` +you may get a syntax error, not an error that the file couldn't be accessed. + +A common reason for this is that the script has been put in the root account's home directory. + +`runner` tries to parse the path and file parameter as Ruby code. + +For example: + +```plaintext +[root ~]# echo 'puts "hello world"' > ./helloworld.rb +[root ~]# sudo gitlab-rails runner ./helloworld.rb +Please specify a valid ruby command or the path of a script to run. +Run 'rails runner -h' for help. + +/opt/gitlab/..../runner_command.rb:45: syntax error, unexpected '.' +./helloworld.rb +^ +[root ~]# sudo gitlab-rails runner /root/helloworld.rb +Please specify a valid ruby command or the path of a script to run. +Run 'rails runner -h' for help. + +/opt/gitlab/..../runner_command.rb:45: unknown regexp options - hllwrld +[root ~]# mv ~/helloworld.rb /tmp +[root ~]# sudo gitlab-rails runner /tmp/helloworld.rb +hello world +``` + +A meaningful error should be generated if the directory can be accessed, but the file cannot: + +```plaintext +[root ~]# chmod 400 /tmp/helloworld.rb +[root ~]# sudo gitlab-rails runner /tmp/helloworld.rb +Traceback (most recent call last): + [traceback removed] +/opt/gitlab/..../runner_command.rb:42:in `load': cannot load such file -- /tmp/helloworld.rb (LoadError) +``` diff --git a/doc/administration/operations/sidekiq_memory_killer.md b/doc/administration/operations/sidekiq_memory_killer.md index d1ff98a0079..d99468411e3 100644 --- a/doc/administration/operations/sidekiq_memory_killer.md +++ b/doc/administration/operations/sidekiq_memory_killer.md @@ -1,3 +1,9 @@ +--- +stage: none +group: unassigned +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +--- + # Sidekiq MemoryKiller The GitLab Rails application code suffers from memory leaks. For web requests @@ -8,7 +14,7 @@ MemoryKiller applies the same approach to the Sidekiq processes used by GitLab to process background jobs. Unlike puma-worker-killer, which is enabled by default for all GitLab -installations since GitLab 13.0, the Sidekiq MemoryKiller is enabled by default +installations of GitLab 13.0 and later, the Sidekiq MemoryKiller is enabled by default _only_ for Omnibus packages. The reason for this is that the MemoryKiller relies on runit to restart Sidekiq after a memory-induced shutdown and GitLab installations from source do not all use runit or an equivalent. diff --git a/doc/administration/operations/ssh_certificates.md b/doc/administration/operations/ssh_certificates.md index c81eb15955d..7cbd8c74f90 100644 --- a/doc/administration/operations/ssh_certificates.md +++ b/doc/administration/operations/ssh_certificates.md @@ -1,3 +1,9 @@ +--- +stage: none +group: unassigned +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +--- + # User lookup via OpenSSH's AuthorizedPrincipalsCommand > [Available in](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/19911) GitLab diff --git a/doc/administration/operations/unicorn.md b/doc/administration/operations/unicorn.md index a1593c3a6c3..80dafde14aa 100644 --- a/doc/administration/operations/unicorn.md +++ b/doc/administration/operations/unicorn.md @@ -1,3 +1,9 @@ +--- +stage: none +group: unassigned +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +--- + # Understanding Unicorn and unicorn-worker-killer NOTE: **Note:** |