71 lines
2.6 KiB
Markdown
71 lines
2.6 KiB
Markdown
# Bash DevOps Portfolio
|
|
|
|
This repository is a curated collection of production-minded Bash scripts for common DevOps and platform operations tasks.
|
|
The goal is to demonstrate practical shell scripting, defensive automation, clear documentation, and operational judgement.
|
|
|
|
## What Is Included
|
|
|
|
| Script | Purpose |
|
|
| --- | --- |
|
|
| `scripts/system_health_report.sh` | Collects CPU, memory, disk, network, and service health into a readable report. |
|
|
| `scripts/docker_cleanup.sh` | Safely removes unused Docker resources with dry-run support and retention controls. |
|
|
| `scripts/postgres_backup.sh` | Creates compressed PostgreSQL backups with validation and retention cleanup. |
|
|
| `scripts/deploy_static_site.sh` | Deploys static assets atomically with rollback-friendly release directories. |
|
|
| `scripts/tls_certificate_check.sh` | Checks HTTPS certificate expiry for one or more domains. |
|
|
| `scripts/log_rotate_archive.sh` | Archives and compresses old logs without relying on system logrotate configuration. |
|
|
| `scripts/linux_user_bootstrap.sh` | Creates a Linux user with SSH key access and optional sudo membership. |
|
|
|
|
## Repository Principles
|
|
|
|
- Scripts are documented in English and include usage examples.
|
|
- Scripts use strict mode where practical: `set -Eeuo pipefail`.
|
|
- Dangerous operations support a dry-run mode when appropriate.
|
|
- Inputs are validated before actions are executed.
|
|
- Output is designed for humans first, but remains easy to parse in CI logs.
|
|
- Dependencies are intentionally minimal and based on common Linux tooling.
|
|
|
|
## Quick Start
|
|
|
|
Clone the repository and inspect the scripts:
|
|
|
|
```bash
|
|
git clone https://git.elevartech.com.br/elevartech/bash.git
|
|
cd bash
|
|
ls scripts
|
|
```
|
|
|
|
Run a script with help:
|
|
|
|
```bash
|
|
bash scripts/system_health_report.sh --help
|
|
```
|
|
|
|
Run the syntax validation helper:
|
|
|
|
```bash
|
|
bash tests/syntax_check.sh
|
|
```
|
|
|
|
## Recommended Review Flow
|
|
|
|
Before using any script in production:
|
|
|
|
1. Read the script header and usage examples.
|
|
2. Run it with `--help`.
|
|
3. Prefer `--dry-run` for scripts that change state.
|
|
4. Test in a staging environment.
|
|
5. Review required permissions and environment variables.
|
|
|
|
## Portfolio Notes
|
|
|
|
These scripts are intentionally general-purpose. In a real company environment, they would usually be adapted to fit:
|
|
|
|
- Monitoring and alerting tools.
|
|
- Backup destinations and retention policies.
|
|
- Deployment topology.
|
|
- Secret management standards.
|
|
- Change control and approval workflows.
|
|
|
|
The value demonstrated here is not only Bash syntax. It is the operational discipline around automation: predictable inputs, explicit failure modes, safe defaults, readable logs, and documentation that helps another engineer maintain the work.
|
|
|