Skip to content

Instantly share code, notes, and snippets.

@alirezazadeh77
alirezazadeh77 / docker-compose-gitlab.yml
Last active December 31, 2023 15:55
script for back up from gitlab and setup
services:
gitlab:
image: 'gitlab/gitlab-ce:14.6.0-ce.0'
restart: always
hostname: 'localhost'
ports:
- "443:443"
- "80:80"
- "22:22"
environment:
@alirezazadeh77
alirezazadeh77 / resize_lvm_storage .sh
Last active January 13, 2023 15:12
allocate free storage from lvm disks
#!/bin/bash
# example:
# ./resize_lvm_storage.sh ubuntu-vg ubuntu-lv 99
SIZE=$3
LG=$1
LV=$2
vgdisplay $LG
lvextend -L +"$SIZE"G /dev/"$LG"/"$LV"
@alirezazadeh77
alirezazadeh77 / http_proxy-docker.conf
Last active January 13, 2023 14:51
setup proxy on docker pull
# add this file to /etc/systemd/system/docker.service.d (you need run mkdir /etc/systemd/system/docker.service.d) and rename file to "http_proxy.conf"
[Service]
Environment="HTTP_PROXY="
Environment="HTTPS_PROXY="
Environment="NO_PROXY=localhost,127.0.0.0/8,registry.example.com"
@alirezazadeh77
alirezazadeh77 / gitlab-runner-config-example.toml
Created January 13, 2023 14:37
a sample config for gitlab runner
concurrent = 1
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "gitlabrunner"
url = "https://localhost/"
token = "***************"
@alirezazadeh77
alirezazadeh77 / clear_registry.sh
Last active January 13, 2023 14:32
set up docker registry and clear data unuse layer script
#!/bin/bash
docker exec -it docker-registry-registry_server-1 registry garbage-collect -m /etc/docker/registry/config.yml
@alirezazadeh77
alirezazadeh77 / clear_prometheus_data.sh
Last active January 13, 2023 15:14
prometheus and grafana setup example
#!/bin/bash
# example:
# clear data more than 15 days
# ./clear_prometheus_data.sh https://localhost job_example 1296000
TIME=`date '+%s'`
TIME=`expr $TIME - $3`
BASE_DOMAIN=$1
@alirezazadeh77
alirezazadeh77 / bring_mem_and_cpu_online.sh
Created January 13, 2023 13:47
when upgrade your vm resource you can set up online bring resource without restart
#!/bin/bash
# Bring CPUs online
for CPU_DIR in /sys/devices/system/cpu/cpu[0-9]*
do
CPU=${CPU_DIR##*/}
echo "Found cpu: '${CPU_DIR}' ..."
CPU_STATE_FILE="${CPU_DIR}/online"
if [ -f "${CPU_STATE_FILE}" ]; then
if grep -qx 1 "${CPU_STATE_FILE}"; then
@alirezazadeh77
alirezazadeh77 / change_time.sh
Last active January 13, 2023 15:14
change linux date time to a specific time
#!/bin/bash
# example:
# set os time to 2022-12-15
# ./change_time.sh 2022-12-15
TIME=$1
timedatectl set-ntp 0
timedatectl set-time $TIME