Files
topstore-server/README.md

5.3 KiB
Raw Blame History

topstore-server

TopStore server setup of postgresql in docker, automation scripts, landing page and adding more as it do progress

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 users 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:

./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 folder or from docker template files.

Start Services: Launch the database and backup containers:

./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.

    ./manage_db.sh setup
    
  • Starts all services in detached mode.

    ./manage_db.sh run
    
  • Stops the containers.

    ./manage_db.sh stop	
    
  • Shows running status and resource usage (CPU/RAM).

    ./manage_db.sh status
    
  • Tails logs for all services.

    ./manage_db.sh logs
    
  • Jumps directly into the Postgres SQL prompt.

    ./manage_db.sh psql
    
  • Triggers a manual backup immediately.

    ./manage_db.sh backup
    
  • Restores a database from a .gz or .dump file.

    ./manage_db.sh restore <file>
    

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.