Sign inSign up

naif775devops/ziryab-app

By naif775devops

Updated about 1 month ago

Image
0

721

naif775devops/ziryab-app repository overview

Ziryab App

Ziryab is a modern, containerized Laravel application. This repository contains the core application image naif775devops/ziryab-app.

Architecture Overview

The application is designed to be deployed using a multi-container Docker Compose setup. It relies on the following services:

  • App (PHP-FPM): The main Laravel application container (this image), which processes backend PHP logic.
  • Reverse Proxy (Traefik): Manages external traffic and dynamically routes requests to the correct containers.
  • Webserver (Nginx): Serves static assets and acts as a web server, forwarding dynamic requests to the App container.
  • Database (MySQL 8.0): The primary relational database for the application.
  • Cache (Redis): Provides fast in-memory caching and session management.

Exposed Ports

External traffic is handled entirely by Traefik. The exposed ports on the host machine are:

  • 80: Standard HTTP traffic. The application is accessible at http://ziryab.localhost.
  • 8080: Traefik's web UI dashboard (if enabled).

Internal containers (like MySQL on 3306 or Redis on 6379) are safely isolated within the Docker network and are not exposed directly to the outside world.

Environment Variables (.env)

To run the application, you must provide an .env file in the root directory where your docker-compose.yml resides. Below are the critical variables required for the containers to communicate:

# ==========================================
# Application Settings
# ==========================================
APP_VERSION=V1.0.0
APP_NAME=Laravel
APP_ENV=production
# Generate a key and place it below (e.g. base64:...)
APP_KEY=
APP_URL=http://ziryab.localhost

# ==========================================
# Database Settings
# ==========================================
DB_CONNECTION=mysql
# DB_HOST must match the database service name in docker-compose
DB_HOST=db
DB_PORT=3306
DB_DATABASE=ziryab_shop
DB_USERNAME=ziryab_user
DB_PASSWORD=secretpassword
# DB_ROOT_PASSWORD is required for the initial setup of the MySQL container
DB_ROOT_PASSWORD=secretpassword

Quick Start Guide

  1. Create an .env file based on the environment variables provided above.
  2. Create a docker-compose.yml file (see the example below).
  3. Run the stack to pull the images and start the services:
    docker compose up -d
    

Example docker-compose.yml

Below is a complete, production-ready docker-compose.yml file you can use to run this image alongside its required services:

services:
  # 1. Reverse Proxy (Traefik) - The only service exposing ports
  reverse-proxy:
    image: traefik
    container_name: ziryab_traefik
    command:
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedByDefault=false"
      - "--entrypoints.web.address=:80"
    ports:
      - "80:80"
      - "8080:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    environment:
      - DOCKER_API_VERSION=1.40
    networks:
      - ziryab-network

  # 2. Laravel Application (PHP-FPM)
  app:
    image: naif775devops/ziryab-app:${APP_VERSION:-latest}
    container_name: ziryab_app
    restart: unless-stopped
    env_file:
      - .env
    networks:
      - ziryab-network

  # 3. Web Server (Nginx)
  webserver:
    image: naif775devops/ziryab-nginx:${APP_VERSION:-latest}
    container_name: ziryab_nginx
    restart: unless-stopped
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.ziryab.rule=Host(`ziryab.localhost`)"
      - "traefik.http.routers.ziryab.entrypoints=web"
      - "traefik.http.services.ziryab.loadbalancer.server.port=80"
    networks:
      - ziryab-network

  # 4. Database (MySQL)
  db:
    image: mysql:8.0
    container_name: ziryab_db
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: ${DB_DATABASE}
      MYSQL_USER: ${DB_USERNAME}
      MYSQL_PASSWORD: ${DB_PASSWORD}
      MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
    volumes:
      - db-data:/var/lib/mysql
    networks:
      - ziryab-network

  # 5. Cache System (Redis)
  redis:
    image: redis:alpine
    container_name: ziryab_redis
    restart: unless-stopped
    networks:
      - ziryab-network

networks:
  ziryab-network:
    driver: bridge

volumes:
  db-data:
    driver: local

Tag summary

Content type

Image

Digest

sha256:56157c3d9

Size

50.8 MB

Last updated

about 1 month ago

docker pull naif775devops/ziryab-app