From 529034368b443666970dd4d52c438cdc6991c5b9 Mon Sep 17 00:00:00 2001 From: nickdante Date: Thu, 6 Aug 2026 15:36:08 +0300 Subject: [PATCH] Readme update and separation --- README.md | 131 ++--------------------------------- landing_page/README.md | 32 +++++++++ postgres_10_docker/README.md | 94 +++++++++++++++++++++++++ wireguard_scripts/README.md | 111 +++++++++++++++++++++++++++++ 4 files changed, 243 insertions(+), 125 deletions(-) create mode 100644 landing_page/README.md create mode 100644 postgres_10_docker/README.md create mode 100644 wireguard_scripts/README.md diff --git a/README.md b/README.md index 2476406..30fcfd3 100644 --- a/README.md +++ b/README.md @@ -2,130 +2,11 @@ TopStore server setup of postgresql in docker, automation scripts, landing page and adding more as it do progress -# Landing Page +## Structure -A professional, high-performance landing page designed for a dual-purpose automotive business (parts retail and mechanical servicing). The site features a clean, "Inter" font-driven aesthetic with a bold red-and-dark-grey color palette. +The entire project is divided in a couple of smaller part. At a certain point it may be required to separate everything per repository. -## Core Features - - * Bilingual Support (RO/EN): Full site translation between Romanian and English using a data-attribute-driven JavaScript system. - * Smart Language Detection: Automatically detects the user’s browser language on first visit and remembers preferences via localStorage. - * Optimized Mobile Experience: Fully responsive grid system that collapses into a single-column stack for mobile devices. - * Conversion-Focused UI: - * Prominent Hero CTA buttons. - * Custom-built Phone Selection Modal to direct users to specific service lines. - * "Tap-to-call" and "Tap-to-email" integration for mobile users. - * Dynamic Elements: Auto-updating copyright year and smooth "fade-in" transitions for translated text to prevent "Flash of Unstyled Content" (FOUC). - -## Technical Stack - - * HTML5/CSS3: Utilizes CSS Variables for easy branding updates and a CSS Grid/Flexbox layout. - * JavaScript (Vanilla): Lightweight script handles the modal logic and the translation engine without external dependencies. - * Google Fonts: Integrated "Inter" typeface with multiple weights (400, 700, 900). - -## File Structure - - * index.html: The semantic structure containing both English and Romanian strings in data- attributes. - * style.css: Modern styling including a "glassmorphism" modal overlay and responsive media queries. - * /assets: Recommended directory for the company logo and favicon. - -## Setup & Customization - - 1. Map Integration: Update the iframe src attributes in the contact-info section with your specific Google Maps embed codes. - 2. Contact Details: Replace the phone numbers and email address in both the contact-details and modal-overlay sections. - 3. Images: The hero background is currently linked to a high-quality Unsplash image; this can be swapped in style.css under the .hero class. - -# Potgres 10 Docker for Trade software - -A robust, containerized Postgres 10 setup designed for production environments. It includes automated hourly/daily backups, custom configuration management, and a comprehensive management script. - -## Quick Start - -Configure Environment: Create a .env file in the root directory (see Environment Variables). - -Run Setup: Initialize directories and permissions. This will create and set the right permissions for `config`, `pgdata` and `backups` folders: - -```cmd -./manage_db.sh setup -``` - -Make sure that the right folders are created. Inside `config/` there must be `pg_hba.conf` and `postgresql.conf`. The files are created based on [config_template](postgres_10_docker/config_template/) folder or from docker template files. - -Start Services: Launch the database and backup containers: - -```cmd -./manage_db.sh run -``` - -## Features - - * **Database:** `PostgreSQL 10` with persisted data in `./pgdata`. - * **Custom Config:** Uses external `postgresql.conf` and `pg_hba.conf` for fine-tuning. - * **Automatic Backups:** Scheduled backups using `postgres-backup-local` with configurable retention. - * **Timezone Sync:** Containers automatically sync with the host system time. - * **Health Checks:** Backup service waits for the database to be fully "Ready" before starting. - * **Security:** Configuration files are mounted as Read-Only inside the container. - -## Project Structure - - * `manage_db.sh`: The main entry point for managing the stack. - * `config/`: Contains PostgreSQL configuration files (generated during setup). - * `pgdata/`: Persistent storage for the database (Postgres UID 999). - * `backups/`: Location for compressed .sql.gz backup files. - -## Environment Variables (.env) - -Ensure the following variables are defined in your `.env` file: - - * **POSTGRES_USER**: Database administrator username - `admin` - * **POSTGRES_PASSWORD**: Database administrator password - `securepassword` - * **POSTGRES_DB**: Name of the primary database - `db` - * **TZ**: System timezone `UTC` - * **BACKUP_SCHEDULE**: Cron schedule for backups - `0 0 * * * (Daily)` - * **BACKUP_RETENTION_DAYS**: How many days to keep backups - `7` - -## Management Script Usage - -The `manage_db.sh` script simplifies common Docker commands: - -Command Description: - * Creates folders, sets permissions, and extracts config templates. - ```cmd - ./manage_db.sh setup - ``` - - * Starts all services in detached mode. - ```cmd - ./manage_db.sh run - ``` - - * Stops the containers. - ```cmd - ./manage_db.sh stop - ``` - - * Shows running status and resource usage (CPU/RAM). - ```cmd - ./manage_db.sh status - ``` - - * Tails logs for all services. - ```cmd - ./manage_db.sh logs - ``` - * Jumps directly into the Postgres SQL prompt. - ```cmd - ./manage_db.sh psql - ``` - * Triggers a manual backup immediately. - ```cmd - ./manage_db.sh backup - ``` - * Restores a database from a .gz or .dump file. - ```cmd - ./manage_db.sh restore - ``` - -## Security & Permissions - -During the setup phase, the script applies `chown -R 999:999` to the data and config folders. This matches the internal postgres user ID used by the official Docker image, ensuring the container has the necessary rights to write data and read configurations. \ No newline at end of file +Projects, helper scripts and web page: + * [landing_page](landing_page) - a simple landing page to promote the auto service. + * [postgres_10_docker](postgres_10_docker) - docker environment with backup mechanism to handle postgresql database used by Trade software. + * [wireguard_scripts](wireguard_scripts) - helper script to add and remove automatically new clients. Used in webmin for easier access and use. diff --git a/landing_page/README.md b/landing_page/README.md new file mode 100644 index 0000000..56fe04f --- /dev/null +++ b/landing_page/README.md @@ -0,0 +1,32 @@ +# Landing Page + +A professional, high-performance landing page designed for a dual-purpose automotive business (parts retail and mechanical servicing). The site features a clean, "Inter" font-driven aesthetic with a bold red-and-dark-grey color palette. + +## Core Features + + * Bilingual Support (RO/EN): Full site translation between Romanian and English using a data-attribute-driven JavaScript system. + * Smart Language Detection: Automatically detects the user’s browser language on first visit and remembers preferences via localStorage. + * Optimized Mobile Experience: Fully responsive grid system that collapses into a single-column stack for mobile devices. + * Conversion-Focused UI: + * Prominent Hero CTA buttons. + * Custom-built Phone Selection Modal to direct users to specific service lines. + * "Tap-to-call" and "Tap-to-email" integration for mobile users. + * Dynamic Elements: Auto-updating copyright year and smooth "fade-in" transitions for translated text to prevent "Flash of Unstyled Content" (FOUC). + +## Technical Stack + + * HTML5/CSS3: Utilizes CSS Variables for easy branding updates and a CSS Grid/Flexbox layout. + * JavaScript (Vanilla): Lightweight script handles the modal logic and the translation engine without external dependencies. + * Google Fonts: Integrated "Inter" typeface with multiple weights (400, 700, 900). + +## File Structure + + * [index.html](index.html): The semantic structure containing both English and Romanian strings in data- attributes. + * [style.css](style.css): Modern styling including a "glassmorphism" modal overlay and responsive media queries. + * [assets/](assets/): Recommended directory for the company logo and favicon. + +## Setup & Customization + + 1. Map Integration: Update the iframe src attributes in the contact-info section with your specific Google Maps embed codes. + 2. Contact Details: Replace the phone numbers and email address in both the contact-details and modal-overlay sections. + 3. Images: The hero background is currently linked to a high-quality Unsplash image; this can be swapped in style.css under the .hero class. \ No newline at end of file diff --git a/postgres_10_docker/README.md b/postgres_10_docker/README.md new file mode 100644 index 0000000..d7f7324 --- /dev/null +++ b/postgres_10_docker/README.md @@ -0,0 +1,94 @@ +# Potgres 10 Docker for Trade software + +A robust, containerized Postgres 10 setup designed for production environments. It includes automated hourly/daily backups, custom configuration management, and a comprehensive management script. + +## Quick Start + +Configure Environment: Create a .env file in the root directory (see Environment Variables). + +Run Setup: Initialize directories and permissions. This will create and set the right permissions for `config`, `pgdata` and `backups` folders: + +```cmd +./manage_db.sh setup +``` + +Make sure that the right folders are created. Inside `config/` there must be `pg_hba.conf` and `postgresql.conf`. The files are created based on [config_template](postgres_10_docker/config_template/) folder or from docker template files. + +Start Services: Launch the database and backup containers: + +```cmd +./manage_db.sh run +``` + +## Features + + * **Database:** `PostgreSQL 10` with persisted data in `./pgdata`. + * **Custom Config:** Uses external `postgresql.conf` and `pg_hba.conf` for fine-tuning. + * **Automatic Backups:** Scheduled backups using `postgres-backup-local` with configurable retention. + * **Timezone Sync:** Containers automatically sync with the host system time. + * **Health Checks:** Backup service waits for the database to be fully "Ready" before starting. + * **Security:** Configuration files are mounted as Read-Only inside the container. + +## Project Structure + + * [manage_db.sh](manage_db.sh): The main entry point for managing the stack. + * [config/](config/): Contains PostgreSQL configuration files (generated during setup). + * [pgdata/](pgdata/): Persistent storage for the database (Postgres UID 999). + * [backups/](backups/): Location for compressed .sql.gz backup files. + +## Environment Variables (.env) + +Ensure the following variables are defined in your `.env` file: + + * **POSTGRES_USER**: Database administrator username - `admin` + * **POSTGRES_PASSWORD**: Database administrator password - `securepassword` + * **POSTGRES_DB**: Name of the primary database - `db` + * **TZ**: System timezone `UTC` + * **BACKUP_SCHEDULE**: Cron schedule for backups - `0 0 * * * (Daily)` + * **BACKUP_RETENTION_DAYS**: How many days to keep backups - `7` + +## Management Script Usage + +The `manage_db.sh` script simplifies common Docker commands: + +Command Description: + * Creates folders, sets permissions, and extracts config templates. + ```cmd + ./manage_db.sh setup + ``` + + * Starts all services in detached mode. + ```cmd + ./manage_db.sh run + ``` + + * Stops the containers. + ```cmd + ./manage_db.sh stop + ``` + + * Shows running status and resource usage (CPU/RAM). + ```cmd + ./manage_db.sh status + ``` + + * Tails logs for all services. + ```cmd + ./manage_db.sh logs + ``` + * Jumps directly into the Postgres SQL prompt. + ```cmd + ./manage_db.sh psql + ``` + * Triggers a manual backup immediately. + ```cmd + ./manage_db.sh backup + ``` + * Restores a database from a .gz or .dump file. + ```cmd + ./manage_db.sh restore + ``` + +## Security & Permissions + +During the setup phase, the script applies `chown -R 999:999` to the data and config folders. This matches the internal postgres user ID used by the official Docker image, ensuring the container has the necessary rights to write data and read configurations. diff --git a/wireguard_scripts/README.md b/wireguard_scripts/README.md new file mode 100644 index 0000000..8f25058 --- /dev/null +++ b/wireguard_scripts/README.md @@ -0,0 +1,111 @@ +# Wireguard helper scripts + +Lightweight Bash helpers for managing WireGuard peers without container restarts. They operate on a local `wg0.conf`, keep client artifacts under `wireguard_scripts/logs/`, and prefer `wg syncconf` over bring-the-interface-down workflows. + +## Introduction + +### Assumptions + + * WireGuard interface: `wg0` + * Network: `10.0.0.0/24` + * Config lives in `wireguard_scripts/` + * Client names must not contain spaces + * Client keys and configs are stored under `wireguard_scripts/logs//` + +### Features + + * **Zero-downtime apply:** Uses `wg syncconf wg0 <(wg-quick strip wg0)` instead of restarting the interface. + * **Auto IP assignment:** Reads existing `AllowedIPs` entries and increments the last `/32` address. + * **Template-driven config:** Replaces placeholders in `client_template` for private/public keys, IP, and domain. + * **QR code output:** Generates an ANSI QR code for terminal scanning and a PNG for clients to import on mobile. + * **CSV audit log:** Records timestamp, keys, IP, and peer status in `logs/client_log.csv`. + * **Save output file of the client:** Generated file like: public and private key, configuration and QR image, are saved to `wireguard_scripts/logs/`. + +_Note: Current **Auto IP assignment** isn't capable to detect the free addresses between current existing clients. For example, if there are only two clients with the addresses 10.0.0.2 and 10.0.0.6, it will not be capable to create the new client with address 10.0.0.3, but it will be 10.0.0.7._ + +### Quick Start + +From the `wireguard_scripts/` directory, run: + +```cmd +./next_client.sh +``` + +This prints the server public key, current clients, next available IP, and renders the filled client config template - without touching `wg0.conf`. + +_Note: This is just a template generation on how the configuration file would look. Copying it and pasting in your wireguard client would not create a VPN connection to the server._ + +## Technical Description + +### Notes + + * Removing a peer uses exact `# BEGIN_PEER ` / `# END_PEER ` tags and will also remove one preceding blank line if present. + * If `qrencode` is missing, the add script still succeeds but skips QR generation with a notice. + +### File Structure + + * [logs/](logs/): Per-client directories with keys, configs, QR PNGs, and the shared `client_log.csv`. + * [.env](.env): Environment specific variables which affects the script run and generated configuration file. + * [client_template](client_template): WireGuard client template with `<%CLIENT_PRIVATE_KEY%>`, `<%CLIENT_IP%>`, `<%SERVER_PUBLIC_KEY%>`, `<%DOMAIN_NAME%>`. + * [next_client.sh](next_client.sh): Preview next client config and IP. + * [next_client_add.sh](next_client_add.sh): Create client keys, config, QR code, save output files, update CSV log and add peer. + * [next_client_remove.sh](next_client_remove.sh): Remove peer and update CSV log. + +### Scripts + +Make sure that `` has no spaces. When running the script make sure that the following conditions are met to be able to add/remove a new client: + * add/remove - `` has no space and it canot be blanc. + * add - `` must not exist in `wg0.conf`. + * remove - `` must exist in `wg0.conf`. + +Script description: + * Preview the next client config/IP. + ```cmd + ./next_client.sh + ``` + + * Generate client keys, render config from `client_template`, append the peer block to `wg0.conf`, apply with `wg syncconf`, and mark the client as `active` in CSV log file. + ```cmd + ./next_client_add.sh + ``` + + * Remove the tagged peer block from `wg0.conf`, apply with `wg syncconf` and mark the client as `removed` in the CSV log file. + ```cmd + ./next_client_remove.sh + ``` + +### Environment + +The scripts look for a `.env` file in the same directory. If it is missing, they continue with built-in defaults and print a warning. + +Documented variables used by the scripts: + + * `DOMAIN_NAME` - inserted into the client config as the server endpoint hostname. + * `WG0_DIR` - directory containing `wg0.conf` and `publickey`. + * `TOOLS_DIR` - directory containing `client_template` and `logs/`. + +This file should **not** be committed. Treat it as machine-specific configuration. + +### client_template + +The template is processed with `sed` to generate each client config. Supported placeholders: + + * `<%CLIENT_PRIVATE_KEY%>` - newly generated client private key. + * `<%CLIENT_IP%>` - next assigned `/32` client IP, without CIDR suffix. + * `<%SERVER_PUBLIC_KEY%>` - server public key read from `${WG0_DIR}/publickey`. + * `<%DOMAIN_NAME%>` - endpoint hostname from `.env`. + +Example template: + +``` +[Interface] +PrivateKey = <%CLIENT_PRIVATE_KEY%> +Address = <%CLIENT_IP%>/24 +ListenPort = 51820 + +[Peer] +PublicKey = <%SERVER_PUBLIC_KEY%> +AllowedIPs = 10.0.0.0/24 +Endpoint = <%DOMAIN_NAME%>:51820 +PersistentKeepalive = 25 +``` \ No newline at end of file