EugenMayer / docker-sync

Run your application at full speed while syncing your code for development, finally empowering you to utilize docker for development under OSX/Windows/*Linux
GNU General Public License v3.0
3.54k stars 290 forks source link

Syncing gets sluggish after docker restart #573

Closed puneet-mishra closed 6 years ago

puneet-mishra commented 6 years ago

Hello Eugene,

I did the setup for native-osx, and the result was unbelievable, setup became extremely fast. Hence, I replicated the solution for my entire team, one of my team members restarted his computer and syncing stopped for him. I just restarted my docker-app and syncing is almost stopped, there is lag of minutes between the code writing and changes on the site. Is there something I am missing?

I always run docker-sync start, and then docker-compose up.

Below are my docker-sync.yml and docker-compose.yml files.

DOCKER-SYNC.YML

version: "2"

options:
  verbose: true
syncs:
  appcode-native-osx-sync: # tip: add -sync and you keep consistent names as a convention
    src: '../.'
    # sync_strategy: 'native_osx' # not needed, this is the default now
    sync_excludes: ['../web/web/vendor', '../extension/node_modules', '../landing/vendor', '../landing/node_modules']

DOCKER-COMPOSE.YML

version: "2"

services:

### Native OSX Sync Container #############################
    app-native-osx:
      image: alpine
      volumes:
        - appcode-native-osx-sync:/var/www/public:nocopy 

### Applications Code Container #############################

    applications:
      image: tianon/true
      volumes_from:
        - app-native-osx

### Workspace Utilities Container ###########################

    workspace:
      build:
        context: ./workspace
        args:
          - COMPOSER_GLOBAL_INSTALL=${WORKSPACE_COMPOSER_GLOBAL_INSTALL}
          - INSTALL_WORKSPACE_SSH=${WORKSPACE_INSTALL_WORKSPACE_SSH}
          - INSTALL_LARAVEL_INSTALLER=${WORKSPACE_INSTALL_LARAVEL_INSTALLER}
          - PUID=${WORKSPACE_PUID}
          - PGID=${WORKSPACE_PGID}
          - TZ=${WORKSPACE_TIMEZONE}
        dockerfile: "Dockerfile-${PHP_VERSION}"
      volumes_from:
        - app-native-osx
      extra_hosts:
        - "dockerhost:${DOCKER_HOST_IP}"
      ports:
        - "${WORKSPACE_SSH_PORT}:22"
      tty: true
      networks:
        - frontend
        - backend

### PHP-FPM Container #######################################

    php-fpm:
      build:
        context: ./php-fpm
        args:
          - INSTALL_PHPREDIS=${PHP_FPM_INSTALL_PHPREDIS}
          - INSTALL_MYSQLI=${PHP_FPM_INSTALL_MYSQLI}
        dockerfile: "Dockerfile-${PHP_VERSION}"
      volumes_from:
        - app-native-osx
      volumes:
        - ./php-fpm/php${PHP_VERSION}.ini:/usr/local/etc/php/php.ini
      expose:
        - "9000"
      depends_on:
        - workspace
      extra_hosts:
        - "dockerhost:${DOCKER_HOST_IP}"
      environment:
        - PHP_IDE_CONFIG=${PHP_IDE_CONFIG}
      networks:
        - backend
        - frontend

### Bakend Python Container ##################################

    backend:
      build:
        context: ./backend
      volumes_from:
        - app-native-osx
      ports:
        - "${FLOWER_PORT}:5555"
      tty: true
      networks:
        - frontend
        - backend

### Nginx Server Container ##################################

    nginx:
      build:
        context: ./nginx
        args:
          - PHP_UPSTREAM=php-fpm
      volumes_from:
        - app-native-osx
      volumes:
        - ${NGINX_HOST_LOG_PATH}:/var/log/nginx
        - ${NGINX_SITES_PATH}:/etc/nginx/sites-available
      ports:
        - "${NGINX_HOST_HTTP_PORT}:80"
        - "${NGINX_HOST_HTTPS_PORT}:443"
      depends_on:
        - php-fpm
      networks:
        - frontend
        - backend

### Apache Server Container #################################

    apache2:
      build:
        context: ./apache2
        args:
          - PHP_SOCKET=${PHP_SOCKET}
      volumes_from:
        - app-native-osx
      volumes:
        - ${APACHE_HOST_LOG_PATH}:/var/log/apache2
        - ${APACHE_SITES_PATH}:/etc/apache2/sites-available
      ports:
        - "${APACHE_HOST_HTTP_PORT}:80"
        - "${APACHE_HOST_HTTPS_PORT}:443"
        - "${WEBSOCKET_PORT}:5001"
      depends_on:
        - php-fpm
      networks:
        - frontend
        - backend

### MySQL Container #########################################

    mysql:
      build:
        context: ./mysql
      environment:
        - MYSQL_DATABASE=${MYSQL_DATABASE}
        - MYSQL_USER=${MYSQL_USER}
        - MYSQL_PASSWORD=${MYSQL_PASSWORD}
        - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
        - TZ=${WORKSPACE_TIMEZONE}
      volumes:
        - ${DATA_SAVE_PATH}/mysql:/var/lib/mysql
        - ${MYSQL_ENTRYPOINT_INITDB}:/docker-entrypoint-initdb.d
      ports:
        - "${MYSQL_PORT}:3306"
      networks:
        - backend
        - frontend

### Redis Container #########################################

    redis:
      build: ./redis
      volumes:
        - ${DATA_SAVE_PATH}/redis:/data
      ports:
        - "6379:6379"
      networks:
        - backend

### Beanstalkd Container ####################################

    beanstalkd:
      build: ./beanstalkd
      ports:
        - "${BEANSTALKD_HOST_PORT}:11300"
      privileged: true
      depends_on:
        - php-fpm
      networks:
        - backend

### RabbitMQ Container ######################################

    rabbitmq:
      build: ./rabbitmq
      ports:
        - "${RABBITMQ_NODE_HOST_PORT}:5672"
        - "${RABBITMQ_MANAGEMENT_HTTP_HOST_PORT}:15672"
        - "${RABBITMQ_MANAGEMENT_HTTPS_HOST_PORT}:15671"
      privileged: true
      environment:
        - RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER}
        - RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS}
      depends_on:
        - php-fpm
      networks:
        - backend

### Beanstalkd Console Container ############################

    beanstalkd-console:
      build: ./beanstalkd-console
      ports:
        - "2080:2080"
      depends_on:
        - beanstalkd
      networks:
        - backend

### Networks Setup ############################################

networks:
  frontend:
    driver: "bridge"
  backend:
    driver: "bridge"

### Volumes Setup #############################################

volumes:
  appcode-native-osx-sync:
    external: true
    # driver: "local"
  mysql:
    driver: "local"
  redis:
    driver: "local"
  neo4j:
    driver: "local"
  mariadb:
    driver: "local"
  mongo:
    driver: "local"
  minio:
    driver: "local"
  rethinkdb:
    driver: "local"
  phpmyadmin:
    driver: "local"
  adminer:
    driver: "local"
  aerospike:
    driver: "local"
  caddy:
    driver: "local"
  elasticsearch-data:
    driver: "local"
  elasticsearch-plugins:
    driver: "local"
puneet-mishra commented 6 years ago

Syncing has stopped, I have debugged, and /app_sync file differs from the actual file, /host_sync works fine, and there are no logs in /tmp/unison.log inside the sync container

EugenMayer commented 6 years ago

please see the already open issues