Skip to content

Instantly share code, notes, and snippets.

View rubi022's full-sized avatar
💭
I may be slow to respond.

rubi022

💭
I may be slow to respond.
View GitHub Profile
@rubi022
rubi022 / gist:844bd80bf918ca6bff24489e51b61b51
Created July 26, 2024 04:28
cloud-init image creation
============================================================================================================
============================================================================================================
# download the image
wget https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img
# create a new VM with VirtIO SCSI controller
qm create 9000 --memory 2048 --net0 virtio,bridge=vmbr0 --scsihw virtio-scsi-pci
# import the downloaded disk to the local-lvm storage, attaching it as a SCSI drive
qm set 9000 --scsi0 local-lvm:0,import-from=/path/to/bionic-server-cloudimg-amd64.img
@rubi022
rubi022 / PostgreSQL-BackupAndRestore.md
Created July 18, 2024 06:23 — forked from agungsptr/PostgreSQL-BackupAndRestore.md
PostgreSQL - Backup and Restore

PostgreSQL Backup and Restore

Backup

Backup to .sql file

pg_dump -U username -d db_name -h host_name > out_filename.sql

# If using docker
docker container exec -it container_name pg_dump -U username -d db_name -h host_name > out_filename.sql
@rubi022
rubi022 / install.sh
Created July 18, 2024 06:22
linuxQuickStart
#!/usr/bin/env bash
function cleanup() {
echo "Cleaning up..."
sudo rm -f /etc/sudoers.d/ubuntu_nopasswd
}
function install_brew() {
$(which sudo) apt-get update
$(which sudo) apt-get install -y sudo curl git
@rubi022
rubi022 / add
Last active December 17, 2023 06:25
https://cp.bulletservers.net/
https://bulletservers.net/
Add these sites to uptime.
we want to monitor uptime and if they go down we must act quickly to bring back these up.
https://statsup.xyz
https://app.statsup.xyz
https://postpi.xyz
https://app.postpi.xyz
root@zeus-H370M:~# zpool list
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
one 3.62T 1.20T 2.42T - - 0% 33% 1.00x ONLINE -
root@zeus-H370M:~# df -h | grep one
one 2.4T 128K 2.4T 1% /mount/vol/one
cd /mount/vol/one
@rubi022
rubi022 / INIT_VAULT.md
Created January 8, 2023 08:49 — forked from moertel/INIT_VAULT.md
Try Vault with MySQL storage backend (via Docker)

Initialise (will return keys and a token)

curl -X PUT http://0.0.0.0:8200/v1/sys/init --data '{"secret_shares":1, "secret_threshold":1}'

Use one of the keys to unseal

curl -X PUT http://0.0.0.0:8200/v1/sys/unseal --data '{"key":"a5e665962f544dd16471c120c5500a7906cfbaeb3f18ae0fc6c5c71d444f0a90"}'

Use the root token to store something

@rubi022
rubi022 / gist:553972b98f2936acdfea236c6d5de508
Last active May 22, 2022 11:03
proxmox cloudinit templates
qm create 9007 --memory 2048 --net0 virtio,bridge=vmbr0
# import the downloaded disk to local-lvm storage
qm importdisk 9007 CentOS-7-x86_64-GenericCloud-2111.qcow2 cru-zfs
# finally attach the new disk to the VM as scsi drive
qm set 9007 --scsihw virtio-scsi-pci --scsi0 cru-zfs:vm-9007-disk-0
import 14gb file mysql
`
mysql -u root -p
set global net_buffer_length=1000000; --Set network buffer length to a large byte number
set global max_allowed_packet=1000000000; --Set maximum allowed packet size to a large byte number
# ----------------------------------------------------------------------
# WARNING - do not edit this template unless you know what you are doing
# ----------------------------------------------------------------------
# the parent cache
# disk and memory cache settings
cache_dir ufs /usr/local/squid/var/cache 500 16 256 #set your cache path with size
I ran into the battle of running all of my VMs and the host node under a single public IP address. Luckily, the host is just pure Debian, and ships with iptables.
What needs to be done is essentially to run all the VMs on a private internal network. Outbound internet access is done via NAT. Inbound access is via port forwarding.
Network configuration
Here’s how it’s done:
Create a virtual interface that serves as the gateway for your VMs: