Skip to content
This repository has been archived by the owner on Aug 17, 2021. It is now read-only.

satrapu/iquest-keyboards-and-mice-brasov-2018

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

iQuest Keyboards & Mice - Brașov - 2018

Table of Contents

Description

This repo contains the resources used during "How to Control Service Startup Order in Docker Compose" presentation at the Keyboards & Mice iQuest public event, which took place in Brașov on June 6th, 2018.

This presentation is based on this article, but while the latter shows a Java console application fetching data from a MySQL database, the former uses a .NET Core console application fetching data from a PostgreSQL database.

Presentation Slides

SlideShare: https://www.slideshare.net/satrapu/how-to-control-service-startup-order-in-docker-compose

References

Running the Application

  • Clone this repo
git clone https://github.com/satrapu/iquest-keyboards-and-mice-brasov-2018.git
cd ./iquest-keyboards-and-mice-brasov-2018
  • Start services

    • Using depends_on, condition and service_healthy:
    # Windows - PowerShell console run as admin
    cd .\compose\service-healthy `
    ;cmd /c mklink /J .\sources .\..\..\sources `
    ;docker-compose down --rmi local `
    ;docker-compose build `
    ;docker-compose up app
    # Linux - Bash
    cd ./compose/service-healthy \
    && mkdir ./sources && cp ../../sources/* sources \
    && docker-compose down --rmi local \
    && docker-compose build \
    && docker-compose up app
    • Using Docker Engine API
    # Windows - PowerShell console run as admin
    cd .\compose\docker-engine-api `
    ;cmd /c mklink /J .\sources .\..\..\sources `
    ;$Env:COMPOSE_CONVERT_WINDOWS_PATHS=1 `
    ;docker-compose down --rmi local `
    ;docker-compose build `
    ;docker-compose up app
    # Linux - Bash
    cd ./compose/docker-engine-api \
    && mkdir ./sources && cp ../../sources/* sources \
    && docker-compose down --rmi local \
    && docker-compose build \
    && docker-compose up app
    • Using port checking++
    # Windows - PowerShell console run as admin
    cd .\compose\port-checking++ `
    ;cmd /c mklink /J .\sources .\..\..\sources `
    ;docker-compose down --rmi local `
    ;docker-compose build `
    ;docker-compose up --exit-code-from check_db_connectivity check_db_connectivity `
    ;if ($LASTEXITCODE -eq 0) { docker-compose up app } `
    else { echo "ERROR: Failed to start service due to one of its dependencies!" }
    # Linux - Bash
    cd ./compose/port-checking++ \
    && mkdir ./sources && cp ../../sources/* sources \
    && docker-compose down --rmi local \
    && docker-compose build \
    && docker-compose up --exit-code-from check_db_connectivity check_db_connectivity \
    && if [ $? -eq 0 ]; then docker-compose up app; else echo 'ERROR: Failed to start service due to one of its dependencies!'; fi