Skip to content

Instantly share code, notes, and snippets.

stages:
- test
- build
- deploy
build:
stage: build
script:
- docker login $CI_REGISTRY -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD
- docker build -t $CI_REGISTRY/mygroup/myapp:$CI_COMMIT_SHA .
#!/bin/bash
# Default values
SSH_PORT=22
# File paths
NGINX_SSL_FILTER_PATH="/etc/fail2ban/filter.d/nginx-ssl.conf"
NGINX_4XX_FILTER_PATH="/etc/fail2ban/filter.d/nginx-4xx.conf"
NGINX_5XX_FILTER_PATH="/etc/fail2ban/filter.d/nginx-5xx.conf"
JAIL_LOCAL="/etc/fail2ban/jail.local"
@ncatallo
ncatallo / vps-setup-ssh-key.sh
Created May 8, 2025 10:48
This script setup ssh key to connect to server (to run on your local machine)
#!/bin/bash
# Default values
PORT=22
WITH_PASSPHRASE=false
# Parse CLI arguments
while [[ "$#" -gt 0 ]]; do
case $1 in
--server-name)
@ncatallo
ncatallo / vps-setup-nginx-ssl.sh
Last active May 10, 2025 07:44
This script install and setup a basic reverse proxy with nginx and add Let's encrypt automation to get SSL certificate
#!/bin/bash
# Parsing of --saas-domain and --port
PORT=3000 # Default port
while [[ "$#" -gt 0 ]]; do
case $1 in
--saas-domain)
SAAS_DOMAIN="$2"
shift 2
@ncatallo
ncatallo / vps-setup-firewall-fail2ban.sh
Last active May 9, 2025 16:50
This script setup UFW on your server to allow only 80 and 443 ports / SSH port if specified
#!/bin/bash
# Default values
SSH_ENABLE=false
SSH_PORT=22
SSH_ALLOW_FROM=""
RESET=false
# Args parsing
while [[ "$#" -gt 0 ]]; do
@ncatallo
ncatallo / vps-user-ssh-setup.sh
Last active May 8, 2025 11:46
This bash script setup a new user 'myuser' on your linux server and secure the SSH access.
#!/bin/bash
# Variables
USERNAME="myuser"
SSH_PORT=22
EDIT_SSH_PORT=false
SSHD_CONFIG="/etc/ssh/sshd_config"
BACKUP_CONFIG="${SSHD_CONFIG}.bak_$(date +%Y%m%d%H%M%S)"
# Args parsing