mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-09 05:44:23 +00:00
chore(gitlab): signals, improve upgrade commands
This commit is contained in:
@@ -668,3 +668,13 @@
|
||||
acme_version: 2
|
||||
account_key_src: path/to/acme_account.key.pem
|
||||
certificate: path/to/certificate.crt.pem
|
||||
|
||||
- name: GitLab
|
||||
block:
|
||||
- name: Install configured fleeting plugins
|
||||
when: runner_executor in [ "docker-autoscaler", "instance" ]
|
||||
become: true
|
||||
ansible.builtin.command:
|
||||
chdir: /root
|
||||
cmd: gitlab-runner fleeting install
|
||||
creates: /root/.config/fleeting/plugins
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# Sources:
|
||||
# - https://everything.curl.dev/usingcurl/connections/name.html
|
||||
|
||||
|
||||
# Use different names.
|
||||
# Kinda like '--resolve' but to aliases and supports ports.
|
||||
curl --connect-to 'super.fake.domain:443:localhost:8443' 'https://super.fake.domain'
|
||||
@@ -10,3 +11,14 @@ curl --connect-to 'super.fake.domain:443:localhost:8443' 'https://super.fake.dom
|
||||
# Forcefully resolve hosts to given addresses.
|
||||
# The resolution *must* be an address, not an FQDN.
|
||||
curl --resolve 'super.fake.domain:8443:127.0.0.1' 'https://super.fake.domain:8443'
|
||||
|
||||
|
||||
curl -fs 'https://gitlab.com/api/v4/runners/all?per_page=100&paused=false' -H 'PRIVATE-TOKEN: glpat-m-…'
|
||||
curl --url 'https://gitlab.com/api/v4/runners/all' \
|
||||
--fail --silent \
|
||||
--header 'PRIVATE-TOKEN: glpat-m-…' \
|
||||
--url-query 'per_page=100' --url-query 'paused=false'
|
||||
|
||||
curl -fsX 'PUT' 'https://gitlab.com/api/v4/runners/{}' -H 'PRIVATE-TOKEN: glpat-m-…' -F 'paused=true'
|
||||
curl --fail --silent --request 'PUT' 'https://gitlab.com/api/v4/runners/{}' \
|
||||
--header 'PRIVATE-TOKEN: glpat-m-…' --form 'paused=true'
|
||||
|
||||
@@ -25,6 +25,7 @@ gitlab-runner register --url 'https://gitlab.example.com' --registration-token '
|
||||
|
||||
# Just list configured runners
|
||||
gitlab-runner list -c '/etc/gitlab-runner/config.toml'
|
||||
curl -fs 'https://gitlab.com/api/v4/runners/all?per_page=100' -H 'PRIVATE-TOKEN: glpat-m-…'
|
||||
|
||||
# Check configured runners can connect to the main instance
|
||||
gitlab-runner verify -c '/etc/gitlab-runner/config.toml'
|
||||
@@ -36,6 +37,20 @@ curl -fs 'https://gitlab.com/api/v4/runners/all?status=offline&per_page=100' -H
|
||||
| jq '.[].id' \
|
||||
| xargs -I 'runner_id' curl -fsX 'DELETE' "https://gitlab.com/api/v4/runners/runner_id" 'PRIVATE-TOKEN: glpat-m-…'
|
||||
|
||||
# Force reloading the configuration file
|
||||
sudo kill -HUP $(pidof 'gitlab-runner')
|
||||
sudo kill -s 'SIGHUP' $(pgrep 'gitlab-runner')
|
||||
|
||||
# Stop accepting new builds and exit as soon as currently running builds finish
|
||||
# A.K.A. graceful shutdown
|
||||
sudo kill -QUIT $(pgrep 'gitlab-runner')
|
||||
sudo kill -s 'SIGQUIT' $(pidof 'gitlab-runner')
|
||||
|
||||
# Pause active runners
|
||||
curl -fs 'https://gitlab.com/api/v4/runners/all?per_page=100&paused=false' -H 'PRIVATE-TOKEN: glpat-m-…' \
|
||||
| jq '.[].id' - \
|
||||
| xargs -I '{}' curl -fsX 'PUT' 'https://gitlab.com/api/v4/runners/{}' -H 'PRIVATE-TOKEN: glpat-m-…' -F 'paused=true'
|
||||
|
||||
|
||||
###
|
||||
# docker+machine executor
|
||||
|
||||
@@ -121,6 +121,14 @@ sudo gitlab-ctl backup-etc
|
||||
tmux new-session -A -s 'gitlab-upgrade' "sudo yum update 'gitlab-ee'" # 'gitlab-ee-16.11.3' if version-specific
|
||||
sudo gitlab-rake 'gitlab:check'
|
||||
|
||||
# DB version upgrade
|
||||
sudo gitlab-ctl pg-upgrade
|
||||
sudo gitlab-ctl pg-upgrade -V '16'
|
||||
# Check there is enough disk space for two copies of the database
|
||||
test $(( $(sudo du -s '/var/opt/gitlab/postgresql/data' | awk '{print $1}') * 2 )) -lt \
|
||||
$(sudo df --output='avail' --direct '/var/opt/gitlab/postgresql/data' | tail -n 1) \
|
||||
&& sudo gitlab-ctl pg-upgrade -V '16'
|
||||
|
||||
# Password reset
|
||||
sudo gitlab-rake 'gitlab:password:reset[root]'
|
||||
sudo gitlab-rails console
|
||||
|
||||
23
snippets/process management.sh
Normal file
23
snippets/process management.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# https://askubuntu.com/questions/180336/how-to-find-the-process-id-pid-of-a-running-terminal-program
|
||||
# https://bash.cyberciti.biz/guide/Sending_signal_to_Processes
|
||||
|
||||
# Find process IDs
|
||||
pidof 'gitlab-runner'
|
||||
pgrep 'gitlab-runner'
|
||||
# Limit search to specific owners
|
||||
pgrep -u 'root,daemon' 'sshd'
|
||||
|
||||
|
||||
# List available signals
|
||||
kill -l
|
||||
|
||||
# Send signals to processes
|
||||
kill -9 '1234'
|
||||
kill -KILL '1234'
|
||||
kill -SIGKILL '1234'
|
||||
kill -s 'SIGHUP' '3969'
|
||||
pkill -KILL 'firefox'
|
||||
pkill --signal 'HUP' 'prometheus'
|
||||
killall -s 'SIGKILL' 'firefox-bin'
|
||||
Reference in New Issue
Block a user