chore(snippets): review recently used commands

This commit is contained in:
Michele Cereda
2024-05-29 22:42:04 +02:00
parent 74f795bf11
commit 48f6eb9548
3 changed files with 46 additions and 8 deletions

27
snippets/cloud-init.sh Normal file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env sh
##
# Re-run everything.
##
# 1. Clean the existing configuration.
sudo cloud-init clean --logs
# 2. Detect local data sources.
sudo cloud-init init --local
# 3. Detect any data source requiring the network and run the 'initialization' modules.
sudo cloud-init init
# 4. Run the 'configuration' modules.
sudo cloud-init modules --mode='config'
# 5. Run the 'final' modules.
sudo cloud-init modules -m 'final'
# All together now!
sudo cloud-init clean --logs
sudo cloud-init init --local
sudo cloud-init init
sudo cloud-init modules --mode='config'
sudo cloud-init modules -m 'final'

View File

@@ -1,7 +1,19 @@
#!/bin/sh
#!/usr/bin/env sh
# sources:
# - https://stevenmortimer.com/5-steps-to-change-github-default-branch-from-master-to-main/
##
# Remove files from the latest commit.
# The easiest way is to use `git gui`: 'Commit' => 'Amend Last Commit' => uncheck the files => 'Commit'.
##
git reset --soft HEAD~1 # or `git reset --soft HEAD^`
git restore --staged '.lefthook-local.yml' # or `git reset HEAD '.lefthook-local.yml'`
git commit -c ORIG_HEAD
##
# Change the default branch from 'master' to 'main'.
# Source: https://stevenmortimer.com/5-steps-to-change-github-default-branch-from-master-to-main/
##
# create main branch locally, taking the history from master
git branch --move 'master' 'main'

View File

@@ -84,12 +84,11 @@ gitlab-rails runner '
# Package upgrade
sudo yum check-update
sudo yum info 'gitlab-ee' # informational
sudo rpm -qa | grep 'gitlab-ee' # informational
sudo yum info 'gitlab-ee' # informational
sudo rpm -qa | grep 'gitlab-ee' # informational
sudo yum --showduplicates list available 'gitlab-ee'
sudo gitlab-backup create # not strictly necessary: the upgrade will create a partial one
tmux new-session -A -s 'gitlab-upgrade' "sudo yum update 'gitlab-ee'"
tmux new-session -A -s 'gitlab-upgrade' "sudo yum update 'gitlab-ee-16.11.3'"
sudo gitlab-backup create # not strictly necessary: the upgrade will create a partial one
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'
# Password reset