DEV Community

Cover image for Orchestrate your Laravel application with Docker Swarm
Gibran B
Gibran B

Posted on • Edited on • Originally published at gibransvarga.com

Orchestrate your Laravel application with Docker Swarm

In the previous articles we have managed architecture for High Availability applications with Docker using GlusterFS Replicated Volume. Now it’s time to get into more specifics by Orchestrate Laravel application with Docker Swarm and then test if this setup is resilient to VM failure.

Heading-1

We’re going to create a new docker image for the Laravel Project, and then define the entire stack configuration in a Docker Compose file that contains some services including the App/Laravel, Nginx, and MySQL database.


Heading-2 Why who Why whoo Whooooooooooo

For those who don’t know what Docker is, let’s enjoy a brief overview. According to opensource.com:

Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package.

Field Description
client_token This is the token that the client uses to authenticate with Vault
accessor An identifier or alias for the token
value This field can contain the actual secret being sent as a response
#Dockerfile

COPY laravel-app/composer.lock /var/www/
COPY laravel-app/composer.json /var/www/

WORKDIR /var/www

RUN apt-get update && apt-get install -y \
    build-essential libpng-dev libjpeg62-turbo-dev \
    libfreetype6-dev locales zip jpegoptim optipng pngquant gifsicle \
    vim unzip git curl

RUN apt-get clean && rm -rf /var/lib/apt/lists/*

RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl
RUN docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/
RUN docker-php-ext-install gd

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
Enter fullscreen mode Exit fullscreen mode
// Tsx file
import * as React from 'react';

export interface ButtonProps {
  children: React.ReactNode;
}

export function Button(props: ButtonProps) {
  return <button>{props.children}</button>;
}

Button.displayName = 'Button';
Enter fullscreen mode Exit fullscreen mode

We’re going to create a new docker image for the Laravel Project, and then define the entire stack configuration in a Docker Compose file that contains some services including the App/Laravel, Nginx, and MySQL database.

Top comments (0)