Skip to content

SSH sync between ssh container and app #686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Alphaegen opened this issue Apr 20, 2022 · 4 comments
Open

SSH sync between ssh container and app #686

Alphaegen opened this issue Apr 20, 2022 · 4 comments
Labels
help wanted stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed

Comments

@Alphaegen
Copy link

Description
I've used an existing project but can't seem to sync the ssh and app containers. I have read I should have installed it with ssh instead of trying to set it up later, but because it's an existing project I'm not sure how to do that.

Steps To Reproduce

  1. Use existing Magento project
  2. Installed using normal instructions
  3. Copied ssh docker-compose file to docker-compose.dev.yml
  4. Restarted containers

Expected Result
The ssh container using the same volume as app together with all the files.

Actual Result
Only the nginx config being present.

@PhilipRowe
Copy link

@markshust I was having the same issue where i only saw the nginx config when connecting via ssh. I was able to fix this by moving the ssh containers definition into the main docker compose.yml and then only adding the extra files in the docker-compose.dev.yml. See the configuration below.

After making this change i was able to see all the files for the M2 website.

docker-compose.yml

## Mark Shust's Docker Configuration for Magento
## (https://github.com/markshust/docker-magento)
##
## Version 43.0.0

## To use SSH, see https://github.com/markshust/docker-magento#ssh
## Linux users, see https://github.com/markshust/docker-magento#linux

## If you changed the default Docker network, you may need to replace
## 172.17.0.1 in this file with the result of:
## docker network inspect bridge --format='{{(index .IPAM.Config 0).Gateway}}'

version: "3"

services:
  app:
    image: markoshust/magento-nginx:1.18-7
    ports:
      - "80:8000"
      - "443:8443"
    volumes: &appvolumes
      - ~/.composer:/var/www/.composer:cached
      - ~/.ssh/id_rsa:/var/www/.ssh/id_rsa:cached
      - ~/.ssh/known_hosts:/var/www/.ssh/known_hosts:cached
      - appdata:/var/www/html
      - sockdata:/sock
      - ssldata:/etc/nginx/certs
    #extra_hosts: &appextrahosts
      ## Selenium support, replace "magento.test" with URL of your site
      #- "magento.test:172.17.0.1"

  phpfpm:
    image: markoshust/magento-php:8.1-fpm-1
    volumes: *appvolumes
    env_file: env/phpfpm.env
    #extra_hosts: *appextrahosts

  ssh:
    image: markoshust/ssh
    ports:
      - "22:22"
    volumes: *appvolumes

  db:
    image: mariadb:10.4
    command: --max_allowed_packet=64M
    ports:
      - "3306:3306"
    env_file: env/db.env
    volumes:
      - dbdata:/var/lib/mysql

  redis:
    image: redis:6.2-alpine
    ports:
      - "6379:6379"

  elasticsearch:
    image: markoshust/magento-elasticsearch:7.16-0
    ports:
      - "9200:9200"
      - "9300:9300"
    environment:
      - "discovery.type=single-node"
      ## Set custom heap size to avoid memory errors
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
      ## Avoid test failures due to small disks
      ## More info at https://github.com/markshust/docker-magento/issues/488
      - "cluster.routing.allocation.disk.threshold_enabled=false"
      - "index.blocks.read_only_allow_delete"

  rabbitmq:
    image: markoshust/magento-rabbitmq:3.9-0
    ports:
      - "15672:15672"
      - "5672:5672"
    volumes:
      - rabbitmqdata:/var/lib/rabbitmq
    env_file: env/rabbitmq.env

  mailcatcher:
    image: sj26/mailcatcher
    ports:
      - "1080:1080"

  ## Blackfire support, uncomment to enable
  #blackfire:
  #  image: blackfire/blackfire:2
  #  ports:
  #    - "8307"
  #  env_file: env/blackfire.env

  ## Selenium support, uncomment to enable
  #selenium:
  #  image: selenium/standalone-chrome-debug:3.8.1
  #  ports:
  #    - "5900:5900"
  #  extra_hosts: *appextrahosts

volumes:
  appdata:
  dbdata:
  rabbitmqdata:
  sockdata:
  ssldata:

docker-compose.dev.yml

services:
  app:
    volumes: &appvolumes
      - ./src/nginx.conf.sample:/var/www/html/nginx.conf:cached

  phpfpm:
    volumes: *appvolumes

  ssh:
    volumes: *appvolumes

@tiziano-seguida
Copy link

@PhilipRowe @markshust

I tried placing the SSH container definition on the compose.yaml file instead of on the compose.dev.yaml file but this causes the phpfpm container to be unable to be started

phpfpm crashed with the following error:

ERROR: Another FPM instance seems to already listen on /sock/docker.sock ERROR: FPM initialization failed

@markshust
Copy link
Owner

I don't work in this SSH method at all, however I'll tag this and take in any PR's to fix it.

Copy link

dosubot bot commented Mar 30, 2025

Hi, @Alphaegen. I'm Dosu, and I'm helping the docker-magento team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • The issue involves syncing SSH and app containers, where only the nginx configuration is visible in the SSH container.
  • PhilipRowe suggested moving the SSH container definition to the main docker-compose.yml, which resolved the issue for him.
  • Tiziano-seguida reported that this solution caused the phpfpm container to fail due to a conflict with another FPM instance.
  • Markshust, the repository owner, is open to pull requests to address this issue.

Next Steps:

  • Please let me know if this issue is still relevant to the latest version of the docker-magento repository by commenting here.
  • If there is no further activity, this issue will be automatically closed in 30 days.

Thank you for your understanding and contribution!

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Mar 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed
Projects
None yet
Development

No branches or pull requests

4 participants