oanhnn / docker-laravel-echo-server

Repository of oanhnn/laravel-echo-server Docker image.
MIT License
65 stars 37 forks source link

Laravel APP in a Docker container #5

Closed paschaldev closed 5 years ago

paschaldev commented 5 years ago

I have a laravel app setup with dokku / docker container. How do I use this library?

oanhnn commented 5 years ago

I never deploy it with Dokku but you can try deploy from dockerfile with:

FROM oanhnn/laravel-echo-server
oanhnn commented 5 years ago

You can use it in laravel project with docker-compose:

# docker-compose.yml
version: "3.5"

### Networks ###
networks:
  default: {}

### Volumes ###
volumes:
  mysql-dt: {}
  redis-dt: {}
  media-dt: {}

### Services ###
services:

  ### S3 service ###
  minio:
    image: minio/minio
    command: server /data
    environment:
      MINIO_ACCESS_KEY:  ${AWS_ACCESS_KEY_ID}
      MINIO_SECRET_KEY:  ${AWS_SECRET_ACCESS_KEY}
    networks:
      - default
    ports:
      - 9000:9000
    restart: unless-stopped
    volumes:
      - media-dt:/data

  ### Redis service ###
  redis:
    image: redis:4-alpine
    networks:
      - default
    ports:
      - 6379:6379
    restart: unless-stopped
    volumes:
      - redis-dt:/data

  ### Mysql service ###
  db:
    image: mariadb:10.3
    environment:
      MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-password}
      MYSQL_USER:          ${DB_USERNAME}
      MYSQL_PASSWORD:      ${DB_PASSWORD}
      MYSQL_DATABASE:      ${DB_DATABASE}
    networks:
      - default
    ports:
      - 3306:3306
    restart: unless-stopped
    volumes:
      - mysql-dt:/var/lib/mysql
      - .docker/initdb.d:/docker-entrypoint-initdb.d

  ### DB Adminer ###
  dbadmin:
    image: adminer
    depends_on:
      - db
    networks:
      - default
    ports:
      - 8080:8080
    restart: unless-stopped

  ### Pusher server ###
  pusher:
    image: oanhnn/laravel-echo-server:v2.0.0
    depends_on:
      - redis
    environment:
      LARAVEL_ECHO_SERVER_AUTH_HOST: ${APP_DOMAIN}
      REDIS_HOST:                    redis
      REDIS_PORT:                    6379
      REDIS_DB_BACKEND:              2
    networks:
      - default
    ports:
      - 6001:6001
    restart: unless-stopped

  ### App API service ###
  app:
#    build:
#      context: .
#      dockerfile: Dockerfile
    image: oanhnn/php:7.2-laravel
    depends_on:
      - db
      - redis
      - minio
    environment:
      APP_ENABLE_CRONTAB: 1
      APP_ENABLE_WORKERS: 1
    networks:
      - default
    ports:
      - 80:80
    restart: unless-stopped
    volumes:
      - .:/var/www/html
paschaldev commented 5 years ago

Thanks for your response @oanhnn

My application setup is actually a service of service working together. I don't use the server's MySQL directly, I use Amazon RDS / Aurora.

I don't think the docker-compose.yml would work in my use case. My application is on Dokku, I'll try to deploy with docker file and give you feedback.